From c532b10f22c04e9d6b7550b8abcc54fdd175ad1c Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Sun, 22 Feb 2015 20:30:33 -0800 Subject: [PATCH] Fixed bug in Editor::move_view_to_cursor() It thought it was one line shorter than it actually was. --- src/editor/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/editor/mod.rs b/src/editor/mod.rs index df7aa3d..1bc605d 100644 --- a/src/editor/mod.rs +++ b/src/editor/mod.rs @@ -321,7 +321,7 @@ impl Editor { // Find the first and last grapheme index visible within the editor. let g_first = self.formatter.index_set_horizontal_v2d(&self.buffer, self.view_pos.0, 0, Floor); - let mut g_last = self.formatter.index_offset_vertical_v2d(&self.buffer, g_first, (self.view_dim.0 - 1) as isize, (Floor, Floor)); + let mut g_last = self.formatter.index_offset_vertical_v2d(&self.buffer, g_first, self.view_dim.0 as isize, (Floor, Floor)); g_last = self.formatter.index_set_horizontal_v2d(&self.buffer, g_last, self.view_dim.1, Floor); // Adjust the view depending on where the cursor is @@ -329,7 +329,7 @@ impl Editor { self.view_pos.0 = self.cursors[0].range.0; } else if self.cursors[0].range.0 >= g_last { - self.view_pos.0 = self.formatter.index_offset_vertical_v2d(&self.buffer, self.cursors[0].range.0, -((self.view_dim.0 - 1) as isize), (Floor, Floor)); + self.view_pos.0 = self.formatter.index_offset_vertical_v2d(&self.buffer, self.cursors[0].range.0, -(self.view_dim.0 as isize), (Floor, Floor)); } }