zed/crates/git_graph/src
Anthony Eid d18060e16a
git_graph: Fix height realignment issues (#54429)
Special thanks to @lingyaochu for finding out the root cause of the
issue.

Took the test from: https://github.com/zed-industries/zed/pull/54233 

The git graph was using `buffer_ui_size` when calculating the canvas row
height and the table row height. This is wrong because elements such as
`Labels` in the graph table were rendered using `ui_font_size`. This PR
normalizes the row height calculation by always using `ui_font_size` for
the canvas and table row height calculation, and taking into account the
scaling factor.

This PR also fixes a bug where the bottom of the canvas could flicker on
its first redraw because the uniform list hadn't cached the viewport
size yet, and we underestimated the visible size of the canvas and
underdrew it. We now fallback to the window height as the viewport size.
This means we'll overdraw for a single frame whenever the uniform list
hasn't cached the last item size, but it avoids the flicker!

Self-Review Checklist:

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

Closes #53492
Closes #53469

Release Notes:

- git_graph: Fix misalignment issues between the graph canvas and the
graph table

---------

Co-authored-by: lingyaochu <zx0@mail.ustc.edu.cn>
2026-04-21 15:46:25 -04:00
..
git_graph.rs git_graph: Fix height realignment issues (#54429) 2026-04-21 15:46:25 -04:00