Edition engines
Type of edition engines. 'a
is the type of custom data
attached to the engine in order to extend it.
create ?editable ?move ?clipboard ()
creates a new edition
engine in the initial state.
editable
is used to determine whether the text at given
position is editable or not. It takes as argument the position
and the length of the text to remove.
move
is unused.
clipboard
is the clipboard to use for this engine. If none is
defined, a new one using a reference is created.
match_word
is used to recognize words. It must returns the end
of the matched word if any.
locale
is the locale of this buffer. It is used for case
mapping.
undo_size
is the size of the undo buffer. It is the number of
state zed will remember. It defaults to 1000
.
get_data edit
returns the custom data attached to the
engine. It raises Not_found
if no data is attached to the
engine.
changes edit
returns an event which occurs with values of the
form (start, added, removed)
when the contents of the engine
changes. start
is the start of modifications, added
is the
number of characters added and removed
is the number of
characters removed.
update edit cursors
returns an event which occurs each the
rendering of the engine should be updated.
set_erase_mode edit state
sets the status of the erase mode
for the given engine.
mark edit
returns the cursor used to for the mark in the given
engine.
new_cursor edit
creates a new cursor for the given edition
engine. The cursor initially points to the beginning of the
buffer.
Exception raised when trying to edit a non-editable portion of a buffer.
Type of contexts. Contexts are used to modify an edition buffer.
context ?check edit cursor
creates a new context with given
parameters. cursor
is the cursor that will be used for all
modification of the text. If check
is true
(the default)
then all modification of the text will be checked with the
editable
function of the engine.
check ctx
returns whether the context has been created with
the check
flag.
goto ctx ?set_column position
moves the cursor to the given
position. It raises Zed_cursor.Out_of_bounds if the position
is outside the bounds of the text. If set_wanted_column
is
true
, the wanted column of the cursor is set to the new
column.
move ctx ?set_wanted_column delta
moves the cursor by the
given number of characters. It raises
Zed_cursor.Out_of_bounds if the current plus delta
is
outside the bounds of the text.
move_line ctx ?set_wanted_column delta
moves the cursor by the
given number of lines.
at_bol ctx
returns true
iff the cursor is at the beginning
of the current line.
at_eol ctx
returns true
iff the cursor is at the end of the
current line.
at_bot ctx
returns true
iff the cursor is at the beginning
of the text.
remove_next ctx n
removes n
characters at current
position. If there is less than n
characters at current
position, it removes everything until the end of the text.
remove_prev ctx n
removes n
characters before current
position. If there is less than n
characters before current
position, it removes everything until the beginning of the
text.
next_char ctx
moves the cursor to the next character. It does
nothing if the cursor is at the end of the text.
prev_char ctx
moves the cursor to the previous character. It
does nothing if the cursor is at the beginning of the text.
next_line ctx
moves the cursor to the next line. If the cursor
is on the last line, it is moved to the end of the buffer.
prev_line ctx
moves the cursor to the previous line. If the
cursor is on the first line, it is moved to the beginning of the
buffer.
goto_bol ctx
moves the cursor to the beginning of the current
line.
delete_next_char ctx
deletes the character after the cursor,
if any.
delete_prev_char ctx
delete the character before the
cursor.
delete_next_line ctx
delete everything until the end of the
current line.
delete_next_line ctx
delete everything until the beginning of
the current line.
kill_next_line ctx
delete everything until the end of the
current line and save it to the clipboard.
kill_next_line ctx
delete everything until the beginning of
the current line and save it to the clipboard.
kill ctx
copies the current selectionned region to the
clipboard and remove it.
capitalize_word ctx
capitalizes the first word after the
cursor.
lowercase_word ctx
converts the first word after the cursor to
lowercase.
uppercase_word ctx
converts the first word after the cursor to
uppercase.
prev_word ctx
moves the cursor to the beginning of the
previous word.
kill_next_word ctx
deletes the word after the cursor and save
it to the clipboard.
kill_prev_word ctx
deletes the word before the cursor and save
it to the clipboard.
#
| Newline
| |||
#
| Next_char
| |||
#
| Prev_char
| |||
#
| Next_line
| |||
#
| Prev_line
| |||
#
| Goto_bol
| |||
#
| Goto_eol
| |||
#
| Goto_bot
| |||
#
| Goto_eot
| |||
#
| Delete_next_char
| |||
#
| Delete_prev_char
| |||
#
| Delete_next_line
| |||
#
| Delete_prev_line
| |||
#
| Kill_next_line
| |||
#
| Kill_prev_line
| |||
#
| Switch_erase_mode
| |||
#
| Set_mark
| |||
#
| Goto_mark
| |||
#
| Copy
| |||
#
| Kill
| |||
#
| Yank
| |||
#
| Capitalize_word
| |||
#
| Lowercase_word
| |||
#
| Uppercase_word
| |||
#
| Next_word
| |||
#
| Prev_word
| |||
#
| Delete_next_word
| |||
#
| Delete_prev_word
| |||
#
| Kill_next_word
| |||
#
| Kill_prev_word
| |||
#
| Undo
|
Type of actions.
doc_of_action action
returns a short description of the
action.
action_of_name str
converts the given action name into an
action. Action name are the same as function name but with '_'
replaced by '-'. It raises Not_found
if the name does not
correspond to an action.
Insert ch
is represented by "insert(<char>)" where <char>
is: