Apply one KEY or TEXT input event to edit. style is the text style the lines are drawn in
(vertical movement measures with it); page_lines is how many lines a page is.
- ui: the UI, used for measuring and the clipboard.
- edit: the text being edited.
- event: the KEY or TEXT event.
- style: the text style the lines are drawn in, used to measure vertical moves.
- options: read-only mode and the tab width.
- page_lines: how many lines Page Up and Page Down move.
edit: Text_Edit;
defer free_text_edit(*edit);
ui := headless();
defer free_ui(*ui);
event: Input_Event;
event.kind = .TEXT;
event.character = #char "h";
result := handle_key(*ui, *edit, event, .{}, .{}, 10);
assert(result.changed && contents(*edit) == "h");handle_key :: (
ui: *UI_State,
edit: *Text_Edit,
event: Input_Event,
style: Text_Style,
options: Editor_Options,
page_lines: int
) -> Key_Result
Apply one KEY or TEXT input event to edit. style is the text style the lines are drawn in
(vertical movement measures with it); page_lines is how many lines a page is.
Parameters
- ui: *UI_State
- the UI, used for measuring and the clipboard.
- edit: *Text_Edit
- the text being edited.
- event: Input_Event
- the KEY or TEXT event.
- style: Text_Style
- the text style the lines are drawn in, used to measure vertical moves.
- options: Editor_Options
- read-only mode and the tab width.
- page_lines: int
- how many lines Page Up and Page Down move.
Returns
edit: Text_Edit;
defer free_text_edit(*edit);
ui := headless();
defer free_ui(*ui);
event: Input_Event;
event.kind = .TEXT;
event.character = #char "h";
result := handle_key(*ui, *edit, event, .{}, .{}, 10);
assert(result.changed && contents(*edit) == "h");