Skip to content

keymap_editor: Remove redundant parentheses when displaying keymap context#50906

Merged
probably-neb merged 4 commits intozed-industries:mainfrom
dongdong867:fix/keymap-editor-displays-nested-parentheses
Mar 17, 2026
Merged

keymap_editor: Remove redundant parentheses when displaying keymap context#50906
probably-neb merged 4 commits intozed-industries:mainfrom
dongdong867:fix/keymap-editor-displays-nested-parentheses

Conversation

@dongdong867
Copy link
Copy Markdown
Contributor

Closes #34976

Root Cause

The current implementation of fmt::Display in KeyBindingContextPredicate hardcodes a parentheses around And and Or cases. Causing the text displayed on the keymap editor to have nested parentheses.

This PR refactors the display logic and make the parentheses added only when there's nested operator.

As is/ To be

As is To be
Screenshot 2026-03-06 at 15 07 10 Screenshot 2026-03-06 at 14 54 57

Test coverage

Screenshot 2026-03-06 at 15 00 42

Before you mark this PR as ready for review, make sure that you have:

  • Added a solid test coverage and/or screenshots from doing manual testing
  • Done a self-review taking into account security and performance aspects
  • Aligned any UI changes with the UI checklist

Release Notes:

  • keymap_editor: Remove redundant parentheses when displaying keymap context

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 6, 2026
@zelenenka zelenenka added the guild Pull requests by someone in Zed Guild. NOTE: the label application is automated via github actions label Mar 16, 2026
@probably-neb
Copy link
Copy Markdown
Collaborator

probably-neb commented Mar 17, 2026

This really cleans up the display in the keymap editor! Thanks for making this change!

@probably-neb probably-neb enabled auto-merge (squash) March 17, 2026 02:36
@probably-neb probably-neb merged commit 74ad758 into zed-industries:main Mar 17, 2026
29 checks passed
@dongdong867 dongdong867 deleted the fix/keymap-editor-displays-nested-parentheses branch March 17, 2026 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement guild Pull requests by someone in Zed Guild. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keymap editor: Multiple && in context causes excessive nested parentheses

4 participants