feat(tui): scrollback-first TUI rewrite (tui_sb) - #441
Merged
Conversation
YinZT1
force-pushed
the
feat/tui-scrollback
branch
8 times, most recently
from
May 20, 2026 08:34
cfaf099 to
441c43d
Compare
Replace _history_lines (pre-rendered) with _blocks (source + kind) so _repaint_screen can re-render every chip, banner, user panel at the current width. \x1b[3J wipes scrollback on resize/Ctrl+L so the entire conversation reflows, not just the visible viewport. SIGWINCH delivery via self-pipe + select() — PEP 475 auto-retry on os.read makes signal-driven InterruptedError unreliable under iTerm split panes, so a dedicated pipe wakes the loop deterministically. Streaming tracks a single _streaming_block whose source grows monotonically through safe-position commits; mid-stream resize re-renders both the committed source and the volatile live_tail. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
macOS Terminal.app quantises truecolor to its nearest 256 slot (so #5e6ad2 lavender lands on slot 62 #5f5fd7, visibly more blue) and renders \x1b[2m as a heavy multiply instead of a gentle blend, producing the "blue border + heavy shadow" against iTerm's identical code. Branch on TERM_PROGRAM: iTerm keeps its truecolor accent and \x1b[2m dim; Apple_Terminal switches to pinned 256-slot accent (105) and an explicit mid-gray (244) for dim. Box border (146) was already 256-slot so it carries unchanged. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
lsdefine
added a commit
that referenced
this pull request
Jul 23, 2026
feat(tui): scrollback-first TUI rewrite (tui_sb)
Imzl-zl
pushed a commit
to Imzl-zl/GenericAgent
that referenced
this pull request
Aug 5, 2026
feat(tui): scrollback-first TUI rewrite (tui_sb)
Imzl-zl
pushed a commit
to Imzl-zl/GenericAgent
that referenced
this pull request
Aug 5, 2026
feat(tui): scrollback-first TUI rewrite (tui_sb)
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.
Scrollback-first terminal UI — finalized output goes to the terminal's
real scrollback buffer (no alt-screen), so native Cmd+C / mouse select /
cross-page copy work cleanly. Only a small bottom region is live-redrawn
(streaming tail + status bar + input box).
Motivation: v2 (Textual-based) has ANSI escape leakage during streaming,
broken native copy due to alt-screen, race conditions between Textual's
event loop and agent's display_queue, and heavy deps (Textual+Tkinter+PIL).
handles scroll/search natively. Live region uses cursor-addressed
repaints with exact row accounting (CJK cell-width aware, no
soft-wrap drift).
readline bindings, history (up/down), @file attachment with glob.
review), /rewind N (checkpoint restore), /continue (session restore),
/clear, /cost, /verbose (tool call audit viewer in alt-screen overlay),
/export, /stop.
via renderer.py strips stray CSI/OSC before Rich parse.
checkpoint_index.py indexes rewind points.
AskUserEvent/DoneEvent from agent's display_queue — decouples UI from
agent internals.
Files: frontends/tui_sb/ (new directory, 17 source files + README.md).