Skip to content

git_graph: Fix height realignment issues#54429

Merged
Anthony-Eid merged 5 commits intomainfrom
git-graph-row-height
Apr 21, 2026
Merged

git_graph: Fix height realignment issues#54429
Anthony-Eid merged 5 commits intomainfrom
git-graph-row-height

Conversation

@Anthony-Eid
Copy link
Copy Markdown
Contributor

@Anthony-Eid Anthony-Eid commented Apr 21, 2026

Special thanks to @lingyaochu for finding out the root cause of the issue.

Took the test from: #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:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • 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
lingyaochu and others added 2 commits April 21, 2026 11:00
Replaces the hand-rolled `buffer_font_size + 12px` formula with the
window text style's UI line height plus a named padding constant,
then snaps the result to the nearest physical pixel so the canvas and
uniform_list table layouts never drift.

Also drops the `row_height` field on `GitGraph` since the value is cheap
to recompute and all call sites have access to `&Window` + `&App`.

Co-authored-by: lingyaochu <zx0@mail.ustc.edu.cn>
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Apr 21, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label Apr 21, 2026
@Anthony-Eid Anthony-Eid merged commit d18060e into main Apr 21, 2026
31 checks passed
@Anthony-Eid Anthony-Eid deleted the git-graph-row-height branch April 21, 2026 19:46
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 staff Pull requests authored by a current member of Zed staff

3 participants