stronger invalidation when resizing

This seems to make it very difficult to reproduce the blanked
out regions in the related issue.

refs: https://github.com/wez/wezterm/issues/574
This commit is contained in:
Wez Furlong committed 2021-03-25 15:16:50 -07:00
1 parent 786888ce0a
commit dc4676047e
2 files changed
+20 -3

No files matched your search

+15 -2
View File
@@ -175,7 +175,7 @@ impl Screen {
}
}
let (cursor_x, cursor_y) = if self.allow_scrollback && physical_cols != self.physical_cols {
let (cursor_x, cursor_y) = if physical_cols != self.physical_cols {
// Check to see if we need to rewrap lines that were
// wrapped due to reaching the right hand side of the terminal.
// For each one that we find, we need to join it with its
@@ -183,7 +183,20 @@ impl Screen {
// We only do this for the primary, and not for the alternate
// screen (hence the check for allow_scrollback), to avoid
// conflicting screen updates with full screen apps.
self.rewrap_lines(physical_cols, physical_rows, cursor.x, cursor_phys)
if self.allow_scrollback {
self.rewrap_lines(physical_cols, physical_rows, cursor.x, cursor_phys)
} else {
for line in &mut self.lines {
if physical_cols < self.physical_cols {
// Do a simple prune of the lines instead
line.resize(physical_cols);
} else {
// otherwise: invalidate them
line.set_dirty();
}
}
(cursor.x, cursor_phys)
}
} else {
(cursor.x, cursor_phys)
};
+5 -1
View File
@@ -28,8 +28,8 @@ bitflags! {
#[cfg_attr(feature = "use_serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq)]
pub struct Line {
bits: LineBits,
cells: Vec<Cell>,
bits: LineBits,
}
#[derive(Debug, Clone, PartialEq)]
@@ -367,6 +367,7 @@ impl Line {
}
self.cells.insert(x, cell);
self.set_dirty();
}
pub fn erase_cell(&mut self, x: usize) {
@@ -374,6 +375,7 @@ impl Line {
self.invalidate_grapheme_at_or_before(x);
self.cells.remove(x);
self.cells.push(Cell::default());
self.set_dirty();
}
pub fn erase_cell_with_margin(&mut self, x: usize, right_margin: usize) {
@@ -381,6 +383,7 @@ impl Line {
self.invalidate_grapheme_at_or_before(x);
self.cells.remove(x);
self.cells.insert(right_margin - 1, Cell::default());
self.set_dirty();
}
pub fn fill_range(&mut self, cols: impl Iterator<Item = usize>, cell: &Cell) {
@@ -446,6 +449,7 @@ impl Line {
pub fn set_last_cell_was_wrapped(&mut self, wrapped: bool) {
if let Some(cell) = self.cells.last_mut() {
cell.attrs_mut().set_wrapped(wrapped);
self.set_dirty();
}
}