1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-25 06:12:16 +03:00

avoid panic if an app sets an invalid scroll region

This commit is contained in:
Wez Furlong 2018-02-20 08:42:08 -08:00
parent 9a5e7999da
commit 7c0536f9a3
2 changed files with 3 additions and 3 deletions

View File

@ -373,8 +373,8 @@ impl<'a> CSIParser<'a> {
&[top, bottom] => { &[top, bottom] => {
self.advance_by(2, params); self.advance_by(2, params);
Some(CSIAction::SetScrollingRegion { Some(CSIAction::SetScrollingRegion {
top: top - 1, top: top.saturating_sub(1),
bottom: bottom - 1, bottom: bottom.saturating_sub(1),
}) })
} }
&[] => { &[] => {

View File

@ -162,7 +162,7 @@ impl Screen {
/// will be invalidated by inserting or removing rows! /// will be invalidated by inserting or removing rows!
#[inline] #[inline]
pub fn phys_row(&self, row: VisibleRowIndex) -> PhysRowIndex { pub fn phys_row(&self, row: VisibleRowIndex) -> PhysRowIndex {
assert!(row >= 0); assert!(row >= 0, "phys_row called with negative row {}", row);
(self.lines.len() - self.physical_rows) + row as usize (self.lines.len() - self.physical_rows) + row as usize
} }