UI module

select_word_at

procedureextensionexperimentalsince 0.31.0Source

Select the word around offset.

Example↗
edit: Text_Edit;
defer free_text_edit(*edit);
set_contents(*edit, "hello world");
select_word_at(*edit, 8);
assert(selected_text(*edit) == "world");
select_word_at :: (edit: *Text_Edit, offset: int)

Select the word around offset.

Parameters

edit: *Text_Edit
the text being edited.
offset: int
a byte offset in the word.
Example↗
edit: Text_Edit;
defer free_text_edit(*edit);
set_contents(*edit, "hello world");
select_word_at(*edit, 8);
assert(selected_text(*edit) == "world");

See also