Skip to content

fix: app_exit keybind ignored when using <leader> (including default <leader>q)#8151

Open
razor-x wants to merge 1 commit intoanomalyco:devfrom
rxfork:fix-leader-quit
Open

fix: app_exit keybind ignored when using <leader> (including default <leader>q)#8151
razor-x wants to merge 1 commit intoanomalyco:devfrom
rxfork:fix-leader-quit

Conversation

@razor-x
Copy link
Copy Markdown

@razor-x razor-x commented Jan 13, 2026

Fixes #3851

What does this PR do?

Summary

  • Add a global app_exit handler so leader key combos reach exit even when prompt focus is blurred, while still respecting the “only exit when prompt is empty” rule in packages/opencode/src/cli/cmd/tui/app.tsx:183.
    Why this fixes it
  • q was being consumed while the prompt was blurred by leader mode, so the prompt-level app_exit handler never ran. The new global handler uses useKeyboard and usePromptRef to exit consistently.

How did you verify your code works?

Built and ran locally, verified q exits the app as expected.

I was not able to find a way to add an test for this. The core issue depends on the app.tsx running and focus passing between the prompt an the app, so a unit test is mostly ceremonial. An e2e test would require a net test harness to mount the TUI app similar to how playwright e2e works.

@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

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.

Keybind: <leader>q for app_exit doesn't exit in 1.0

1 participant