editor: Left-align tab whitespace marker instead of centering it#57658
Open
mvanhorn wants to merge 1 commit into
Open
editor: Left-align tab whitespace marker instead of centering it#57658mvanhorn wants to merge 1 commit into
mvanhorn wants to merge 1 commit into
Conversation
Member
|
@mvanhorn Could you please add before and after screenshots of the change? |
Contributor
Author
|
@maxdeviant here's the before/after with Side-by-side: https://files.catbox.moe/p9oxex.png Before (stable main): https://files.catbox.moe/hmqoio.png Demo file: In the BEFORE shot the tab arrow sits centered inside the tab cell (you can see it offset rightward from where the tab actually starts). In the AFTER shot the arrow is at the left edge - so the tab marker visually starts where the tab character starts, instead of drifting into the middle of the cell. The space dots are unchanged. |
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.
Self-Review Checklist:
Tab whitespace markers (e.g. `→`) were being centered against `em_width` along with space markers. For tabs that span multiple columns (especially with proportional fonts), this pushed the arrow into the middle of the tab cell instead of aligning it where the tab actually begins, making it visually hard to tell tab from space.
Extracted the per-character centering offset into `invisible_marker_offset` and made it return zero for tabs while preserving the existing centering for spaces. Refactored `extract_whitespace_info` to use a new `invisible_paint_info` helper so the position math is shared between the renderer and the new tests.
Tests cover both branches: tabs paint at `x_for_index(start)` exactly, spaces keep their centering offset. The whitespace-map test setup is reused.
Closes #57087
Release Notes:
AI was used for assistance.