diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gmdocument.c | 27 | ||||
-rw-r--r-- | src/gmdocument.h | 1 |
2 files changed, 17 insertions, 11 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c index 1ff085c7..9773365e 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c | |||
@@ -179,6 +179,9 @@ static iRangecc addLink_GmDocument_(iGmDocument *d, iRangecc line, iGmLinkId *li | |||
179 | } | 179 | } |
180 | else if (equalCase_Rangecc(parts.scheme, "gopher")) { | 180 | else if (equalCase_Rangecc(parts.scheme, "gopher")) { |
181 | link->flags |= gopher_GmLinkFlag; | 181 | link->flags |= gopher_GmLinkFlag; |
182 | if (startsWith_Rangecc(parts.path, "/7")) { | ||
183 | link->flags |= query_GmLinkFlag; | ||
184 | } | ||
182 | } | 185 | } |
183 | else if (equalCase_Rangecc(parts.scheme, "file")) { | 186 | else if (equalCase_Rangecc(parts.scheme, "file")) { |
184 | link->flags |= file_GmLinkFlag; | 187 | link->flags |= file_GmLinkFlag; |
@@ -280,12 +283,13 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
280 | static const float bottomMargin[max_GmLineType] = { | 283 | static const float bottomMargin[max_GmLineType] = { |
281 | 0.0f, 0.333f, 1.0f, 0.5f, 0.5f, 0.5f, 0.5f, 1.0f | 284 | 0.0f, 0.333f, 1.0f, 0.5f, 0.5f, 0.5f, 0.5f, 1.0f |
282 | }; | 285 | }; |
283 | static const char *arrow = "\u27a4"; | 286 | static const char *arrow = "\u27a4"; |
284 | static const char *envelope = "\U0001f4e7"; | 287 | static const char *envelope = "\U0001f4e7"; |
285 | static const char *bullet = "\u2022"; | 288 | static const char *bullet = "\u2022"; |
286 | static const char *folder = "\U0001f4c1"; | 289 | static const char *folder = "\U0001f4c1"; |
287 | static const char *globe = "\U0001f310"; | 290 | static const char *globe = "\U0001f310"; |
288 | static const char *quote = "\u201c"; | 291 | static const char *quote = "\u201c"; |
292 | static const char *magnifyingGlass = "\U0001f50d"; | ||
289 | const float midRunSkip = 0; /*0.120f;*/ /* extra space between wrapped text/quote lines */ | 293 | const float midRunSkip = 0; /*0.120f;*/ /* extra space between wrapped text/quote lines */ |
290 | const iPrefs *prefs = prefs_App(); | 294 | const iPrefs *prefs = prefs_App(); |
291 | clear_Array(&d->layout); | 295 | clear_Array(&d->layout); |
@@ -463,11 +467,11 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
463 | icon.visBounds.size = init_I2(indent * gap_Text, lineHeight_Text(run.font)); | 467 | icon.visBounds.size = init_I2(indent * gap_Text, lineHeight_Text(run.font)); |
464 | icon.bounds = zero_Rect(); /* just visual */ | 468 | icon.bounds = zero_Rect(); /* just visual */ |
465 | const iGmLink *link = constAt_PtrArray(&d->links, run.linkId - 1); | 469 | const iGmLink *link = constAt_PtrArray(&d->links, run.linkId - 1); |
466 | icon.text = range_CStr(link->flags & file_GmLinkFlag | 470 | icon.text = range_CStr(link->flags & query_GmLinkFlag ? magnifyingGlass |
467 | ? folder | 471 | : link->flags & file_GmLinkFlag ? folder |
468 | : link->flags & mailto_GmLinkFlag | 472 | : link->flags & mailto_GmLinkFlag ? envelope |
469 | ? envelope | 473 | : link->flags & remote_GmLinkFlag ? globe |
470 | : link->flags & remote_GmLinkFlag ? globe : arrow); | 474 | : arrow); |
471 | icon.font = regular_FontId; | 475 | icon.font = regular_FontId; |
472 | if (link->flags & remote_GmLinkFlag) { | 476 | if (link->flags & remote_GmLinkFlag) { |
473 | icon.visBounds.pos.x -= gap_Text / 2; | 477 | icon.visBounds.pos.x -= gap_Text / 2; |
@@ -596,6 +600,7 @@ static void doLayout_GmDocument_(iGmDocument *d) { | |||
596 | } | 600 | } |
597 | d->size.y = pos.y; | 601 | d->size.y = pos.y; |
598 | /* Go over the preformatted blocks and mark them wide if at least one run is wide. */ { | 602 | /* Go over the preformatted blocks and mark them wide if at least one run is wide. */ { |
603 | /* TODO: Store the dimensions and ranges for later access. */ | ||
599 | iForEach(Array, i, &d->layout) { | 604 | iForEach(Array, i, &d->layout) { |
600 | iGmRun *run = i.value; | 605 | iGmRun *run = i.value; |
601 | if (run->preId && run->flags & wide_GmRunFlag) { | 606 | if (run->preId && run->flags & wide_GmRunFlag) { |
diff --git a/src/gmdocument.h b/src/gmdocument.h index 6804d772..c6f64e1d 100644 --- a/src/gmdocument.h +++ b/src/gmdocument.h | |||
@@ -67,6 +67,7 @@ enum iGmLinkFlags { | |||
67 | content_GmLinkFlag = iBit(13), /* content visible below */ | 67 | content_GmLinkFlag = iBit(13), /* content visible below */ |
68 | visited_GmLinkFlag = iBit(14), /* in the history */ | 68 | visited_GmLinkFlag = iBit(14), /* in the history */ |
69 | permanent_GmLinkFlag = iBit(15), /* content cannot be dismissed; media link */ | 69 | permanent_GmLinkFlag = iBit(15), /* content cannot be dismissed; media link */ |
70 | query_GmLinkFlag = iBit(16), /* Gopher query link */ | ||
70 | }; | 71 | }; |
71 | 72 | ||
72 | struct Impl_GmHeading { | 73 | struct Impl_GmHeading { |