diff --git a/src/grid/mod.rs b/src/grid/mod.rs index 1889d59f..23ee9cf4 100644 --- a/src/grid/mod.rs +++ b/src/grid/mod.rs @@ -236,8 +236,11 @@ impl Grid { self.raw.rotate_up(*positions); // Now, restore any scroll region lines - for i in IndexRange(region.end .. self.num_lines()) { + let lines = self.lines; + for i in IndexRange(region.end .. lines) { // First do the swap + // TODO there is a bug here causing a panic. + // TODO math self.raw.swap_lines(i, i + positions); } diff --git a/src/grid/storage.rs b/src/grid/storage.rs index b4228687..0ca2f525 100644 --- a/src/grid/storage.rs +++ b/src/grid/storage.rs @@ -69,6 +69,7 @@ impl Storage { } pub fn swap_lines(&mut self, a: Line, b: Line) { + println!("visible: {}, a: {}, b: {}", self.visible_lines, a, b); let a = self.visible_lines - a; let b = self.visible_lines - b; self.swap(*a, *b);