fix(scroll): reset scroll properly when typing (#1547)
This commit is contained in:
parent
9225ce6c34
commit
7c1348572a
1 changed files with 5 additions and 5 deletions
|
|
@ -854,13 +854,13 @@ impl Grid {
|
||||||
self.output_buffer.update_all_lines();
|
self.output_buffer.update_all_lines();
|
||||||
}
|
}
|
||||||
pub fn reset_viewport(&mut self) {
|
pub fn reset_viewport(&mut self) {
|
||||||
let row_count_below = self.lines_below.len();
|
let max_lines_to_scroll = *SCROLL_BUFFER_SIZE.get().unwrap() * 2; // while not very elegant, this can prevent minor bugs from becoming showstoppers by sticking the whole app display in an endless loop
|
||||||
for _ in 0..row_count_below {
|
let mut lines_scrolled = 0;
|
||||||
|
while self.is_scrolled && lines_scrolled < max_lines_to_scroll {
|
||||||
self.scroll_down_one_line();
|
self.scroll_down_one_line();
|
||||||
|
lines_scrolled += 1;
|
||||||
}
|
}
|
||||||
if row_count_below > 0 {
|
self.output_buffer.update_all_lines();
|
||||||
self.output_buffer.update_all_lines();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
pub fn rotate_scroll_region_up(&mut self, count: usize) {
|
pub fn rotate_scroll_region_up(&mut self, count: usize) {
|
||||||
if let Some((scroll_region_top, scroll_region_bottom)) = self
|
if let Some((scroll_region_top, scroll_region_bottom)) = self
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue