Fix underline and strikethrough not being drawn across spaces - #2
Open
kay-ws wants to merge 1 commit into
Open
Conversation
drawText() splits a line into runs of glyphs and runs of spaces. Glyph runs reach drawGlyph(), which draws the decoration; space runs are handled by a bare fillRect() that paints the background only. An underlined run containing a space is drawn with gaps, so ESC[4mA B C produces three separate underline segments where other terminals produce one. Factored the decoration into Screen::drawDecoration() and called it from both paths, so the y offsets are defined once and the two cannot drift apart again. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Author
|
@k-filipek — you added the decoration rendering in ccf83cf and #1 and #2 both There are three PRs open, all small and independent:
All three still merge cleanly. The one with a shelf life is this one: No rush on my side — I would just rather these not turn into conflicts you have |
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.
An underlined run that contains a space is drawn with gaps:
ESC[4mA B Cproduces three separate underline segments where other terminals produce one.
The same applies to strikethrough.
Cause
Screen::drawText()splits a line into runs of glyphs and runs of spaces.Glyph runs reach
drawGlyph(), which draws the decoration; space runs arehandled by a bare
fillRect()that paints the background and nothing else:There are two such call sites — one inside the loop, one after it — and
neither is passed
ulorst.Fix
Rather than repeating the
fillRect()pair at each site, the decoration isfactored into
Screen::drawDecoration()and called from all three places. They offsets then live in one place, which is what keeps the glyph path and the
space path from drifting apart again — the drift is exactly what this bug is.
drawGlyph()passes its ownh, which may have been clipped against thebottom of the screen, rather than letting the helper re-read
FH(1).Reproducing
Top: before, three and two segments respectively. Bottom: after, one continuous
underline in both cases, with the double-width cells still underlined for their
full width. Same framebuffer region, only the binary changed.
Verification
Built and tested on x86_64 (Arch,
i915drmfbconsole), wherecharis signedand the underline path is otherwise healthy, so the change can be observed on
its own. Also present in an armv7l build; the two captures above are from the
same framebuffer region with only the binary changed.
The change itself has no platform-dependent parts.