summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gmdocument.c1
-rw-r--r--src/gmdocument.h9
-rw-r--r--src/ui/documentwidget.c4
3 files changed, 8 insertions, 6 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c
index 1a8312f0..5da654c4 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -145,6 +145,7 @@ static iRangecc addLink_GmDocument_(iGmDocument *d, iRangecc line, iGmLinkId *li
145 trim_Rangecc(&desc); 145 trim_Rangecc(&desc);
146 if (!isEmpty_Range(&desc)) { 146 if (!isEmpty_Range(&desc)) {
147 line = desc; /* Just show the description. */ 147 line = desc; /* Just show the description. */
148 link->flags |= userFriendly_GmLinkFlag;
148 } 149 }
149 else { 150 else {
150 line = capturedRange_RegExpMatch(&m, 1); /* Show the URL. */ 151 line = capturedRange_RegExpMatch(&m, 1); /* Show the URL. */
diff --git a/src/gmdocument.h b/src/gmdocument.h
index a97af029..d834f9d6 100644
--- a/src/gmdocument.h
+++ b/src/gmdocument.h
@@ -10,10 +10,11 @@ iDeclareType(GmRun)
10typedef uint16_t iGmLinkId; 10typedef uint16_t iGmLinkId;
11 11
12enum iGmLinkFlags { 12enum iGmLinkFlags {
13 remote_GmLinkFlag = 0x1, 13 userFriendly_GmLinkFlag = 0x1,
14 http_GmLinkFlag = 0x2, 14 remote_GmLinkFlag = 0x2,
15 gopher_GmLinkFlag = 0x4, 15 http_GmLinkFlag = 0x4,
16 file_GmLinkFlag = 0x8, 16 gopher_GmLinkFlag = 0x8,
17 file_GmLinkFlag = 0x10,
17}; 18};
18 19
19struct Impl_GmRun { 20struct Impl_GmRun {
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index fd13cd72..b681c2c8 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -724,13 +724,13 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) {
724 const iGmDocument *doc = d->widget->doc; 724 const iGmDocument *doc = d->widget->doc;
725 const iGmLinkId linkId = d->widget->hoverLink->linkId; 725 const iGmLinkId linkId = d->widget->hoverLink->linkId;
726 const iString *url = linkUrl_GmDocument(doc, linkId); 726 const iString *url = linkUrl_GmDocument(doc, linkId);
727// const int flags = linkFlags_GmDocument(doc, linkId); 727 const int flags = linkFlags_GmDocument(doc, linkId);
728 iUrl parts; 728 iUrl parts;
729 init_Url(&parts, url); 729 init_Url(&parts, url);
730// desc = cstrFormat_String("\u2192 %s", cstr_String(collect_String(newRange_String(parts.protocol)))); 730// desc = cstrFormat_String("\u2192 %s", cstr_String(collect_String(newRange_String(parts.protocol))));
731 const iString *host = collect_String(newRange_String(parts.host)); 731 const iString *host = collect_String(newRange_String(parts.host));
732 fg = linkColor_GmDocument(doc, linkId); 732 fg = linkColor_GmDocument(doc, linkId);
733 if (!isEmpty_String(host)) { 733 if (!isEmpty_String(host) && flags & userFriendly_GmLinkFlag) {
734// int descWidth = measure_Text(default_FontId, cstr_String(host)).x + gap_UI; 734// int descWidth = measure_Text(default_FontId, cstr_String(host)).x + gap_UI;
735 iRect linkRect = moved_Rect(run->visBounds, origin); 735 iRect linkRect = moved_Rect(run->visBounds, origin);
736// linkRect.size.x += descWidth; 736// linkRect.size.x += descWidth;