Skip to content

fix(tui): draw one copy chip, under the newest answer, only once it settles - #1622

Merged
huichen merged 2 commits into
mainfrom
pr/huichen
Nov 15, 2026
Merged

huichen merged 2 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

The TUI transcript drew a [复制] row under every settled reply, so a long conversation read as a column of identical buttons. /copy copies the last assistant answer, so the chip is that same verb made pressable over the block it would copy: the transcript now draws exactly one, under its newest answer.

Commits

  • fix(tui) draw one copy chip, under the newest answer, only once it settles — copy_head (from copy_head_of) names the message the chip sits under; sync_compact_layout compares it so the incremental splice paths notice when it moves, and the reply above loses the chip while the new answer gains it in one rebuild. Nothing is drawn while run_in_flight, and a pending message is never the head (a chip under a half-written answer would copy half a sentence, and excluding a streaming reply also keeps a delta splicing instead of rebuilding on every slice). rerender_message now reports the rebuild it falls back to when the chip moved. Docs (en + zh-CN) say the same.

Verification

Run in the main checkout at 9c1fabc1b with the pinned toolchain (rustc 1.99.1 from rust-toolchain.toml; the Homebrew 1.96.0 on PATH was shadowed) and ulimit -n 8192:

  • cargo fmt --all -- --check → clean
  • cargo check -p future-tui --all-targets → clean (20.7s)
  • cargo clippy -p future-tui --all-targets -- -D warnings → clean (13.4s)
  • cargo test -p future-tui --lib → 1839 passed, 0 failed, 4 ignored (20.0s)
  • make check-docs → 421 docs OK, 0 pairs pending bilingualization, provider matrix 13 rows

User-visible changes

Every settled reply used to carry its own copy chip; now exactly one chip is drawn, under the newest answer, and nothing is drawn while a run is in flight. /copy keeps copying the last assistant answer, so the pressable chip and the verb still agree. Revert 94e655d32. No setting, default value, migration or wire change.

…ettles

Every settled reply drew its own `[复制]` row, so a long conversation was a
column of identical buttons. `/copy` copies the last assistant answer, so the
chip is that same verb made pressable over the block it would copy: the
transcript now draws exactly one, under its newest answer.

- `copy_head` (computed by `copy_head_of`) names the message the chip sits
  under, and `sync_compact_layout` compares it so the incremental splice paths
  notice when it moves; the reply above loses the chip and the new answer
  gains it in one rebuild.
- Nothing is drawn while `run_in_flight`, and a `pending` message is never the
  head: a chip under a half-written answer copies half a sentence, and
  excluding a streaming reply also keeps a delta splicing instead of
  rebuilding the transcript on every slice.
- `rerender_message` now reports the rebuild it falls back to when the chip
  moved, so the reader's frame is still told.

Tests pin one chip for a multi-turn transcript, none mid-run, and the chip
moving to the answer a run settles. Docs (en + zh-CN) say the same.
@huichen
huichen enabled auto-merge (squash) November 15, 2026 17:18
@huichen
huichen merged commit c461833 into main Nov 15, 2026
11 checks passed
@huichen
huichen deleted the pr/huichen branch November 15, 2026 17:32
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