diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-07-15 15:13:16 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-07-15 15:13:16 +0300 |
commit | 9f7bbeecba762213c7dec4555e0cbb1da2b2ea66 (patch) | |
tree | ee25294aac08e2921b3e5514d2d81af08e0df006 /src/ui | |
parent | 353848947c4de934f0b932d4d3fe97b61f3a1d4a (diff) |
RTL line quote and link hover info
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/documentwidget.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index ea4909eb..7e6c2ea4 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -4193,7 +4193,10 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
4193 | } | 4193 | } |
4194 | if (run->flags & quoteBorder_GmRunFlag) { | 4194 | if (run->flags & quoteBorder_GmRunFlag) { |
4195 | drawVLine_Paint(&d->paint, | 4195 | drawVLine_Paint(&d->paint, |
4196 | addX_I2(visPos, -gap_Text * 5 / 2), | 4196 | addX_I2(visPos, |
4197 | !run->textParams.isRTL | ||
4198 | ? -gap_Text * 5 / 2 | ||
4199 | : (width_Rect(run->visBounds) + gap_Text * 5 / 2)), | ||
4197 | height_Rect(run->visBounds), | 4200 | height_Rect(run->visBounds), |
4198 | tmQuoteIcon_ColorId); | 4201 | tmQuoteIcon_ColorId); |
4199 | } | 4202 | } |
@@ -4286,8 +4289,8 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
4286 | showHost)) { | 4289 | showHost)) { |
4287 | format_String( | 4290 | format_String( |
4288 | &str, | 4291 | &str, |
4289 | " \u2014%s%s%s%s%s", | 4292 | "%s%s%s%s%s", |
4290 | showHost ? " " : "", | 4293 | showHost ? "" : "", |
4291 | showHost | 4294 | showHost |
4292 | ? (flags & mailto_GmLinkFlag ? cstr_String(url) | 4295 | ? (flags & mailto_GmLinkFlag ? cstr_String(url) |
4293 | : ~flags & gemini_GmLinkFlag ? format_CStr("%s://%s", | 4296 | : ~flags & gemini_GmLinkFlag ? format_CStr("%s://%s", |
@@ -4313,9 +4316,18 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
4313 | append_String(&str, collect_String(format_Date(&date, "%b %d"))); | 4316 | append_String(&str, collect_String(format_Date(&date, "%b %d"))); |
4314 | } | 4317 | } |
4315 | if (!isEmpty_String(&str)) { | 4318 | if (!isEmpty_String(&str)) { |
4319 | if (run->textParams.isRTL) { | ||
4320 | appendCStr_String(&str, " \u2014 "); | ||
4321 | } | ||
4322 | else { | ||
4323 | prependCStr_String(&str, " \u2014 "); | ||
4324 | } | ||
4316 | const iInt2 textSize = measure_Text(metaFont, cstr_String(&str)).bounds.size; | 4325 | const iInt2 textSize = measure_Text(metaFont, cstr_String(&str)).bounds.size; |
4317 | int tx = topRight_Rect(linkRect).x; | 4326 | int tx = topRight_Rect(linkRect).x; |
4318 | const char *msg = cstr_String(&str); | 4327 | const char *msg = cstr_String(&str); |
4328 | if (run->textParams.isRTL) { | ||
4329 | tx = topLeft_Rect(linkRect).x - textSize.x; | ||
4330 | } | ||
4319 | if (tx + textSize.x > right_Rect(d->widgetBounds)) { | 4331 | if (tx + textSize.x > right_Rect(d->widgetBounds)) { |
4320 | tx = right_Rect(d->widgetBounds) - textSize.x; | 4332 | tx = right_Rect(d->widgetBounds) - textSize.x; |
4321 | fillRect_Paint(&d->paint, (iRect){ init_I2(tx, top_Rect(linkRect)), textSize }, | 4333 | fillRect_Paint(&d->paint, (iRect){ init_I2(tx, top_Rect(linkRect)), textSize }, |