Skip to content

editor: Keep deleted git-gutter marker visible at small custom widths - #63434

Open
somtri wants to merge 1 commit into
zed-industries:mainfrom
somtri:gutter-deleted-marker-custom-width
Open

editor: Keep deleted git-gutter marker visible at small custom widths#63434
somtri wants to merge 1 commit into
zed-industries:mainfrom
somtri:gutter-deleted-marker-custom-width

Conversation

@somtri

@somtri somtri commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Objective

  • Fixes Git Gutter width does not scale icons properly #62923.
  • When gutter.git_gutter_width is set to a small Custom value (e.g. {"custom": 6.0}), the deleted-line marker becomes disproportionately small. It is nearly invisible in the reporter's screenshots, while added/modified markers scale acceptably.

Solution

  • The deleted marker's Default arm uses a 0.35 * line_height base; the strip's Default arm uses 0.275 * line_height. That 27% larger base is what keeps the pill-shaped deleted marker visible next to the rectangular added/modified strips.
  • The Custom(N) arm previously used N for both branches, dropping the boost. This PR routes the deleted-empty case through a new deleted_marker_base_width(setting, line_height) helper that applies a single DELETED_MARKER_WIDTH_RATIO = 0.35 / 0.275 constant to both arms.
  • Default-mode pixels are byte-identical because floor(0.275 * lh * 0.35/0.275) reduces to floor(0.35 * lh). Custom-mode gains the same 1.273× multiplier the default has always had.

Testing

  • Added a pure #[test] fn test_deleted_marker_base_width covering three invariants:
    • Default at line_height = 22.0 returns 7px, identical to the previous default arm.
    • Custom(6.0) at line_height = 22.0 returns a width greater than 6.0 (visibility preserved).
    • Custom(0.0) returns 0.0, so the width-0 render path is unchanged.
  • Verified locally on Windows: cargo fmt --all -- --check, cargo check -p editor, and cargo clippy -p editor --all-targets -- -D warnings all exit 0.
  • I have not visually verified the rendered marker on macOS or Linux. A reviewer with the reporter's setup (git_gutter_width: {"custom": 6.0} on macOS) can confirm the pill stays visible.

Self-Review Checklist:

  • 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 and icon guidelines)
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Release Notes:

  • Fixed the deleted git-gutter marker becoming nearly invisible when git_gutter_width is set to a small custom pixel value.

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Aug 30, 2026
@ChristopherBiscardi ChristopherBiscardi self-assigned this Aug 31, 2026
@ChristopherBiscardi ChristopherBiscardi added the area:integrations/git Git integration feedback label Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:integrations/git Git integration feedback cla-signed The user has signed the Contributor License Agreement

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Git Gutter width does not scale icons properly

2 participants