Skip to content

feat(tui,desktop,mobile): a composer that paints its draft; a language key; a preselected device row - #1383

Merged
huichen merged 16 commits into
mainfrom
pr/huichen
Oct 27, 2026
Merged

huichen merged 16 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

This branch finishes the TUI composer's own rendering (its canvas, its draft row, the straight borders of the # menu), lets the interface language follow the system instead of the shell's LANG alone, folds a reopened transcript, and fixes two small client-side defaults: the mobile session row's status dot names the machine it actually belongs to, and the desktop new-conversation device step opens with its first row selected.

Commits

  • refactor(tui): the composer keeps the canvas background
  • fix(tui): the composer paints the draft, not a blank row above it
  • fix(tui): the # menu is the composer's box, with straight borders
  • fix(mobile): a session row's status dot reaches the machine its row names
  • fix(desktop): the new-conversation device step opens with its first row chosen
  • fix(tui): follow the system language, not just the shell's LANG
  • feat(tui): ctrl+g switches the interface language, and the # menu lines up
  • fix(tui): a reopened transcript starts folded

Verification

Run locally at 5c73d03f9 with the pinned toolchain 1.99.1 from ~/.rustup (Homebrew's 1.96 shadows PATH), ulimit -n 8192:

  • cargo fmt --all -- --check — clean
  • cargo clippy -p future-tui --all-targets -- -D warnings — clean
  • cargo test -p future-tui --lib — 1317 passed, 0 failed
  • desktop: npx tsc --noEmit clean; npx eslint on the two touched files clean; npx vitest run src/features/remote-peer/DeviceChoiceDialog.test.tsx — 8 passed
  • mobile: npx tsc --noEmit clean; npx eslint on the two touched files clean; npx jest src/screens/__tests__/SessionsScreen.test.ts — 75 passed
  • python3 -m py_compile scripts/screenshots/capture.py — clean

origin/main was merged into this branch before opening so the branch is not BEHIND; that merge touched tui/src/workbench/{live,mod}.rs in the same files, and it resolved without conflicts.

Notes

  • Behaviour: with no stored preference the interface language now follows the system locale rather than LANG; ctrl+g cycles it.
  • No migration or configuration change is required.

huichen and others added 16 commits October 27, 2026 10:27
`ctrl+e` looked like a reading toggle, but it wrote the level it landed on
back to `settings.json`, so one peek at the process left every later
terminal expanded — the reported "tool calls and thinking show by default"
was simply a stored `replyDetail: detailed` that the key had put there.
The shipped default was already the folded one (a fresh home draws
`▸ 2 tool calls · 1 thought` above the answer, the same row the desktop's
process fold shows), so the default a reader saw depended on whether they
had ever pressed the key.

The level is now a view state, not a preference: a transcript opens folded,
and `ctrl+e` (with the `/reply-detail` verb) expands it for the run it is
pressed in without writing anything — the exit path stopped persisting it
too, which was the second door the old value came through. `replyDetail` is
retired from `TuiSettings`: a file that still carries it loads fine and the
key is dropped the next time the file is written. The desktop and the phone
keep their settings-page toggle; the terminal's hotkey is not a settings
page, and a key that reads as "show me this once" must not become one.

Tests: `a_new_transcript_opens_folded` pins the opening level,
`a_legacy_stored_level_does_not_open_the_transcript_expanded` pins that a
stored `detailed` is ignored (it fails if `attach` is handed the level
again), and the retired-key case in `settings.rs` now asserts the key is
dropped on write. Both TUI guides say `ctrl+e` is per run.
…es up

`ctrl+g` opens the language chooser — the same box `/lang` opens, so a key cannot
drift from the command it names, and the help table and the shortcut editor read
it from the same action. The queue moved off `ctrl+g` to `alt+q` (and keeps
`/queue`); the literal `ctrl+g` arm in the fallback match is gone, so a reader
who rebinds the key is not still answered by it.

The `#` session-mention menu appended each row's workspace right after its title,
so the workspace column started wherever that title happened to end — with CJK
titles that is a different cell on every row, which is what 'the `#` list is
misaligned' showed. The labels are padded to the list's own widest label now, so
the second column starts in one cell.
`capture.py tui --scenario mention-sessions` is the frame for it.
`system` took the first of `LC_ALL`/`LC_MESSAGES`/`LANG` and only asked the OS
on Windows, so a Mac whose language is Chinese drew English whenever its shell
carried a `LANG` — which macOS shells always do, a `C.UTF-8` default from
`/etc/zprofile` or whatever the profile exports (measured here:
`AppleLanguages = ["zh-Hans-CN"]`, `LANG = en_US.UTF-8`).

The order is now the per-process POSIX overrides, then the system's own answer
(macOS preferred languages through CoreFoundation, the Windows UI language),
then `LANG`. On the other Unixes the locale variables already are the system's
answer, so nothing there changes.

Checked on a `zh-Hans-CN` Mac with `LANG=en_US.UTF-8`: `system` resolves to
Chinese, and the demo workbench frame draws in Chinese.
…ow chosen

⌘N asks which computer the conversation lives on, and the dialog already put
the caret on this machine — but it drew the row's only highlight through
`:focus-visible`, which WebKit does not match for an element focused by
script. The row the dialog had chosen looked like every other row, so the list
read as "nothing selected, reach for the mouse", and the arrows moved a
selection nobody could see.

The chosen row is now a piece of state: it starts on this machine, the arrows
and Home/End walk it, Enter opens it, and a row reached with Tab or a click
moves it back. The keys are listened for on the window, because the caret is
the part that could not be trusted — a dialog opened over a composer still
answers the arrows when the focus never arrived. The footer's own Enter stays
the footer's, so Cancel is still cancelled.

Nothing is created by the default: the row is a cursor, and the machine is
still the question.
The popover behind the status dot lists every paired machine, and its
takeover was wired to remote.takeControl, which speaks only for the open
machine. A peer somebody else holds is the ordinary reason the dot is
yellow, so the row that carries the action was exactly the row whose
machine never heard about it: the open desktop answered "already in
control, nothing changed", the sheet closed, and the held machine stayed
held. The picker's rows already resolve the row's own runtime, which is
why taking over from the device list worked.

Wire the badge to takeControlFor, the per-machine path, and pin the
wiring in a screen test.
Two faults in the same rectangle:

The menu was centred on the *terminal* — 64 columns at 120 wide — so its right
border ran into the rail and stood beside the rail's own vertical: two lines one
cell apart, with the rail's column cut for the height of the menu. It is now the
composer's column it is centred in and clamped to, which is the line it is
completing.

A row whose left edge cut through a wide glyph lost that half-glyph from the
splice instead of keeping its cells, so the band spliced after it started one
column early and that row's right border sat one cell left of every other row.
`slice_cols` now turns a half-cut glyph into a space, one cell per cell of it
inside the window, so a band keeps the offset it was put at.
A draft carrying a pasted picture painted the prompt marker on a row of its
own and pushed the text down one. The box's rows come from the shared
component's `render`, which puts the attachment line ("📎 2 images attached")
first, and the workbench then cut two *bytes* off every row to drop the old
`> ` prompt. That line has no prompt, and the emoji is four bytes, so
`get(2..)` returned `None` and the row arrived empty: `❯` alone, then the
draft under it — reported as "a blank line appeared above the prompt".

The component now separates the value rows (`render_value`) from the
attachment line, and the box takes only the value: the pictures are named in
the box's title, which the chat composer already did and the launchpad did
not. The launchpad gains the same count, and the title string gains the space
it was missing ("Message · enter sends · ctrl+j newline· 📎 2 images").

The launchpad's first message also stops failing silently: when the agent
creates a session but this client does not end up attached to one, `submit`
used to return without a word, leaving the draft and the launchpad exactly as
they were — indistinguishable from a key that does nothing. It now says so
in the notice row, and the draft stays so it can be sent again.
The prompt row inside the input box was filled with the panel colour while the
box had focus, so the composer read as a second surface a shade off the chat
around it — on the launchpad and in the follow-up band alike. The cursor
already marks the box as the place to type, so the row now sits on the canvas
like the top and bottom rules around it, and `palette.panel` stays what its
name says: the sidebar, the menus and the overlays.

The dead `prompt_row` duplicate (nothing called it) goes with it, and two
widget tests pin "no background of its own" on both compositors.
@huichen
huichen enabled auto-merge (squash) October 27, 2026 03:19
@huichen
huichen merged commit 62c9f14 into main Oct 27, 2026
12 checks passed
@huichen
huichen deleted the pr/huichen branch October 27, 2026 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant