diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2022-02-10 15:15:55 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2022-02-10 15:15:55 +0200 |
commit | 46068652834e1d5214d0a74dce24aa678df91103 (patch) | |
tree | 54305446c738a6a21f9abe1b297b01dba648d585 /src/ui/linkinfo.c | |
parent | cd667eeac58dce0dc699bc12010482bdd96d8297 (diff) |
Dealing with long URLs
LinkInfo will truncate extremely long URLs, and when viewing a single image, data URLs don't have a title.
Diffstat (limited to 'src/ui/linkinfo.c')
-rw-r--r-- | src/ui/linkinfo.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ui/linkinfo.c b/src/ui/linkinfo.c index e800d6a3..36ab00c8 100644 --- a/src/ui/linkinfo.c +++ b/src/ui/linkinfo.c | |||
@@ -92,8 +92,12 @@ void infoText_LinkInfo(const iGmDocument *doc, iGmLinkId linkId, iString *text_o | |||
92 | appendRange_String(text_out, (iRangecc){ parts.path.start, constEnd_String(url) }); | 92 | appendRange_String(text_out, (iRangecc){ parts.path.start, constEnd_String(url) }); |
93 | } | 93 | } |
94 | else if (scheme != gemini_GmLinkScheme) { | 94 | else if (scheme != gemini_GmLinkScheme) { |
95 | const size_t maxDispLen = 300; | ||
95 | appendCStr_String(text_out, scheme == file_GmLinkScheme ? "" : globe_Icon " "); | 96 | appendCStr_String(text_out, scheme == file_GmLinkScheme ? "" : globe_Icon " "); |
96 | appendCStrN_String(text_out, cstr_String(url), iMin(500, size_String(url))); | 97 | appendCStrN_String(text_out, cstr_String(url), iMin(maxDispLen, size_String(url))); |
98 | if (size_String(url) > maxDispLen) { | ||
99 | appendCStr_String(text_out, "..."); | ||
100 | } | ||
97 | } | 101 | } |
98 | else { | 102 | else { |
99 | appendCStr_String(text_out, "\x1b[1m"); | 103 | appendCStr_String(text_out, "\x1b[1m"); |