editor: Keep deleted git-gutter marker visible at small custom widths - #63434
Open
somtri wants to merge 1 commit into
Open
editor: Keep deleted git-gutter marker visible at small custom widths#63434somtri wants to merge 1 commit into
somtri wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
gutter.git_gutter_widthis set to a smallCustomvalue (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
Defaultarm uses a0.35 * line_heightbase; the strip'sDefaultarm uses0.275 * line_height. That 27% larger base is what keeps the pill-shaped deleted marker visible next to the rectangular added/modified strips.Custom(N)arm previously usedNfor both branches, dropping the boost. This PR routes the deleted-empty case through a newdeleted_marker_base_width(setting, line_height)helper that applies a singleDELETED_MARKER_WIDTH_RATIO = 0.35 / 0.275constant to both arms.floor(0.275 * lh * 0.35/0.275)reduces tofloor(0.35 * lh). Custom-mode gains the same 1.273× multiplier the default has always had.Testing
#[test] fn test_deleted_marker_base_widthcovering three invariants:Defaultatline_height = 22.0returns7px, identical to the previous default arm.Custom(6.0)atline_height = 22.0returns a width greater than 6.0 (visibility preserved).Custom(0.0)returns0.0, so the width-0 render path is unchanged.cargo fmt --all -- --check,cargo check -p editor, andcargo clippy -p editor --all-targets -- -D warningsall exit 0.git_gutter_width: {"custom": 6.0}on macOS) can confirm the pill stays visible.Self-Review Checklist:
Release Notes:
git_gutter_widthis set to a small custom pixel value.