Skip to content

fix(tui): suppress diff viewer keybindings when dialog is open#30787

Open
lawRathod wants to merge 1 commit into
anomalyco:devfrom
lawRathod:fix/tui-diff-viewer-modal-key-intercept
Open

fix(tui): suppress diff viewer keybindings when dialog is open#30787
lawRathod wants to merge 1 commit into
anomalyco:devfrom
lawRathod:fix/tui-diff-viewer-modal-key-intercept

Conversation

@lawRathod
Copy link
Copy Markdown

@lawRathod lawRathod commented Jun 4, 2026

Issue for this PR

Closes #30754

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Opening Commands (command palette) while the Diff Viewer is open steals letter keys — q, s, d, p, E trigger diff actions instead of typing into the search input.

The cause: the diff viewer's useBindings() had no mode constraint, so its keybindings stayed active even after a dialog pushed "modal" onto the mode stack. The fix adds mode: OPENCODE_BASE_MODE, matching the pattern already used by session, permission, and question views.

Change: 2 lines in diff-viewer.tsx — one import, one mode field.

How did you verify your code works?

  1. Opened Diff Viewer, then Commands, typed q/e/p/s/d — confirmed keys triggered diff actions
  2. Applied fix, repeated — keys now reach the search input
  3. Confirmed no other useBindings() calls in the TUI have the same gap

Screenshots / recordings

BUG
https://github.com/user-attachments/assets/33830aed-9604-4c08-b3d5-a20bd83d6175

FIX
https://github.com/user-attachments/assets/06f159cc-a06c-470e-b3d6-e6cdfe6388e6

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Copilot AI review requested due to automatic review settings June 4, 2026 18:26
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jun 4, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the diff viewer TUI plugin to register its key bindings under the OpenCode base keymap mode.

Changes:

  • Import OPENCODE_BASE_MODE from @tui/keymap.
  • Pass mode: OPENCODE_BASE_MODE into the useBindings configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jun 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@lawRathod
Copy link
Copy Markdown
Author

We checked all other useBindings() calls in the TUI for the same issue — nowhere else was a non-dialog view registering single-character key bindings without mode gating. The diff viewer was the only one.

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.

[BUG] Commands search does not register certain letters when opened during Diff Viewer

2 participants