A piece of text being edited. Zero is empty; release it with free_text_edit.
edit: Text_Edit;
defer free_text_edit(*edit);
set_contents(*edit, "hello");
move_caret(*edit, 5);
insert_text(*edit, " world");
assert(contents(*edit) == "hello world");Fields
- buffer: Text_Buffer
- cursor: int
- byte offset of the caret
- anchor: int
- the other end of the selection (equal to
cursorwhen nothing is selected) - goal_x: float
- x position vertical movement tries to keep; -1 when not set
- scroll_x: float
- how far the view is scrolled, in points
- scroll_y: float
- single_line: bool
- Enter is "submit" and line breaks are not accepted
- dragging: bool
- a mouse drag is selecting
- follow_version: int
- the buffer version and caret the view last scrolled to show
- follow_cursor: int
- caret_time: float64
- the last time the caret moved, so it is solid while moving