fix: support TUI apps (vim, nano, htop) in terminal panels#88
Closed
fix: support TUI apps (vim, nano, htop) in terminal panels#88
Conversation
- Move acks inside xterm.write() callback for proper backpressure - Remove 1MB data-drop hard limit that corrupted escape sequences - Auto-detect TUI apps via process title for key passthrough - Add terminal:exited handler so frontend shows exit status - Pass actual container dimensions at PTY spawn instead of 80x30 - Fix PTY name field mismatch (xterm-color → xterm-256color)
- Allow Ctrl/Cmd+V to use browser paste path even when a TUI app (vim, nano, etc.) is running, so users can paste normally - Query current foreground process title on panel mount via new terminal:getProcessTitle IPC handler, so TUI detection works when returning to an already-running editor session
Extract a helper that splits on both / and \ separators and strips the .exe suffix, so TUI apps like nvim.exe on Windows are correctly detected by the key passthrough logic.
… on exit - Detect alternate screen buffer escape sequences (\e[?1049h/l) in the PTY data stream, providing reliable TUI detection that works on WSL where pty.process only reports wsl.exe - Emit terminal:alternateScreen events to the renderer as a complementary signal alongside process title changes - Query both process title and alternate screen state on panel mount via terminal:getProcessInfo for correct initialization - Reset tuiActiveRef to false when the terminal process exits so Pane shortcuts are not permanently blocked on a dead terminal
…een detection Remove TUI_APPS set, extractProcessName helper, process title tracking (lastProcessTitle, terminal:titleChanged, onTerminalTitleChanged), and terminal:getProcessInfo IPC. TUI detection now relies solely on the alternate screen buffer escape sequences (\x1b[?1049h / \x1b[?1049l), which all well-behaved full-screen apps use. This works universally — including through SSH, on WSL, and for any future TUI app.
e049897 to
16ad6ce
Compare
parsakhaz
added a commit
that referenced
this pull request
Mar 24, 2026
- Fix flow control: move acks inside xterm.write() callback for proper backpressure; remove 1MB data-drop that corrupted escape sequences - Universal TUI detection via alternate screen buffer (\x1b[?1049h/l) — works for all full-screen apps, through SSH, on WSL - Key passthrough in TUI mode (except Ctrl+V for native paste) - Handle terminal:exited in frontend - Use actual container dimensions at PTY spawn instead of 80x30 - Fix PTY name mismatch (xterm-color → xterm-256color)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
xterm.write()callback for proper backpressure; remove 1MB data-drop hard limit that corrupted escape sequences mid-stream for TUI apps\x1b[?1049h(enter) /\x1b[?1049l(leave) escape sequences — works for ALL full-screen apps (vim, nano, htop, tmux, any ncurses/crossterm app), through SSH, on WSL, no hardcoded app list needed[Process exited with code N]when PTY dies, instead of silently hangingnamefield now matchesTERMenv var (xterm-256color)All existing battery optimizations preserved: 32ms output batching, active-panel-only resize, low scrollback.
Test plan