The TUI transcript output area should stay scrollable when output is longer than the viewport. Keyboard history recall must stay bound to the prompt input, the prompt input remains the only normal focus target, and normal terminal text selection must remain available across the whole TUI by default.
Up/Down bound to input history recall.PageUp/PageDown bound to transcript scrollback.Tab must not toggle focus between
transcript and input; outside slash-command completion it is a consumed no-op.ZCODE_ environment variable or user configuration surface.?1000h, ?1002h, or ?1006h) by
default.?1007h).At startup, the TUI must leave xterm mouse reporting disabled so terminal-native text selection remains the default interaction. It writes disable guards for:
?1006l)?1002l)?1000l)?1007l)The TUI must not enable alternate scroll mode (?1007h). Up and Down
remain prompt-history keys and must not be translated from wheel input by the
terminal.
On cleanup, the TUI repeats the same disable guards. This avoids inheriting a stale mouse mode from a previous terminal application while preserving the terminal's ability to select text anywhere in the TUI.
The transcript viewport uses a published scroll-capable Ink fork
(ink: npm:@jrichman/ink@6.6.9) instead of a small scrollbar-only
component. This fork adds renderer-level support for overflowY="scroll",
scrollTop, native scrollbar drawing, and scroll geometry helpers. That keeps
scroll clipping and scrollbar rendering inside the terminal renderer instead of
duplicating those responsibilities in ZCode's transcript component.
Maintaining a custom forked Ink DOM with a local ScrollBox would not give this
project a reusable package boundary. The published fork can be adopted directly
as a dependency while keeping ZCode's controller as the owner of
transcript-only scroll policy.
If SGR mouse input is externally supplied, wheel input remains routed through the TUI controller so prompt history, approval panels, and other non-transcript surfaces do not accidentally scroll. The wheel delta should start at one rendered line for precise touchpad and notched-wheel control, then accelerate during rapid consecutive wheel events so long scrollback remains practical.
The transcript viewport remains the only scrollable surface. When transcript content overflows, the viewport reserves the rightmost column for a scrollbar. Scrollbar presence may reduce transcript wrapping width by one column.
The scrollbar rules are:
The same clamping rules as keyboard scrollback apply:
scrollOffset never drops below 0.scrollOffset never exceeds the currently rendered transcript overflow.scrollOffset to 0.scrollOffset is
already 0; otherwise the user remains in scrollback.Externally supplied SGR mouse wheel input over the prompt area must be ignored. It must not recall history, move the text cursor, or change transcript scrollback.
Prompt Up still recalls older project input and prompt Down still restores
newer history or the local draft, even when transcript overflow exists.
Prompt focus is not a session or transcript state. The TUI should not expose a
second focus mode for the transcript because scrolling, copy selection, approval
prompts, and queued input are all represented by explicit interactions. This
keeps Tab free for slash-command completion and prevents accidental loss of
typing focus during long-running turns.
Mouse clicks outside the prompt input must not leave the normal composer blurred. The renderer disables mouse-driven autofocus so focusable transcript surfaces cannot steal keyboard input on mouse down, and the app shell refocuses the prompt input after mouse up once selection-copy handling has had a chance to read the current selection. This preserves terminal text selection while keeping typing routed to the composer after any ordinary click.
?1006l, ?1002l, ?1000l, and ?1007l,
and does not enable ?1000h, ?1002h, ?1006h, or ?1007h.?1006l, ?1002l, ?1000l, and ?1007l.Up recalls history after long output instead of
scrolling transcript overflow.Tab leaves prompt focus on the input instead of
switching to transcript focus.