A multi-line text editor over edit: line numbers, selection, scrolling, undo and the clipboard.
Returns true on the frame the text changed. It fills the space it is given.
- edit: the text being edited.
- options: font, size, line numbers, highlighting, marks, read-only mode and tab width.
- loc: the call site. It identifies the widget from one frame to the next, so leave the default.
#import "Basic";
#import "Extensions/UI";
Notes :: struct {
edit: Text_Edit;
dirty: bool;
}
main :: () {
notes: Notes;
run_app(.{title = "Notes", width = 480, height = 320}, *notes, build);
}
build :: (notes: *Notes) {
if text_editor(*notes.edit, .{line_numbers = true}) notes.dirty = true;
}This one is only checked to compile, not run.
text_editor :: (
edit: *Text_Edit,
options: Editor_Options = .{},
loc := #caller_location
) -> changed: bool
A multi-line text editor over edit: line numbers, selection, scrolling, undo and the clipboard.
Returns true on the frame the text changed. It fills the space it is given.
Parameters
- edit: *Text_Edit
- the text being edited.
- options: Editor_Options
- font, size, line numbers, highlighting, marks, read-only mode and tab width.
- loc := #caller_location
- the call site. It identifies the widget from one frame to the next, so leave the default.
Returns
- changed: bool
#import "Basic";
#import "Extensions/UI";
Notes :: struct {
edit: Text_Edit;
dirty: bool;
}
main :: () {
notes: Notes;
run_app(.{title = "Notes", width = 480, height = 320}, *notes, build);
}
build :: (notes: *Notes) {
if text_editor(*notes.edit, .{line_numbers = true}) notes.dirty = true;
}This one is only checked to compile, not run.