You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Custom question answers now use the shared Vim controller on OpenCode v1 and v2. Each answer starts in insert mode with a line cursor. Escape enters normal mode without closing the answer editor.
Keep answer modes, undo snapshots, visual ownership, registers and leader sequences separate from the main prompt.
Preserve native Enter, Ctrl+Enter and Tab behavior, question choices, permissions and unrelated dialogs.
Apply pending answer edits before the next key, so rapid edit/submit sequences cannot commit stale text. Guard queued actions against focus changes and disposal.
Reuse the existing pure Vim engine. The v2 adapter only opens its form gate for a focused ANSWER textarea.
Developed test-first: the initial suite had 28 failures before production changes. Review follow-ups added 12 failing cases for rapid input ordering and disabled cursor restoration before those fixes.
just check: lint clean, 430 tests pass, including 75 shared v1/v2 answer regressions using real OpenTUI keymap dispatch with modeled editors and host answer layers.
just compat-unit: 16 tests pass.
Cache-installed OpenCode 1.18.33: 39 checks pass, with cold and warm loading verified. One earlier cold run timed out while loading plugins; a fresh serial retry passed.
Cache-installed OpenCode 2.0.15: 56 checks pass, including actual root/child answer editing, exact submitted answers, a single-write x + Enter burst, and disabled cursor shape.
Independent local review passed after fixing its submission-ordering and cursor-restoration findings.
Remaining limits
Live question-field coverage is v2-only. V1 has shared regression coverage, source checks and installed-host smoke coverage, but the harness does not create live v1 questions.
The existing snapshot-redo and tab-offset known gaps remain unchanged. Typecheck still reports six pre-existing errors (baseline: eight); this change introduces no new diagnostics. No dependencies or package exports changed.
Verdict: fix the palette-ordering issue before merge. CI is green, but the following reproduction exposes a correctness bug outside the current test suite.
In an answer containing hello world, enter normal mode, then send :x followed by Enter in one terminal write. The palette callback is outside the answer's deferred-action queue, so x deletes the final d and Enter commits the edited draft before the palette opens.
This reproduces on both modeled host paths and on cache-installed OpenCode 2.0.15. Closing the palette reveals Answer: hello worl on the form confirmation screen. The form is still pending until a separate confirmation; this is an unintended draft edit/commit, not an immediate complete question submission.
Order the answer's pending palette action with its other actions, preserve the palette's exemption from focus-loss cancellation, and re-check host ownership before routing the following key. Add a coalesced palette/edit/Enter regression alongside the existing focus-change survival test.
P2: the undo-isolation test accepts a shared stack
The test deletes in main, deletes in the answer, undoes the answer, then undoes main. A shared LIFO stack returns the same snapshots in that order. Redirecting all snapshot clear/push/pop operations to the main context in a disposable copy still leaves all 75 answer tests passing.
Undo main first while the answer still has its own snapshot, then refocus and undo the same answer object. Assert both buffers throughout.
Calling open() after the toggles creates a fresh editor, so the test cannot detect whether the old answer context was reset. Removing the context-reset line in a second disposable copy also leaves all 75 tests passing.
Keep the same answer editor focused across disable/re-enable, seed normal mode or a pending operator, and assert that subsequent typing uses fresh insert state.
The P2 findings are test-oracle gaps, not current production bugs. No additional blocking security, packaging, clean-code or style issues were found. The small shared context module and unchanged pure engine are appropriate for this scope.
Validation remains 430 passing tests, 16 harness-unit checks, and 39 v1 / 56 v2 installed-host checks. Live v1 question editing is still a declared coverage limit. The inherited tab-offset/snapshot-redo gaps and existing typecheck errors are outside this review. No fixes were applied during this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Summary
Custom question answers now use the shared Vim controller on OpenCode v1 and v2. Each answer starts in insert mode with a line cursor. Escape enters normal mode without closing the answer editor.
ANSWERtextarea.Fixes #78.
Verification
Developed test-first: the initial suite had 28 failures before production changes. Review follow-ups added 12 failing cases for rapid input ordering and disabled cursor restoration before those fixes.
just check: lint clean, 430 tests pass, including 75 shared v1/v2 answer regressions using real OpenTUI keymap dispatch with modeled editors and host answer layers.just compat-unit: 16 tests pass.x+ Enter burst, and disabled cursor shape.Remaining limits
Live question-field coverage is v2-only. V1 has shared regression coverage, source checks and installed-host smoke coverage, but the harness does not create live v1 questions.
The existing snapshot-redo and tab-offset known gaps remain unchanged. Typecheck still reports six pre-existing errors (baseline: eight); this change introduces no new diagnostics. No dependencies or package exports changed.