wip fix scroll_down

This commit is contained in:
Joe Wilm 2018-02-15 19:34:23 -08:00
parent 9b9b138bac
commit f67b17ca7b
2 changed files with 5 additions and 1 deletions

View File

@ -236,8 +236,11 @@ impl<T: Copy + Clone> Grid<T> {
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);
}

View File

@ -69,6 +69,7 @@ impl<T> Storage<T> {
}
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);