UI module

delete_by

procedureextensionexperimentalsince 0.31.0Source

Delete one unit before (direction -1) or after (1) the caret, or the selection if there is one.

Example↗
edit: Text_Edit;
defer free_text_edit(*edit);
set_contents(*edit, "one two");
move_caret(*edit, 7);
delete_by(*edit, .WORD, -1);
assert(contents(*edit) == "one ");
delete_by :: (edit: *Text_Edit, unit: Unit, direction: int)

Delete one unit before (direction -1) or after (1) the caret, or the selection if there is one.

Parameters

edit: *Text_Edit
the text being edited.
unit: Unit
how much to delete.
direction: int
-1 for before the caret, 1 for after.
Example↗
edit: Text_Edit;
defer free_text_edit(*edit);
set_contents(*edit, "one two");
move_caret(*edit, 7);
delete_by(*edit, .WORD, -1);
assert(contents(*edit) == "one ");

See also