Cursors
A cursor is a pointer in an edition buffer. When some text is inserted or removed, all cursors after the modification are automatically moved accordingly.
Type of a cursor.
Exception raised when trying to move a cursor outside the bounds of the text it points to.
create length changes get_lines position wanted_column
creates
a new cursor pointing to position position
.
length
is the current length of the text the cursor points
to. It raises Out_of_bounds if position
is greater than
length
.
changes
is an event which occurs with values of the form
(start, added, removed)
when the text changes, with the same
semantic as Zed_edit.changes.
get_lines
is used to retreive the current set of line
positions of the text. It is used to compute the line and column
of the cursor.
wanted_column
is the column on which the cursor want to be, if
there is enough room on the line.
get_coordinates cursor
returns the
current line & column of the cursor.
get_wanted_column cursor
returns the column on which the
cursor wants to be.
set_wanted_column cursor
sets the column on which the cursor
want to be.
goto cursor position
moves the given cursor to the given
position. It raises Out_of_bounds if position
is outside
the bounds of the text. If set_wanted_column
is true
(the
default), then the wanted column will be set to the column of
the cursor at given position.
move cursor delta
moves the given cursor by the given number
of characters. It raises Out_of_bounds if the result is
outside the bounds of the text.