mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-24 01:20:29 +01:00
c9daddfa0a
The section headers in the git panel (Staged / Unstaged, Tracked / Untracked, and Conflicts) didn't say how many files were in each section. With a long list of changes you had to scroll or collapse sections to get a sense of what was staged versus not. VS Code shows a small count next to each group, and this brings the same thing to Zed. Each section header now shows its file count in a small chip next to the "stage all" checkbox. The chip is hidden when a section is empty, so the pinned empty Staged/Unstaged headers stay clean. A couple of notes on the implementation: - The count comes from the same per-section lists that `update_visible_entries` already builds to render the rows, so the number always matches what's on screen. The existing `tracked_count` / `new_count` fields couldn't be reused here: there's no equivalent for Staged/Unstaged, and a partially staged file shows up in both of those sections. - In tree view the count is the number of files, not files plus directories. - The badge reuses the existing `Chip` component, which the panel already uses for tags in the history view. I added assertions to the existing grouping tests to cover the counts for both the staging and the status grouping. ## Showcase ### Staged / Unstaged <table width="100%"> <tr> <td width="50%" valign="top"> **Before** <img width="358" height="605" alt="image" src="https://github.com/user-attachments/assets/d23c7051-abf7-470a-9194-9e3ea7ae2a7e" /> </td> <td width="50%" valign="top"> **After** <img width="360" height="665" alt="image" src="https://github.com/user-attachments/assets/38e5528d-0d73-4f1d-ab30-2cd0f00b8ef1" /> </td> </tr> </table> ### Tracked / Untracked <table width="100%"> <tr> <td width="50%" valign="top"> **Before** <img width="360" height="631" alt="image" src="https://github.com/user-attachments/assets/d234321e-7f3b-4215-b9ed-34a6da8d6904" /> </td> <td width="50%" valign="top"> **After** <img width="359" height="553" alt="image" src="https://github.com/user-attachments/assets/02b702f9-89b9-4af3-876f-06ed6c1c8320" /> </td> </tr> </table> Release Notes: - Added file counts to section headers in the git panel