Fix wrap symbol background on homolog pairs in side-by-side#2160
Open
igrmk wants to merge 2 commits into
Open
Conversation
In wrap_minusplus_block the continuation symbol and padding used minus-style / plus-style even when the rest of the line was painted with non-emph, leaving a visibly mismatched chip. Pick fill_style per alignment pair: non-emph for homologs (Some, Some), minus-style / plus-style for standalone lines.
Companion to the homolog-pair fix. A standalone wrapped line drew its wrap symbol and padding from minus/plus-style, ignoring a map-styles repaint of the content, so a remapped moved line kept the old color on the wrap chrome. Derive the fill from the line's last painted style.
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.
Wrap symbols in side-by-side in homolog should inherit the line's non-emph background
Symptom
In side-by-side mode only, in a homolog, the wrap continuation symbol is painted as
minus-style/plus-stylewhile the surrounding content is in
minus-non-emph-style/plus-non-emph-style.The bug is only visible when
minus-styleandminus-non-emph-style(orplus-styleandplus-non-emph-style)are configured with different background colors.
Delta's defaults give each pair the same background — so the bug appears only in custom themes.
Self-contained reproduction against this repo at terminal width 160:
Before
After
Root cause
wrap_minusplus_block(src/wrapping.rs) hard-codesfill_styleto{minus,plus}_styleregardless of whether the pair has a homolog.That
fill_stylebecomes the background of the wrap continuation symbol and any right-aligned padding spaces.But when a minus/plus pair has a homolog, the rest of the painted bg is
{minus,plus}_non_emph_style(set by
Painter::get_should_right_fill_background_color_and_fill_styleinpaint.rsvia theline_has_homolog == Some(true)branch).So the wrap symbols and padding pick a bg that doesn't match the line they're embedded in.
Fix
Compute
fill_styleper alignment pair:(Some, None)or(None, Some)— unpaired line, no homolog: keep{minus,plus}_style.(Some, Some)— paired with homolog: use{minus,plus}_non_emph_style.