diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-08-29 12:28:37 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-08-29 12:28:37 +0300 |
commit | 7fec18de45b49e59d510276ec76abaaebd7842ac (patch) | |
tree | d3eeecef20086b9753c591433bf93bb698022d54 /src/ui/documentwidget.c | |
parent | c6d6f9746fda6f6f83722319a2bf7167d86a01cd (diff) |
DocumentWidget: Fixed minor text artifacts
Clearing the background of all runs is required because sometimes a run will overlap with another, or is drawn multiple times.
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r-- | src/ui/documentwidget.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index f746c123..7e138902 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -4194,12 +4194,12 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
4194 | /* Fill the background. */ { | 4194 | /* Fill the background. */ { |
4195 | if (run->linkId && linkFlags & isOpen_GmLinkFlag && ~linkFlags & content_GmLinkFlag) { | 4195 | if (run->linkId && linkFlags & isOpen_GmLinkFlag && ~linkFlags & content_GmLinkFlag) { |
4196 | /* Open links get a highlighted background. */ | 4196 | /* Open links get a highlighted background. */ |
4197 | int bg = tmBackgroundOpenLink_ColorId; | 4197 | int bg = tmBackgroundOpenLink_ColorId; |
4198 | const int frame = tmFrameOpenLink_ColorId; | 4198 | const int frame = tmFrameOpenLink_ColorId; |
4199 | iRect wideRect = { init_I2(left_Rect(d->widgetBounds), visPos.y), | 4199 | iRect wideRect = { init_I2(left_Rect(d->widgetBounds), visPos.y), |
4200 | init_I2(width_Rect(d->widgetBounds) + | 4200 | init_I2(width_Rect(d->widgetBounds) + |
4201 | width_Widget(d->widget->scroll), | 4201 | width_Widget(d->widget->scroll), |
4202 | height_Rect(run->visBounds)) }; | 4202 | height_Rect(run->visBounds)) }; |
4203 | /* The first line is composed of two runs that may be drawn in either order, so | 4203 | /* The first line is composed of two runs that may be drawn in either order, so |
4204 | only draw half of the background. */ | 4204 | only draw half of the background. */ |
4205 | if (run->flags & decoration_GmRunFlag) { | 4205 | if (run->flags & decoration_GmRunFlag) { |
@@ -4219,8 +4219,11 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
4219 | // &d->paint, addY_I2(bottomLeft_Rect(wideRect), -1), width_Rect(wideRect), frame); | 4219 | // &d->paint, addY_I2(bottomLeft_Rect(wideRect), -1), width_Rect(wideRect), frame); |
4220 | // } | 4220 | // } |
4221 | } | 4221 | } |
4222 | else if (run->linkId) { | 4222 | else { |
4223 | /* Normal background for runs that may change appearance. */ | 4223 | /* Normal background for other runs. There are cases when runs get drawn multiple times, |
4224 | e.g., at the buffer boundary, and there are slightly overlapping characters in | ||
4225 | monospace blocks. Clearing the background here ensures a cleaner visual appearance | ||
4226 | since only one glyph is visible at any given point. */ | ||
4224 | fillRect_Paint(&d->paint, (iRect){ visPos, run->visBounds.size }, tmBackground_ColorId); | 4227 | fillRect_Paint(&d->paint, (iRect){ visPos, run->visBounds.size }, tmBackground_ColorId); |
4225 | } | 4228 | } |
4226 | } | 4229 | } |