Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alt+Enter to select all matches doesn't work for JetBrains keymap #11840

Closed
1 task done
Congyuwang opened this issue May 15, 2024 · 2 comments · Fixed by #11951
Closed
1 task done

Alt+Enter to select all matches doesn't work for JetBrains keymap #11840

Congyuwang opened this issue May 15, 2024 · 2 comments · Fixed by #11951
Labels
bug [core label] good first issue Issue suitable for first-time contributors keymap / key binding Feedback for keyboard shortcuts, key mapping, etc

Comments

@Congyuwang
Copy link
Contributor

Congyuwang commented May 15, 2024

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

When searching, using alt + enter to select all matches does not work ("base_keymap": "JetBrains").

However, it works as expected for ("base_keymap": "VSCode").

2024-05-15.14.04.44.mov

Environment

Zed: v0.135.1 (Zed Preview)
OS: macOS 14.5.0
Memory: 16 GiB
Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

My keymap settings is empty []

@Congyuwang Congyuwang added admin read Pending admin review bug [core label] triage Maintainer needs to classify the issue labels May 15, 2024
@Congyuwang Congyuwang changed the title opt + enter to select all matches does not work for "base_keymap": "JetBrains" Alt+Enter to select all matches doesn't work for JetBrains keymap May 15, 2024
@JosephTLyons JosephTLyons added keymap / key binding Feedback for keyboard shortcuts, key mapping, etc good first issue Issue suitable for first-time contributors and removed triage Maintainer needs to classify the issue admin read Pending admin review labels May 15, 2024
@Congyuwang
Copy link
Contributor Author

Congyuwang commented May 16, 2024

I tried to debug this with some println!():

When I press alt+enter on search bar, I get the following key matches

key match [KeyBinding { keystrokes: [Keystroke { modifiers: Modifiers { control: false, alt: true, shift: false, platform: false, function: false }, key: "enter", ime_key: None }], context_predicate: Some(Identifier("Editor")), action: "editor::ToggleCodeActions" }, KeyBinding { keystrokes: [Keystroke { modifiers: Modifiers { control: false, alt: true, shift: false, platform: false, function: false }, key: "enter", ime_key: None }], context_predicate: None, action: "picker::ConfirmInput" }]

key match [KeyBinding { keystrokes: [Keystroke { modifiers: Modifiers { control: false, alt: true, shift: false, platform: false, function: false }, key: "enter", ime_key: None }], context_predicate: Some(Identifier("BufferSearchBar")), action: "search::SelectAllMatches" }, KeyBinding { keystrokes: [Keystroke { modifiers: Modifiers { control: false, alt: true, shift: false, platform: false, function: false }, key: "enter", ime_key: None }], context_predicate: None, action: "picker::ConfirmInput" }]

key match [KeyBinding { keystrokes: [Keystroke { modifiers: Modifiers { control: false, alt: true, shift: false, platform: false, function: false }, key: "enter", ime_key: None }], context_predicate: Some(Identifier("Pane")), action: "search::SelectAllMatches" }, KeyBinding { keystrokes: [Keystroke { modifiers: Modifiers { control: false, alt: true, shift: false, platform: false, function: false }, key: "enter", ime_key: None }], context_predicate: None, action: "picker::ConfirmInput" }]

key match [KeyBinding { keystrokes: [Keystroke { modifiers: Modifiers { control: false, alt: true, shift: false, platform: false, function: false }, key: "enter", ime_key: None }], context_predicate: None, action: "picker::ConfirmInput" }]

But then, the first action is dispatched, and it is the editor context's action:

action to dispatch [Keystroke { modifiers: Modifiers { control: false, alt: true, shift: false, platform: false, function: false }, key: "enter", ime_key: None }]: dyn Action { name: "editor::ToggleCodeActions" }

However, I think since search bar is currently active, the SelectAllMatches should really be dispatched.

@Congyuwang
Copy link
Contributor Author

The Editor context seems to be higher than BufferSearchBar context in the context stack.

node_id: DispatchNodeId(1), context: os=macos Workspace
node_id: DispatchNodeId(332), context: os=macos Pane
node_id: DispatchNodeId(433), context: os=macos BufferSearchBar
node_id: DispatchNodeId(437), context: os=macos Editor mode=single_line

SomeoneToIgnore pushed a commit that referenced this issue May 24, 2024
The default keymap uses alt-enter for `SelectAllMatches` for `context:
BufferSearchBar`.

Jetbrains keymap uses alt-enter for `ToggleCodeActions` for `context:
Editor`.

When focusing on search bar, currently alt-enter does not perform
`SelectAllMatches`, whereas `ToggleCodeActions` is triggered instead,
because search bar's text input element has `context: Editor
mode=single_line`.

This PR restricts `ToggleCodeActions` to `Editor (full mode)` context to
allow `SelectAllMatches` to be triggered for alt-enter when the search
bar is active.

Release Notes:

- Fixed alt-enter with JetBrains keymap ignoring `search::SelectAllMatches` in certain contexts ([11840](#11840))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] good first issue Issue suitable for first-time contributors keymap / key binding Feedback for keyboard shortcuts, key mapping, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants