Method: Textbringer::Buffer#goto_char

Defined in:
lib/textbringer/buffer.rb

#goto_char(pos) ⇒ Object



479
480
481
482
483
484
485
486
487
488
489
490
491
# File 'lib/textbringer/buffer.rb', line 479

def goto_char(pos)
  if pos < 0 || pos > size
    raise RangeError, "Out of buffer"
  end
  if !@binary && /[\x80-\xbf]/n =~ byte_after(pos)
    raise ArgumentError, "Position is in the middle of a character"
  end
  @goal_column = nil
  if @save_point_level == 0
    @current_line, @current_column = get_line_and_column(pos)
  end
  @point = pos
end