pi-mono/packages/tui/test
robopipi[bot] 19ce8059c3
fix(tui): stop writing OSC 133 prompt markers in regular mode (#11565)
In regular TUI mode, user and assistant messages wrote OSC 133
(`A`/`B`/`C`) shell-integration markers straight to the terminal.
Terminals that display OSC 7501 program status (Rex, iTerm2 3.7.5+) read
`133;A` as a new shell prompt and drop the current status. As a result,
the `working` indicator disappeared right after a run started and only
`done` showed up at the end. Fullscreen mode was not affected because it
already strips these markers before writing.

## Change
- `TuiMainScreen.doRender()` (`packages/tui/src/tui-main-screen.ts`) now
strips OSC 133 markers from the start of each rendered line before
compositing and writing. It uses the same pattern as fullscreen
(`OSC133_ZONE_PREFIX`).
- The message components still produce the markers. Fullscreen uses them
internally for prompt navigation and already strips them before writing,
so its behavior is unchanged.
- In regular mode, the terminal's own jump-to-prompt shortcuts no longer
stop at pi messages (added in #1805).

## Testing
- New test in `packages/tui/test/tui-render.test.ts`: no `ESC]133;`
reaches the terminal across a full render and a differential render,
with both BEL and ST terminators. It fails without the change and passes
with it.
- These pass:
  - `packages/tui` `npm test`
- `test/user-message.test.ts` and `test/assistant-message.test.ts` in
coding-agent
  - `npm run check`
- I ran `pi -ne --tui-mode regular` with `PI_PROGRAM_STATUS=1` and a
streaming test provider, capturing all terminal output with `script`.
- Before: `7501 working`, then repeated `133;A`/`133;B`/`133;C`, then
`7501 done`.
  - After: only `7501 idle` → `working` → `done`, and no OSC 133.

Fixes #11519

Requested by @davidbrai

Co-authored-by: triagent <triagent@localhost>
2026-10-29 14:00:16 +01:00
..
fixtures fix(tui): restore terminal modes when the process exits without stop() 2026-10-20 19:52:54 +02:00
alt-screen-large-transcript-bench.ts feat(tui,coding-agent): report program status via OSC 7501 2026-10-07 19:05:41 +00:00
autocomplete-skill-slash.test.ts fix(tui): complete slash commands after leading whitespace (#10218) 2026-09-30 23:13:01 +02:00
autocomplete.test.ts fix(tui): escape regex metacharacters in single-segment fd queries (#11212) 2026-10-21 12:21:15 +02:00
bug-regression-isimageline-startswith-bug.test.ts chore: pin dependencies and use native TypeScript 2026-05-20 12:46:17 +02:00
chat-simple.ts fix(tui): normalize source filenames 2026-08-01 14:38:13 +02:00
colors.test.ts feat(coding-agent,tui): System theme (#10067) 2026-09-26 13:33:47 +02:00
editor-history-keybindings.test.ts feat(tui): add configurable prompt history actions 2026-08-05 21:34:21 +02:00
editor.test.ts fix(tui,coding-agent): handle selection page keys in all scrolling lists 2026-10-28 19:05:21 +01:00
exit-restore.test.ts fix(tui): restore terminal modes when the process exits without stop() 2026-10-20 19:52:54 +02:00
fuzzy.test.ts fix(tui,coding-agent): rank contiguous fuzzy matches and search session fields separately 2026-10-22 21:39:17 +02:00
image-test.ts feat: build with TypeScript 7 and run sources with plain node 2026-09-25 13:14:33 +02:00
input.test.ts feat(tui): search improvements (#8800) 2026-09-03 15:09:51 +02:00
key-tester.ts fix(tui): normalize source filenames 2026-08-01 14:38:13 +02:00
keybindings.test.ts fix(tui): keep Home/End for the editor in fullscreen mode 2026-10-05 09:53:54 +02:00
keys.test.ts fix(tui): recognize kitty F1-F12 sequences and ignore F13+ keys (#11468) 2026-10-27 09:16:36 +01:00
latex.test.ts fix(tui): improve LaTeX compatibility and layouts 2026-09-19 23:28:04 +02:00
layout.test.ts feat(tui): alt mode scrollbar but prettier (#8801) 2026-09-04 00:05:47 +02:00
markdown.test.ts fix(tui): stop bare URLs at CJK punctuation (#10934) 2026-10-28 10:11:40 +01:00
mouse-components.test.ts feat(coding-agent,tui): System theme (#10067) 2026-09-26 13:33:47 +02:00
native-clipboard-linux.test.ts feat(tui): Simplify clipboard handling (#9163) 2026-09-05 23:52:32 +02:00
native-module-path.test.ts feat(tui): Simplify clipboard handling (#9163) 2026-09-05 23:52:32 +02:00
native-platform.test.ts feat(tui): Simplify clipboard handling (#9163) 2026-09-05 23:52:32 +02:00
overlay-non-capturing.test.ts fix(tui): normalize source filenames 2026-08-01 14:38:13 +02:00
overlay-options.test.ts fix(tui): keep cursor visible when overlays close after stop 2026-09-25 13:30:50 +02:00
overlay-short-content.test.ts fix(tui): normalize source filenames 2026-08-01 14:38:13 +02:00
program-status.test.ts feat(tui,coding-agent): report program status via OSC 7501 2026-10-07 19:05:41 +00:00
regression-overlay-cjk-boundary.test.ts feat(tui): add alternate-screen renderer 2026-07-30 12:59:48 +02:00
regression-regional-indicator-width.test.ts chore: pin dependencies and use native TypeScript 2026-05-20 12:46:17 +02:00
regression-sigwinch-kill-eacces.test.ts fix(tui): wrap SIGWINCH self-signal so restricted seccomp policies do not crash startup (#8898) 2026-09-01 14:16:21 +02:00
regression-slice-by-column-ansi-order.test.ts fix(tui): preserve ANSI order at slice boundaries 2026-10-01 00:05:28 +02:00
render-churn-bench.ts feat(tui,coding-agent): report program status via OSC 7501 2026-10-07 19:05:41 +00:00
select-list.test.ts fix(tui,coding-agent): handle selection page keys in all scrolling lists 2026-10-28 19:05:21 +01:00
settings-list.test.ts fix(tui,coding-agent): handle selection page keys in all scrolling lists 2026-10-28 19:05:21 +01:00
stdin-buffer.test.ts fix(tui): keep delayed terminal replies out of keyboard input 2026-10-11 20:17:00 +02:00
tab-width.test.ts fix(tui): normalize source filenames 2026-08-01 14:38:13 +02:00
terminal-colors.test.ts fix(tui): keep delayed terminal replies out of keyboard input 2026-10-11 20:17:00 +02:00
terminal-image.test.ts feat(tui): enable Kitty images for Rex 2026-10-20 18:54:36 +02:00
terminal.test.ts fix: harden handling of untrusted URLs, terminal text, and streamed data 2026-10-26 20:46:31 +01:00
test-themes.ts chore: pin dependencies and use native TypeScript 2026-05-20 12:46:17 +02:00
truncate-to-width.test.ts fix(tui): close truncated OSC 8 links (#7657) 2026-08-05 13:50:37 +02:00
truncated-text.test.ts chore: pin dependencies and use native TypeScript 2026-05-20 12:46:17 +02:00
tui-alt-screen.test.ts fix(tui,coding-agent): handle selection page keys in all scrolling lists 2026-10-28 19:05:21 +01:00
tui-cell-size-input.test.ts fix(tui): normalize source filenames 2026-08-01 14:38:13 +02:00
tui-overlay-style-leak.test.ts fix(tui): normalize source filenames 2026-08-01 14:38:13 +02:00
tui-render.test.ts fix(tui): stop writing OSC 133 prompt markers in regular mode (#11565) 2026-10-29 14:00:16 +01:00
tui-shrink.test.ts fix(tui): normalize source filenames 2026-08-01 14:38:13 +02:00
viewport-overwrite-repro.ts feat: build with TypeScript 7 and run sources with plain node 2026-09-25 13:14:33 +02:00
virtual-terminal.ts feat(tui,coding-agent): report program status via OSC 7501 2026-10-07 19:05:41 +00:00
visible-width.test.ts fix(tui,coding-agent): reduce render cost of theme changes and streaming 2026-09-29 08:23:46 +02:00
wheel-scroll.test.ts feat(tui,coding-agent): configurable fullscreen wheel scrolling with auto acceleration 2026-09-29 09:57:53 +02:00
word-navigation.test.ts fix(tui): align input word segmentation with editor (#5068) 2026-05-27 20:50:04 +02:00
wrap-ansi.test.ts fix(tui): handle CRLF and CR line endings (#6764) 2026-07-17 09:01:10 +02:00