GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

@jlongster jlongster commented Nov 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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

  • Bug fix

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

Before (dev 1af61ee45c) and after (fix da22bf16cc), side by side

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.

All reactions
@github-actions github-actions Bot added the contributor label Nov 11, 2026
@jlongster
fix(tui): restore the Mini draft caret after closing the palette
da22bf1
User decisions:
- Correct the existing Mini draft against current dev.
- Keep the upstream diff focused on production code.
@jlongster
jlongster changed the base branch from v2 to dev November 11, 2026 05:56
@jlongster
jlongster force-pushed the fix/mini-palette-caret branch from 70501b4 to da22bf1 Compare November 11, 2026 05:56
@jlongster
jlongster marked this pull request as ready for review November 12, 2026 16:44
@jlongster
jlongster enabled auto-merge (squash) November 12, 2026 16:45
opencodejr[bot]
opencodejr Bot reviewed Nov 12, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

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.

All reactions
@jlongster
jlongster merged commit 32a00c9 into dev Nov 12, 2026
32 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@jlongster
jlongster deleted the fix/mini-palette-caret branch November 12, 2026 16:49
@jlongster

jlongster commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

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).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencodejr opencodejr[bot] opencodejr[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

contributor

Projects

None yet

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.

1 participant

@jlongster
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.