aboutsummaryrefslogtreecommitdiff
path: root/src/pane
diff options
context:
space:
mode:
authorMichael Hackner <mhackner@gmail.com>2026-08-02 18:08:47 -0700
committerGitHub <noreply@github.com>2026-08-03 04:08:47 +0300
commiteacea2daf0b72973173b728936b27478374f2cd2 (patch)
tree4adff75de53a369b453db25d9c134734a34856b5 /src/pane
parent5eab32da81b403c2a277222ab97417a8bf90c35f (diff)
fix: page keys scroll pane scrollback at zsh and REPL prompts (#2191)
* fix: page keys scroll pane scrollback at zsh and REPL prompts PageUp/PageDown were forwarded to the pane whenever DECCKM (application cursor) was on, assuming only primary-screen pagers enable it, but zsh's line editor also enables DECCKM, as do REPLs such as python3. The result was PageUp scrolling shell history instead of Herdr scrollback. Bracketed paste discriminates the two: it means the app accepts typed or pasted text at a prompt, so line editors enable it and pagers do not. * test: update page key state fixture --------- Co-authored-by: Can Celik <ogulcancelik@gmail.com>
Diffstat (limited to 'src/pane')
-rw-r--r--src/pane/terminal.rs22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/pane/terminal.rs b/src/pane/terminal.rs
index 438c3037..b90c63f1 100644
--- a/src/pane/terminal.rs
+++ b/src/pane/terminal.rs
@@ -130,7 +130,11 @@ impl InputState {
}
pub fn plain_page_keys_use_host_scrollback(self) -> bool {
- !self.alternate_screen && !self.mouse_reporting_enabled() && !self.application_cursor
+ !self.alternate_screen
+ && !self.mouse_reporting_enabled()
+ // Bracketed paste distinguishes zsh's line editor (where it's on)
+ // from e.g. less -X (where it's off).
+ && (!self.application_cursor || self.bracketed_paste)
}
}
@@ -3073,6 +3077,22 @@ mod tests {
use ratatui::{layout::Rect, style::Color};
use tokio::sync::mpsc;
+ #[test]
+ fn plain_page_keys_host_scroll_for_shell_like_decckm_with_bracketed_paste() {
+ assert!(InputState {
+ alternate_screen: false,
+ application_cursor: true,
+ bracketed_paste: true,
+ focus_reporting: false,
+ mouse_protocol_mode: crate::input::MouseProtocolMode::None,
+ mouse_protocol_encoding: crate::input::MouseProtocolEncoding::Default,
+ mouse_alternate_scroll: false,
+ modify_other_keys: false,
+ color_scheme_reporting: false,
+ }
+ .plain_page_keys_use_host_scrollback());
+ }
+
fn text_cell(text: &str) -> crate::ghostty::ScreenTextCell {
crate::ghostty::ScreenTextCell {
wide: crate::ghostty::CellWide::Narrow,