fix: stop line highlights bleeding into the text-renderer margin - #14
Merged
Conversation
The `text' renderer drew each indicator glyph into the built-in margin faced only with its foreground colour, so empty and glyph-only cells were transparent. A background highlight on the underlying line -- show-paren, region, hl-line -- therefore showed through the margin. Paint every text cell with an explicit background: the `svg-margin-cell' background (which already neutralises line decorations) by default, a `:background' indicator's tint when present, or the hover colour. This also folds the former whole-string tint into the per-cell face. The SVG renderer was unaffected -- its composite image is opaque. Add a regression test asserting empty and glyph cells both carry an explicit background, and that a `:background' indicator overrides it.
There was a problem hiding this comment.
Pull request overview
Fixes the text renderer’s margin string composition so underlying line highlights (e.g., hl-line, region, show-paren-match) don’t visually bleed through the gutter by ensuring cells carry an explicit background.
Changes:
- Update
svg-margin--text-marginto apply a per-cell background (hover > background-tint > neutral cell background) instead of only tinting the whole string. - Expand
svg-margin--text-facedocumentation to reflect broader background usage. - Add an ERT test to assert empty and glyph cells both receive an explicit background and that a
:backgroundindicator overrides it.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
svg-margin.el |
Applies per-cell background logic in the text renderer to prevent highlight bleed. |
test/svg-margin-test.el |
Adds regression coverage for explicit per-cell backgrounds and background-indicator override behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+467
to
+471
| ;; The margin cell's own background, painted behind every cell so a | ||
| ;; transient highlight on the underlying line (show-paren, region, | ||
| ;; hl-line) cannot bleed through an empty or glyph-only cell. | ||
| (defbg (let ((c (face-attribute 'svg-margin-cell :background nil t))) | ||
| (and (stringp c) c))) |
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.
Summary
Fixes a
text-renderer bug: a background highlight on the underlying line —show-paren-match, the region,hl-line— bled through the built-in-margingutter, because the renderer faced each glyph only with its foreground colour
and left empty / glyph-only cells transparent.
Fix
svg-margin--text-marginnow paints every cell with an explicit background,so nothing underneath shows through:
svg-margin-cellbackground (which already neutralises linedecorations like
:overline/:box) as the neutral default,:backgroundindicator's tint when one is present (this folds the oldwhole-string tint into the per-cell face), or
The
svgrenderer was never affected — its composite image is opaque.Verification
eask compile— clean.eask lint package/checkdoc/elisp-lint/relint— all exit 0(pre-existing advisories only; nothing new).
eask test— 57 tests, 56 as expected, 1 skipped (graphical-onlyimage-builds). Newsvg-margin/text-margin-cell-backgroundasserts emptyand glyph cells both carry an explicit background and that a
:backgroundindicator overrides the neutral one.