From eacea2daf0b72973173b728936b27478374f2cd2 Mon Sep 17 00:00:00 2001 From: Michael Hackner Date: Sun, 2 Aug 2026 18:08:47 -0700 Subject: 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 --- src/server/headless.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/server') diff --git a/src/server/headless.rs b/src/server/headless.rs index ff85f253..f72d1a94 100644 --- a/src/server/headless.rs +++ b/src/server/headless.rs @@ -6468,6 +6468,22 @@ next_tab = "" }); } + #[test] + fn terminal_attach_page_key_host_scrolls_shell_like_decckm_with_bracketed_paste() { + with_terminal_attach_page_key_runtime(b"\x1b[?1h\x1b[?2004h", 0, |runtime, input_rx| { + apply_terminal_attach_page_up(runtime); + + assert_eq!( + runtime + .scroll_metrics() + .expect("scroll metrics") + .offset_from_bottom, + 4 + ); + assert!(input_rx.try_recv().is_err()); + }); + } + #[test] fn terminal_attach_page_key_forwards_in_alternate_screen_without_mouse_reporting() { with_terminal_attach_page_key_runtime(b"\x1b[?1049h", 3, |runtime, input_rx| { -- cgit v1.2.3