diff options
author | Aram Drevekenin <aram@poor.dev> | 2024-07-12 12:22:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-12 12:22:44 +0200 |
commit | f9ded24b21b3343fa57247549b42b44217cca945 (patch) | |
tree | 71422697ce72e8c8af0308f846ce0c1617d5d774 /zellij-server/src/panes/grid.rs | |
parent | 5b3a9b5dad481120bf9a09e916f9e5421c6c3fa4 (diff) |
fix(terminal): prevent escaping pane through scroll region (#3491)
Diffstat (limited to 'zellij-server/src/panes/grid.rs')
-rw-r--r-- | zellij-server/src/panes/grid.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/zellij-server/src/panes/grid.rs b/zellij-server/src/panes/grid.rs index c22cb4808..781030b17 100644 --- a/zellij-server/src/panes/grid.rs +++ b/zellij-server/src/panes/grid.rs @@ -2745,7 +2745,9 @@ impl Perform for Grid { .next() .map(|param| param[0] as usize) .filter(|¶m| param != 0) - .map(|bottom| bottom.saturating_sub(1)); + .map(|bottom| { + std::cmp::min(self.height.saturating_sub(1), bottom.saturating_sub(1)) + }); self.set_scroll_region(top, bottom); if self.erasure_mode { self.move_cursor_to_line(top, EMPTY_TERMINAL_CHARACTER); |