Delete one unit before (direction -1) or after (1) the caret, or the selection if there is one.
- edit: the text being edited.
- unit: how much to delete.
- direction: -1 for before the caret, 1 for after.
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.
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 ");