Fixed bug in cursor movement code that would result in crashes.

This commit is contained in:
Nathan Vegdahl 2015-01-11 11:36:34 -08:00
parent 9156f5cf47
commit d80586e262
2 changed files with 5 additions and 6 deletions

View File

@ -377,10 +377,9 @@ impl Editor {
} }
pub fn cursor_right(&mut self, n: usize) { pub fn cursor_right(&mut self, n: usize) {
if self.cursor.range.1 <= (self.buffer.grapheme_count() - n) { self.cursor.range.1 += n;
self.cursor.range.1 += n;
} if self.cursor.range.1 > self.buffer.grapheme_count() {
else {
self.cursor.range.1 = self.buffer.grapheme_count(); self.cursor.range.1 = self.buffer.grapheme_count();
} }

View File

@ -3,8 +3,8 @@
- Line number display - Line number display
- File opening by entering path - File opening by entering path
- UI that wraps editors, for split view. - UI that wraps editors, for split view.
- Redo functionality - Persistent infinite undo
- "Projects"
- Clean up text buffer interface: - Clean up text buffer interface:
- Editing (these are undoable): - Editing (these are undoable):