summaryrefslogtreecommitdiffstats
path: root/graphics/src/text/editor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/src/text/editor.rs')
-rw-r--r--graphics/src/text/editor.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/graphics/src/text/editor.rs b/graphics/src/text/editor.rs
index c488a51c..36b4ca6e 100644
--- a/graphics/src/text/editor.rs
+++ b/graphics/src/text/editor.rs
@@ -385,6 +385,27 @@ impl editor::Editor for Editor {
}));
}
}
+ Action::SelectAll => {
+ let buffer = editor.buffer();
+ if buffer.lines.len() > 1
+ || buffer
+ .lines
+ .first()
+ .is_some_and(|line| !line.text().is_empty())
+ {
+ let cursor = editor.cursor();
+ editor.set_select_opt(Some(cosmic_text::Cursor {
+ line: 0,
+ index: 0,
+ ..cursor
+ }));
+
+ editor.action(
+ font_system.raw(),
+ motion_to_action(Motion::DocumentEnd),
+ );
+ }
+ }
// Editing events
Action::Edit(edit) => {