zed/assets
Dino 28c0f4aef8
git_ui: Refactor git panel entry collapse (#61846)
# Objective

Standardize the behavior of collapsing/expanding entries between Project
Panel and Git Panel. At the time of writing, using `left` or `right` on
the Project Panel would find the nearest parent directory and collapse
it while, on the Git Panel, that will only happen if the directory is
already selected, otherwise it'll select the previous entry instead.

## Solution

Update `git_ui::git_panel::GitPanel::collapse_selected_entry` in order
to always try to find the nearest expanded directory, regardless of the
selected entry, and then collapse it and select it.

The default keymap for Vim/Helix has also been updated to ensure that
`h` and `l` work for collapsing or expanding entries, similar to what
already happens in Project Panel.

## Testing

Tested both manually, as can be seen in the "Showcase" section as well
as added a new test for these changes,
`git_ui::git_panel::tests::test_collapse_selected_entry` .

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [ ] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

## Showcase

<details>
  <summary>Before</summary>


https://github.com/user-attachments/assets/2fd8db03-155a-4406-a190-17a1958dda11
</details>

<details>
  <summary>After</summary>


https://github.com/user-attachments/assets/f64bd584-a3c2-4a33-b95a-2547c8b721d2
</details>

---

Release Notes:

- Improved `git panel: collapse selected entry` in order to find and
collapse the nearest parent directory, similar to the Project Panel.
- Added support for using `h` and `l`, in Vim/Helix mode, to collapse
and expand entries in the Git Panel.
2026-08-19 10:06:46 +00:00
..
badge Adjust Zed badge (#35294) 2025-07-29 15:09:31 -04:00
fonts Use semibold (#47725) 2026-01-27 08:50:52 -07:00
icons csv_preview: Evolve into tabular data preview (#60768) 2026-08-14 15:58:14 +00:00
images cloud_api_types: Add ZedVip variant to Plan (#59443) 2026-06-18 20:51:36 +00:00
keymaps git_ui: Refactor git panel entry collapse (#61846) 2026-08-19 10:06:46 +00:00
prompts A couple new inline assistant tests (#45049) 2025-12-17 13:02:03 -08:00
settings Fix the git_gutter_width setting (#62704) 2026-08-18 12:40:18 +00:00
sounds call: Play a different sound when a guest joins (#38987) 2025-09-27 09:20:55 -04:00
themes Fix parameter colors for gruvbox themes (#61983) 2026-07-31 10:27:51 +00:00