UI module

set_contents

procedureextensionexperimentalsince 0.31.0Source

Replace everything with text and put the caret at the start. History is cleared.

Example↗
edit: Text_Edit;
defer free_text_edit(*edit);
set_contents(*edit, "one\ntwo");
assert(contents(*edit) == "one\ntwo");
set_contents :: (edit: *Text_Edit, text: string)

Replace everything with text and put the caret at the start. History is cleared.

Parameters

edit: *Text_Edit
the text being edited.
text: string
the new text.
Example↗
edit: Text_Edit;
defer free_text_edit(*edit);
set_contents(*edit, "one\ntwo");
assert(contents(*edit) == "one\ntwo");

See also