Skip to content

fix: unstick keys after rejecting a question prompt - #73

Merged
oribarilan merged 2 commits into
oribarilan:mainfrom
BeyramTaglietti:fix/question-rejected-stuck
Sep 11, 2026
Merged

oribarilan merged 2 commits into
oribarilan:mainfrom
BeyramTaglietti:fix/question-rejected-stuck

Conversation

@BeyramTaglietti

@BeyramTaglietti BeyramTaglietti commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

What

Rejecting or dismissing a question prompt no longer leaves vimcode passing every key through to the editor (block cursor, typing works, Escape dead).

Why

vimcode tracks pending prompts via api.event so it can step aside while an overlay owns the keyboard. It subscribed to question.asked (+1) and question.replied (-1) only — not question.rejected, which the host emits when a question prompt is dismissed. The +1 never balanced, so hasActivePrompts() stayed true and the key intercept returned early without consuming any key. Every key, including Escape, went to the host while syncCursorStyle() kept painting the block cursor.

How

Subscribe to question.rejected and apply the same -1 as question.replied, disposing it alongside the other listeners.

Tests

  • Integration: drives plugin.tui with mock event handlers and asserts keys pass through while a question is pending and are consumed again after question.rejected. Also covers question.replied, permission.replied, and child→root resolution.
  • bun test green (313 tests).

Fixes #72

BeyramTaglietti and others added 2 commits September 9, 2026 16:15
## Why
vimcode tracks pending prompts via api.event so it can pass keys through
while an overlay owns the keyboard. It subscribed to question.asked (+1)
and question.replied (-1) only — not question.rejected, which the host
emits when a question prompt is dismissed. The +1 never balanced, so
hasActivePrompts() stayed true and the key intercept returned early
without consuming any key. Every key, including Escape, went to the host
while syncCursorStyle() kept painting the block cursor.

## How
Subscribe to question.rejected and apply the same -1 as question.replied,
disposing it alongside the other listeners.

## Tests
Integration test drives plugin.tui with mock event handlers and asserts
keys pass through while a question is pending and are consumed again
after question.rejected. Also covers question.replied, permission.replied,
and child-to-root resolution. bun test green (313 tests).

Fixes oribarilan#72
@oribarilan

Copy link
Copy Markdown
Owner

@BeyramTaglietti thanks for taking the time to report the issue, troubleshoot and fix it. this is awesome

@BeyramTaglietti

Copy link
Copy Markdown
Contributor Author

@oribarilan my pleasure to help

@oribarilan
oribarilan merged commit 9f43804 into oribarilan:main Sep 11, 2026
1 check passed
oribarilan added a commit that referenced this pull request Sep 11, 2026
## Release v0.18.1

Patch release containing the question-dismissal fix from #73 and
documentation updates from #74.

### Fixed
- Fixed Vim keys remaining unresponsive after dismissing or rejecting a
question prompt (#72).

### Changed
- Updated the documented cache-installed mode indicator limitation with
the latest OpenCode and OpenTUI findings (#3).

### Release preparation
- Updated package.json, src/version.ts, both README version pins, and
changelog comparison links per CONTRIBUTING.md.
- just check passed: 313 tests, zero lint warnings or errors.
- Version consistency and git diff --check passed.

After CI passes, this PR must be squash-merged before tagging v0.18.1
and publishing the GitHub release.
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.

Rejecting a question prompt leaves vimcode stuck passing all keys through

2 participants