mux: invalidate StableRowIndex 0..rows when switching alt screen

We would leave a copy of the alt screen lines at the top of the
scrollback.

This commit ensures that those lines are marked dirty and that
the dirty bits are propagated to the client to invalidate its cache.
This commit is contained in:
Wez Furlong committed 2020-01-05 15:07:00 -08:00
1 parent c3a58f21cb
commit 89f2023577
2 files changed
+20

No files matched your search

+7
View File
@@ -394,6 +394,13 @@ fn maybe_push_tab_changes(
) {
dirty_rows.add(idx);
}
// Make sure we pick up "damage" done by switching between alt and primary screen
for idx in tab
.renderer()
.get_dirty_lines(0..dims.viewport_rows as StableRowIndex)
{
dirty_rows.add(idx);
}
let dirty_lines = dirty_rows.iter().cloned().collect();
+13
View File
@@ -125,10 +125,23 @@ impl ScreenOrAlt {
pub fn activate_alt_screen(&mut self) {
self.alt_screen_is_active = true;
self.dirty_top_phys_rows();
}
pub fn activate_primary_screen(&mut self) {
self.alt_screen_is_active = false;
self.dirty_top_phys_rows();
}
// When switching between alt and primary screen, we implicitly change
// the content associated with StableRowIndex 0..num_rows. The muxer
// use case needs to know to invalidate its cache, so we mark those rows
// as dirty.
fn dirty_top_phys_rows(&mut self) {
let num_rows = self.screen.physical_rows;
for line_idx in 0..num_rows {
self.screen.line_mut(line_idx).set_dirty();
}
}
pub fn is_alt_screen_active(&self) -> bool {