diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-05 12:19:55 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-05 12:19:55 +0300 |
commit | 6000db343bb2c1b44bed9eb4b14a179f839f3aa7 (patch) | |
tree | 72363eac22ff41977e3336d1786fd0dc383ca2fe /src/ui/documentwidget.c | |
parent | ee0b5e2c30b68a906f76be388b47fac98a5f9e1f (diff) |
Fixed color escapes in link visit date
A color escape may be longer than two characters.
`run_Font_()` was not parsing extended color escapes correctly.
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r-- | src/ui/documentwidget.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 240b2d4a..ff89f5ec 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -3245,7 +3245,7 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
3245 | showHost)) { | 3245 | showHost)) { |
3246 | format_String( | 3246 | format_String( |
3247 | &str, | 3247 | &str, |
3248 | " \u2014%s%s%s\r%c%s", | 3248 | " \u2014%s%s%s%s%s", |
3249 | showHost ? " " : "", | 3249 | showHost ? " " : "", |
3250 | showHost | 3250 | showHost |
3251 | ? (flags & mailto_GmLinkFlag ? cstr_String(url) | 3251 | ? (flags & mailto_GmLinkFlag ? cstr_String(url) |
@@ -3256,9 +3256,8 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
3256 | : "", | 3256 | : "", |
3257 | showHost && (showImage || showAudio) ? " \u2014" : "", | 3257 | showHost && (showImage || showAudio) ? " \u2014" : "", |
3258 | showImage || showAudio | 3258 | showImage || showAudio |
3259 | ? asciiBase_ColorEscape + fg | 3259 | ? escape_Color(fg) |
3260 | : (asciiBase_ColorEscape + | 3260 | : escape_Color(linkColor_GmDocument(doc, run->linkId, domain_GmLinkPart)), |
3261 | linkColor_GmDocument(doc, run->linkId, domain_GmLinkPart)), | ||
3262 | showImage || showAudio | 3261 | showImage || showAudio |
3263 | ? format_CStr(showImage ? " %s \U0001f5bb" : " %s \U0001f3b5", | 3262 | ? format_CStr(showImage ? " %s \U0001f5bb" : " %s \U0001f3b5", |
3264 | cstr_Lang(showImage ? "link.hint.image" : "link.hint.audio")) | 3263 | cstr_Lang(showImage ? "link.hint.image" : "link.hint.audio")) |
@@ -3267,11 +3266,10 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
3267 | if (run->flags & endOfLine_GmRunFlag && flags & visited_GmLinkFlag) { | 3266 | if (run->flags & endOfLine_GmRunFlag && flags & visited_GmLinkFlag) { |
3268 | iDate date; | 3267 | iDate date; |
3269 | init_Date(&date, linkTime_GmDocument(doc, run->linkId)); | 3268 | init_Date(&date, linkTime_GmDocument(doc, run->linkId)); |
3270 | appendFormat_String(&str, | 3269 | appendCStr_String(&str, " \u2014 "); |
3271 | " \u2014 %s%s", | 3270 | appendCStr_String( |
3272 | escape_Color(linkColor_GmDocument(doc, run->linkId, | 3271 | &str, escape_Color(linkColor_GmDocument(doc, run->linkId, visited_GmLinkPart))); |
3273 | visited_GmLinkPart)), | 3272 | append_String(&str, collect_String(format_Date(&date, "%b %d"))); |
3274 | cstr_String(collect_String(format_Date(&date, "%b %d")))); | ||
3275 | } | 3273 | } |
3276 | if (!isEmpty_String(&str)) { | 3274 | if (!isEmpty_String(&str)) { |
3277 | const iInt2 textSize = measure_Text(metaFont, cstr_String(&str)); | 3275 | const iInt2 textSize = measure_Text(metaFont, cstr_String(&str)); |