summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'graphics')
-rw-r--r--graphics/src/text/editor.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/graphics/src/text/editor.rs b/graphics/src/text/editor.rs
index 3fd2c4fe..8eec94c9 100644
--- a/graphics/src/text/editor.rs
+++ b/graphics/src/text/editor.rs
@@ -334,7 +334,24 @@ impl editor::Editor for Editor {
}
}
}
- Action::SelectLine => todo!(),
+ Action::SelectLine => {
+ let cursor = editor.cursor();
+
+ if let Some(line_length) = editor
+ .buffer()
+ .lines
+ .get(cursor.line)
+ .map(|line| line.text().len())
+ {
+ editor
+ .set_cursor(cosmic_text::Cursor { index: 0, ..cursor });
+
+ editor.set_select_opt(Some(cosmic_text::Cursor {
+ index: line_length,
+ ..cursor
+ }));
+ }
+ }
// Editing events
Action::Insert(c) => {