Delete the selection. Returns whether there was one.
- edit: the text being edited.
edit: Text_Edit;
defer free_text_edit(*edit);
set_contents(*edit, "hello world");
move_caret(*edit, 5);
move_caret(*edit, 11, extend = true);
assert(delete_selection(*edit));
assert(contents(*edit) == "hello");
assert(!delete_selection(*edit));delete_selection :: (edit: *Text_Edit) -> bool
Delete the selection. Returns whether there was one.
Parameters
- edit: *Text_Edit
- the text being edited.
Returns
- bool
edit: Text_Edit;
defer free_text_edit(*edit);
set_contents(*edit, "hello world");
move_caret(*edit, 5);
move_caret(*edit, 11, extend = true);
assert(delete_selection(*edit));
assert(contents(*edit) == "hello");
assert(!delete_selection(*edit));