fix(compatibility): acknowledge scroll region even if the cursor is not shown (#84)

This commit is contained in:
Aram Drevekenin 2020-12-07 16:53:55 +01:00 committed by GitHub
parent 1c1558df64
commit 576876b475
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -394,20 +394,17 @@ impl Scroll {
pub fn add_canonical_line(&mut self) { pub fn add_canonical_line(&mut self) {
let current_canonical_line_index = self.cursor_position.line_index.0; let current_canonical_line_index = self.cursor_position.line_index.0;
if let Some((scroll_region_top, scroll_region_bottom)) = self.scroll_region { if let Some((scroll_region_top, scroll_region_bottom)) = self.scroll_region {
if self.show_cursor { if current_canonical_line_index == scroll_region_bottom {
// scroll region should be ignored if the cursor is hidden // end of scroll region
if current_canonical_line_index == scroll_region_bottom { // when we have a scroll region set and we're at its bottom
// end of scroll region // we need to delete its first line, thus shifting all lines in it upwards
// when we have a scroll region set and we're at its bottom // then we add an empty line at its end which will be filled by the application
// we need to delete its first line, thus shifting all lines in it upwards // controlling the scroll region (presumably filled by whatever comes next in the
// then we add an empty line at its end which will be filled by the application // scroll buffer, but that's not something we control)
// controlling the scroll region (presumably filled by whatever comes next in the self.canonical_lines.remove(scroll_region_top);
// scroll buffer, but that's not something we control) self.canonical_lines
self.canonical_lines.remove(scroll_region_top); .insert(scroll_region_bottom, CanonicalLine::new());
self.canonical_lines return;
.insert(scroll_region_bottom, CanonicalLine::new());
return;
}
} }
} }