Replace the selection (or insert at the caret) with text.
- edit: the text being edited.
- text: the text to insert. Line breaks are removed in a single-line edit.
edit: Text_Edit;
defer free_text_edit(*edit);
set_contents(*edit, "hello");
select_all(*edit);
insert_text(*edit, "bye"); // replaces the selection
assert(contents(*edit) == "bye");insert_text :: (edit: *Text_Edit, text: string)
Replace the selection (or insert at the caret) with text.
Parameters
- edit: *Text_Edit
- the text being edited.
- text: string
- the text to insert. Line breaks are removed in a single-line edit.
edit: Text_Edit;
defer free_text_edit(*edit);
set_contents(*edit, "hello");
select_all(*edit);
insert_text(*edit, "bye"); // replaces the selection
assert(contents(*edit) == "bye");