summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'graphics')
-rw-r--r--graphics/src/text/editor.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/graphics/src/text/editor.rs b/graphics/src/text/editor.rs
index 4673fce3..dfb91f34 100644
--- a/graphics/src/text/editor.rs
+++ b/graphics/src/text/editor.rs
@@ -221,6 +221,12 @@ impl editor::Editor for Editor {
}
}
+ fn cursor_position(&self) -> (usize, usize) {
+ let cursor = self.internal().editor.cursor();
+
+ (cursor.line, cursor.index)
+ }
+
fn perform(&mut self, action: Action) {
let mut font_system =
text::font_system().write().expect("Write font system");
@@ -559,7 +565,7 @@ impl editor::Editor for Editor {
Some(i)
}
})
- .unwrap_or(buffer.lines.len());
+ .unwrap_or(buffer.lines.len().saturating_sub(1));
let current_line = highlighter.current_line();