GeezerVison is showing github.com — fix(tui): keep the Mini draft caret when closing the command palette by jlongster · Pull Request #63260 · anomalyco/opencode
Conversation
jlongster
commented
Nov 11, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Issue for this PR
Type paper in Mini and press Left three times: pa│per. Press Ctrl+P, Escape, then type Z. The draft survives on both revisions. On dev, the caret jumps from offset 2 to 5 and the next key produces paperZ. With the fix, Escape restores offset 2 and the next key produces paZper.
Type of change
What does this PR do?
Save the native textarea offset as the composer unbinds, then restore the draft and offset together when it binds again. The existing editor measurement and clamping still apply when restoring a replacement draft.
How did you verify your code works?
Ran the same nine-case Statecheck property against dev (1af61ee45c41713c47fd42e80ff775e5d060c06b) and this fix (da22bf16cc4521cad62a1f4a0b76a82d6ded8a02). Three cases failed on dev: the middle of paper, the middle of a wide-character multiline draft, and the start of grid. All nine passed on the fix. The original red\nblue end-of-draft example already passes on dev. Controls also cover direct typing and selecting Show status and New session, including their callbacks.
Property, replay bundle, and full receipts
The fixture mounts the production Mini footer in OpenTUI 0.8.4’s native 64×16 test renderer under Bun 1.4.2. Each case drives the keymap and reads the focused editor and rendered frames. The host guard deferred the broader suite because a delegated cgroup was unavailable. Scope: footer only.
Replay bundle with property and full receipts · Dev trace · Fix trace · Trace viewer
Extract the bundle, then run from its root on Linux with Bun, unshare -n, and installed checkouts of the two SHAs above:
set -eo pipefail
case_dir=overnight/tui-draft-dev
OPENCODE_REPO="$BASE" bash "$case_dir/run.sh" | cmp "$case_dir/red.json" -
OPENCODE_REPO="$FIX" bash "$case_dir/run.sh" | cmp "$case_dir/green.json" -
Screenshots / recordings

Real opencode mini, same keys on both revisions: type paper, ← ×3, Ctrl+P, Escape, Z. Left: dev ends with paperZ. Right: the fix keeps the caret and ends with paZper. MP4
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
User decisions:
- Correct the existing Mini draft against current dev.
- Keep the upstream diff focused on production code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reproduced the bug on dev and the fix works. opencode-drive can't open Mini, so I mounted the real footer in OpenTUI's test renderer and ran the PR's steps on both revisions: type a draft, move the caret left, press Ctrl+P, then Escape, then Z.
dev: paper and grid both lose the caret position (paperZ, gridZ).
- This PR: the caret stays put (
paZper, Zgrid).
- End-of-draft
red\nblue: passes on both, as the description says.
All packages/tui/test/mini tests pass and tsc -b is clean.
Removing the restore that ran when the view changed back to prompt looks right: the composer only renders in that view, so the restore on rebind already covers it. When the draft is replaced while the composer is closed, the caret still goes to the end, and resetDraft puts it back at 0.
Public API is unchanged; this is internal TUI state.
No blocking concerns.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks for checking this on both revisions. I replaced the reconstructed frames in the description with a real side-by-side recording of opencode mini at 1af61ee45c and da22bf16cc (same keys on both: paper, ← ×3, Ctrl+P, Escape, Z).
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|