Brennan Benson and brennanb2025
e47b3364d9
Preserve terminal scrollback when restoring a hidden alternate-screen pane ( #6532 )
...
* Preserve terminal scrollback when restoring a hidden alternate-screen pane
On Windows, an alternate-screen TUI pane (Claude Code) could lose scroll-up
after being hidden (tab/worktree switch or app backgrounded) and shown again.
Root cause: on hidden->visible restore, applyMainBufferSnapshot
unconditionally wrote a destructive clear (\x1b[2J\x1b[3J\x1b[H) before
replaying the snapshot, wiping xterm's scrollback. The attach/reattach path
already guards this same clear behind !isAlternateScreen (pty-transport.ts);
the snapshot path did not.
Thread an alternateScreen flag from the backend headless serialization
through the pty:getMainBufferSnapshot IPC + preload types into
applyMainBufferSnapshot, and skip the destructive clear when restoring an
alternate-screen buffer. Add a regression test asserting the clear is NOT
emitted for an alt-screen restore (and the existing normal-buffer test still
asserts it IS).
Fixes #5723
* test: account for alternateScreen flag in empty headless snapshot assertions
The alt-screen scrollback fix threads an alternateScreen flag through the
headless snapshot return type. Two sibling empty-buffer tests used exact
toEqual() assertions that did not include the new (legitimately false) key.
Update them to reflect the correct snapshot shape.
---------
Co-authored-by: brennanb2025 <brennanb2025@users.noreply.github.com >
2026-06-28 00:57:56 -07:00
..
2026-06-23 11:31:41 -07:00
2026-06-22 13:36:05 -07:00
2026-06-22 13:36:05 -07:00
2026-05-30 21:20:37 -07:00
2026-06-24 22:03:35 -07:00
2026-06-22 19:09:45 -07:00
2026-06-22 19:09:45 -07:00
2026-05-31 04:21:57 -07:00
2026-06-20 16:33:20 -07:00
2026-06-20 16:33:20 -07:00
2026-05-29 16:06:33 -07:00
2026-06-02 18:10:31 -07:00
2026-06-27 02:05:23 -07:00
2026-05-29 16:06:33 -07:00
2026-06-02 18:10:31 -07:00
2026-05-11 14:20:08 -07:00
2026-05-25 14:54:47 -07:00
2026-06-17 13:29:39 -07:00
2026-06-19 17:14:55 -07:00
2026-05-30 11:29:01 -07:00
2026-05-30 11:29:01 -07:00
2026-06-16 23:11:27 -07:00
2026-06-16 23:11:27 -07:00
2026-06-19 17:14:55 -07:00
2026-06-19 17:14:55 -07:00
2026-06-08 00:08:57 -07:00
2026-04-20 19:41:12 -07:00
2026-06-16 18:05:15 -07:00
2026-06-16 18:05:15 -07:00
2026-06-17 16:08:14 -07:00
2026-06-11 02:34:01 -07:00
2026-05-31 08:11:17 -07:00
2026-05-31 08:11:17 -07:00
2026-05-31 08:11:17 -07:00
2026-05-31 07:30:51 -07:00
2026-06-17 16:08:14 -07:00
2026-06-17 16:08:14 -07:00
2026-06-17 16:08:14 -07:00
2026-05-28 16:14:57 -04:00
2026-05-31 07:30:51 -07:00
2026-06-10 17:42:49 -07:00
2026-06-17 16:08:14 -07:00
2026-06-17 16:08:14 -07:00
2026-05-20 01:35:56 -07:00
2026-05-20 01:35:56 -07:00
2026-06-17 16:08:14 -07:00
2026-06-15 17:07:12 -07:00
2026-06-10 21:14:53 -07:00
2026-05-31 03:48:50 -07:00
2026-06-27 02:47:54 -07:00
2026-06-27 02:47:54 -07:00
2026-05-31 07:50:33 -07:00
2026-06-27 02:47:54 -07:00
2026-06-26 14:28:16 -07:00
2026-06-26 14:28:16 -07:00
2026-05-21 02:49:16 -04:00
2026-05-21 02:49:16 -04:00
2026-06-17 16:08:14 -07:00
2026-06-17 16:08:14 -07:00
2026-06-24 00:21:56 -07:00
2026-06-24 00:21:56 -07:00
2026-06-17 16:08:14 -07:00
2026-06-17 16:08:14 -07:00
2026-06-17 22:52:12 -07:00
2026-06-17 16:08:14 -07:00
2026-06-01 19:04:04 -07:00
2026-05-21 19:10:16 -07:00
2026-05-21 19:10:16 -07:00
2026-06-02 21:17:20 -04:00
2026-06-07 19:50:05 -07:00
2026-06-08 19:23:32 -04:00
2026-06-17 16:08:14 -07:00
2026-05-20 17:20:16 -07:00
2026-05-20 17:20:16 -07:00
2026-04-26 21:42:06 -07:00
2026-06-01 17:30:10 -07:00
2026-06-01 17:30:10 -07:00
2026-06-17 16:08:14 -07:00
2026-05-30 08:57:00 -07:00
2026-05-30 02:46:28 -07:00
2026-06-02 18:01:23 -07:00
2026-06-02 18:01:23 -07:00
2026-05-08 14:17:50 -07:00
2026-06-02 18:10:31 -07:00
2026-05-08 13:04:09 -07:00
2026-05-08 13:04:09 -07:00
2026-05-30 12:46:34 -07:00
2026-05-30 12:46:34 -07:00
2026-06-15 19:41:45 -07:00
2026-06-17 16:08:14 -07:00
2026-06-13 21:17:17 -04:00
2026-06-13 21:17:17 -04:00
2026-06-12 17:01:34 -04:00
2026-06-23 11:31:41 -07:00
2026-06-23 11:31:41 -07:00
2026-04-13 21:27:19 -04:00
2026-05-10 16:13:06 -07:00
2026-05-05 19:26:44 -07:00
2026-06-19 17:14:55 -07:00
2026-06-28 00:33:00 -07:00
2026-06-28 00:57:56 -07:00
2026-06-17 15:41:43 -07:00
2026-06-22 15:02:38 -07:00
2026-06-22 15:02:38 -07:00
2026-05-31 06:42:33 -07:00
2026-05-15 12:32:07 -07:00
2026-05-15 12:32:07 -07:00
2026-05-31 08:26:45 -07:00
2026-06-03 09:48:03 -07:00
2026-06-03 09:48:03 -07:00
2026-06-17 16:08:14 -07:00
2026-06-22 19:09:45 -07:00
2026-06-26 13:26:58 -07:00
2026-05-27 16:22:03 -07:00
2026-06-26 13:26:58 -07:00
2026-05-30 09:07:57 -07:00
2026-06-17 16:08:14 -07:00
2026-05-17 22:24:38 -07:00
2026-06-14 01:48:26 -07:00
2026-06-14 01:48:26 -07:00
2026-06-14 01:48:26 -07:00
2026-06-14 01:48:26 -07:00
2026-06-14 01:48:26 -07:00
2026-05-27 16:22:03 -07:00
2026-06-01 02:13:00 -07:00
2026-06-13 18:53:01 -07:00
2026-06-15 14:54:50 -07:00
2026-06-15 14:54:50 -07:00
2026-06-22 19:09:45 -07:00
2026-06-22 19:09:45 -07:00
2026-06-17 16:08:14 -07:00
2026-06-17 16:08:14 -07:00
2026-05-01 13:25:22 -07:00
2026-06-19 12:31:11 -07:00
2026-06-19 12:31:11 -07:00
2026-05-30 10:32:00 -07:00
2026-05-30 10:32:00 -07:00
2026-04-14 18:29:50 -07:00
2026-06-22 16:42:20 -07:00
2026-06-19 17:14:55 -07:00
2026-04-09 12:28:59 -07:00
2026-06-12 10:14:49 -07:00
2026-06-12 10:14:49 -07:00
2026-06-19 17:14:55 -07:00
2026-06-19 17:14:55 -07:00
2026-05-31 09:23:04 -07:00
2026-05-31 09:23:04 -07:00
2026-05-08 10:50:43 -07:00
2026-05-08 10:50:43 -07:00
2026-05-31 09:29:44 -07:00
2026-05-31 09:29:44 -07:00
2026-05-21 13:22:37 -07:00
2026-05-21 13:22:37 -07:00
2026-06-15 19:58:55 -07:00
2026-06-23 11:07:49 -07:00
2026-06-15 19:58:55 -07:00
2026-06-15 19:58:55 -07:00
2026-06-14 23:23:31 -07:00
2026-05-14 00:42:07 -07:00
2026-05-31 05:15:53 -07:00
2026-06-26 13:28:10 -07:00
2026-06-26 13:28:10 -07:00
2026-06-21 15:48:33 -07:00
2026-06-19 17:14:55 -07:00
2026-06-19 17:14:55 -07:00
2026-06-07 19:51:36 -07:00
2026-06-07 19:51:36 -07:00
2026-06-23 11:07:49 -07:00
2026-06-17 19:16:53 -07:00
2026-06-17 19:16:53 -07:00
2026-06-20 03:16:29 -07:00
2026-06-26 13:28:10 -07:00
2026-06-26 13:28:10 -07:00