1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 05:42:03 +03:00

fix an issue with scrolling within a region

This commit is contained in:
Wez Furlong 2018-02-19 14:39:07 -08:00
parent 37e5d8571a
commit d041b7be0d
2 changed files with 6 additions and 5 deletions

View File

@ -238,7 +238,7 @@ impl Screen {
if scroll_region.end as usize == self.physical_rows {
self.lines.push_back(line);
} else {
self.lines.insert(phys_scroll.end - lines_removed, line);
self.lines.insert(phys_scroll.end - 1, line);
}
}
// We may still have some lines to add at the bottom, so
@ -259,7 +259,7 @@ impl Screen {
} else {
for _ in 0..to_add {
self.lines.insert(
phys_scroll.end - lines_removed,
phys_scroll.end - 1,
Line::new(self.physical_cols),
);
}

View File

@ -416,9 +416,10 @@ fn test_delete_lines() {
// test with a scroll region smaller than the screen
term.set_scroll_region(1, 3);
term.delete_lines(1);
print_all_lines(&term);
term.delete_lines(2);
assert_visible_contents(&term, &["111", "555", "aaa", " ", "bbb"]);
assert_visible_contents(&term, &["111", "aaa", " ", " ", "bbb"]);
term.assert_dirty_lines(&[1, 2, 3], None);
// expand the scroll region to fill the screen
@ -426,7 +427,7 @@ fn test_delete_lines() {
term.clean_dirty_lines();
term.delete_lines(1);
assert_visible_contents(&term, &["111", "aaa", " ", "bbb", " "]);
assert_visible_contents(&term, &["111", " ", " ", "bbb", " "]);
term.assert_dirty_lines(&[1, 2, 3, 4], None);
}