diff --git a/term/src/csi.rs b/term/src/csi.rs index 7f4585535..94c5784f8 100644 --- a/term/src/csi.rs +++ b/term/src/csi.rs @@ -369,8 +369,8 @@ impl<'a> CSIParser<'a> { &[top, bottom] => { self.advance_by(2, params); Some(CSIAction::SetScrollingRegion { - top: top.saturating_sub(1), - bottom: bottom.saturating_sub(1), + top: top.saturating_sub(1).max(0), + bottom: bottom.saturating_sub(1).max(0), }) } &[] => {