mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-23 17:10:37 +01:00
7fecbb2c4b
This PR shares grouping, sorting, duplicate handling, and list rendering between which-key and the pending keystrokes indicator. Which-key keeps its existing list behavior. The indicator adopts that behavior and replaces its 10-entry limit with scrolling. **What changes?** | Area | Which-key popup | Indicator popover | |---|---|---| | Grouping | Unchanged | ***Groups bindings with the same next key under `+N keybinds`, instead of listing each action*** | | Sorting and duplicates | Unchanged | ***Uses which-key's existing rules***, detailed below | | Key display | ***Uses keybinding components instead of standalone text labels***, preserving Vim-style notation | Keeps keybinding components | | Header | ***Adds "is waiting for more keys…" beside the pending keys***; keeps the divider | Keeps the waiting message; ***adds a divider*** | | Rows | Keeps aligned columns and truncated action labels; ***uses smaller labels and fixed row heights*** | ***Adds aligned columns, fixed row heights, truncated action labels, and highlighted group counts*** | | Long lists | Remains scrollable | ***Shows all prepared rows in a scrollable list, instead of the first 10*** | | Scroll position | ***Resets when pending keys change or clear*** | ***Resets when pending keys change or clear*** | Sorting puts individual bindings before groups, then sorts by remaining key count, key-label length, and key text. Within each group, duplicate handling removes adjacent identical key sequences even if their actions differ. After sorting, it removes adjacent identical key/action rows. **What is shared?** - Grouping, sorting, duplicate handling, and the resulting rows. - The pending-key header, divider, key formatting, columns, action labels, and scrollable list. - Tests for list preparation and key display. **What remains separate?** | Part | Which-key popup | Pending keystrokes indicator | |---|---|---| | Filtering | Excludes a hardcoded set of Vim-related sequences | Does not apply those exclusions | | Container | Bottom-right modal with its own size limits | Tooltip-styled popover anchored to the status bar item | | Interaction | Automatic opening, modal focus, and dismissal | Status bar button, countdown, click action, hover handling, and timeout pausing/resuming | The pending keystrokes indicator is hidden in Vim/Helix mode, so it does not need which-key's Vim-related filtering. This refactor preserves each view's existing filtering and visibility behavior. **Screenshots** | | Before | After | |---|---|---| | Which-key | <img width="300" src="https://github.com/user-attachments/assets/892313c8-ad07-4c8b-b2b2-8a14944e8a37" /> | <img width="300" src="https://github.com/user-attachments/assets/9475b17d-e254-497c-99e9-55f812ff8fad" /> | | Which-key (Vim mode) | <img width="300" src="https://github.com/user-attachments/assets/8aae5c73-7d73-4f19-a4f0-1d82574b79db" /> | <img width="300" src="https://github.com/user-attachments/assets/98576381-e208-4658-95e0-40544026f2c2" /> | | Indicator popover | <img width="300" src="https://github.com/user-attachments/assets/cbf9fa63-2766-4b85-bc0f-f5b3ae2e4c68" /> | <img width="300" src="https://github.com/user-attachments/assets/a94180e6-d910-474f-8d74-fc83cec83aec" /> | Release Notes: - Improved the pending keystrokes indicator with grouped bindings, a scrollable list, and a clearer layout.