diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-11-21 13:19:17 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-11-21 13:19:17 +0200 |
commit | 6d24d800df86e11c5686d50437932a711af82915 (patch) | |
tree | e011f269b0111043b9b02d4477b790ce19380bd7 /src/ui/documentwidget.c | |
parent | d30daab57241b8ec9e72e24b2f600923d6a231c4 (diff) |
DocumentWidget: Marking link icons as search matches
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r-- | src/ui/documentwidget.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index c3c0f527..b1c166aa 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -2274,14 +2274,26 @@ static void fillRange_DrawContext_(iDrawContext *d, const iGmRun *run, enum iCol | |||
2274 | else { | 2274 | else { |
2275 | *isInside = iTrue; /* at least until the next run */ | 2275 | *isInside = iTrue; /* at least until the next run */ |
2276 | } | 2276 | } |
2277 | if (w > width_Rect(run->visBounds) - x) { | 2277 | if (w > width_Rect(run->bounds) - x) { |
2278 | w = width_Rect(run->visBounds) - x; | 2278 | w = width_Rect(run->bounds) - x; |
2279 | } | 2279 | } |
2280 | const iInt2 visPos = | 2280 | const iInt2 visPos = |
2281 | add_I2(run->bounds.pos, addY_I2(d->viewPos, -value_Anim(&d->widget->scrollY))); | 2281 | add_I2(run->bounds.pos, addY_I2(d->viewPos, -value_Anim(&d->widget->scrollY))); |
2282 | fillRect_Paint(&d->paint, (iRect){ addX_I2(visPos, x), | 2282 | fillRect_Paint(&d->paint, (iRect){ addX_I2(visPos, x), |
2283 | init_I2(w, height_Rect(run->bounds)) }, color); | 2283 | init_I2(w, height_Rect(run->bounds)) }, color); |
2284 | } | 2284 | } |
2285 | /* Link URLs are not part of the visible document, so they are ignored above. Handle | ||
2286 | these ranges as a special case. */ | ||
2287 | if (run->linkId && run->flags & decoration_GmRunFlag) { | ||
2288 | const iRangecc url = linkUrlRange_GmDocument(d->widget->doc, run->linkId); | ||
2289 | if (contains_Range(&url, mark.start) && | ||
2290 | (contains_Range(&url, mark.end) || url.end == mark.end)) { | ||
2291 | fillRect_Paint( | ||
2292 | &d->paint, | ||
2293 | moved_Rect(run->visBounds, addY_I2(d->viewPos, -value_Anim(&d->widget->scrollY))), | ||
2294 | color); | ||
2295 | } | ||
2296 | } | ||
2285 | } | 2297 | } |
2286 | 2298 | ||
2287 | static void drawMark_DrawContext_(void *context, const iGmRun *run) { | 2299 | static void drawMark_DrawContext_(void *context, const iGmRun *run) { |