Skip to content

fix: stop line highlights bleeding into the text-renderer margin - #14

Merged
chiply merged 1 commit into
mainfrom
fix/text-margin-background-bleed
Jul 2, 2026
Merged

fix: stop line highlights bleeding into the text-renderer margin#14
chiply merged 1 commit into
mainfrom
fix/text-margin-background-bleed

Conversation

@chiply

@chiply chiply commented Jul 2, 2026

Copy link
Copy Markdown
Owner

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-margin
gutter, because the renderer faced each glyph only with its foreground colour
and left empty / glyph-only cells transparent.

Fix

svg-margin--text-margin now paints every cell with an explicit background,
so nothing underneath shows through:

  • the svg-margin-cell background (which already neutralises line
    decorations like :overline/:box) as the neutral default,
  • a :background indicator's tint when one is present (this folds the old
    whole-string tint into the per-cell face), or
  • the hover colour for the hovered cell.

The svg renderer 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-only
    image-builds). New svg-margin/text-margin-cell-background asserts empty
    and glyph cells both carry an explicit background and that a :background
    indicator overrides the neutral one.

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.
Copilot AI review requested due to automatic review settings July 2, 2026 14:34
@chiply
chiply merged commit a3bc2f2 into main Jul 2, 2026
8 checks passed
@chiply
chiply deleted the fix/text-margin-background-bleed branch July 2, 2026 14:38
@chiply chiply mentioned this pull request Jul 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-margin to apply a per-cell background (hover > background-tint > neutral cell background) instead of only tinting the whole string.
  • Expand svg-margin--text-face documentation to reflect broader background usage.
  • Add an ERT test to assert empty and glyph cells both receive an explicit background and that a :background indicator 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 thread svg-margin.el
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)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants