From 72e095cf987d6bb2bc2212035a8c5498f3b6d329 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Wed, 29 Jul 2020 16:40:07 +0300 Subject: Moved History to its own type --- src/ui/documentwidget.c | 8 ++++---- src/ui/text.c | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src/ui') diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index e908f090..52628143 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c @@ -903,10 +903,10 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { /* Text markers. */ fillRange_DrawContext_(d, run, teal_ColorId, d->widget->foundMark, &d->inFoundMark); fillRange_DrawContext_(d, run, brown_ColorId, d->widget->selectMark, &d->inSelectMark); - if (run->linkId) { - fg = linkColor_GmDocument(doc, run->linkId); - if (isHover && ~linkFlags_GmDocument(doc, run->linkId) & content_GmLinkFlag) { - fg = white_ColorId; + if (run->linkId && !isEmpty_Rect(run->bounds)) { + fg = white_ColorId; + if (isHover || linkFlags_GmDocument(doc, run->linkId) & content_GmLinkFlag) { + fg = linkColor_GmDocument(doc, run->linkId); } } drawString_Text(run->font, visPos, fg, &text); diff --git a/src/ui/text.c b/src/ui/text.c index 12255fdb..ad1c37c8 100644 --- a/src/ui/text.c +++ b/src/ui/text.c @@ -298,6 +298,11 @@ static iChar nextChar_(const char **chPos, const char *end) { int enableHalfPixelGlyphs_Text = iTrue; +iLocalDef iBool isWrapBoundary_(iChar a, iChar b) { + if (b == '/' || b == '-') return iTrue; + return !isSpace_Char(a) && isSpace_Char(b); +} + static iInt2 run_Font_(iFont *d, enum iRunMode mode, iRangecc text, size_t maxLen, iInt2 pos, int xposLimit, const char **continueFrom_out, int *runAdvance_out) { iInt2 size = zero_I2(); @@ -364,7 +369,7 @@ static iInt2 run_Font_(iFont *d, enum iRunMode mode, iRangecc text, size_t maxLe } xpos += glyph->advance; xposMax = iMax(xposMax, xpos); - if (mode == measureNoWrap_RunMode || (!isSpace_Char(prevCh) && isSpace_Char(ch))) { + if (mode == measureNoWrap_RunMode || isWrapBoundary_(prevCh, ch)) { lastWordEnd = chPos; } /* Check the next character. */ -- cgit v1.2.3