diff options
-rw-r--r-- | res/about/version.gmi | 3 | ||||
-rw-r--r-- | src/gmdocument.c | 10 | ||||
-rw-r--r-- | src/gmdocument.h | 1 | ||||
-rw-r--r-- | src/ui/documentwidget.c | 16 |
4 files changed, 26 insertions, 4 deletions
diff --git a/res/about/version.gmi b/res/about/version.gmi index f3d40e76..1b8e502a 100644 --- a/res/about/version.gmi +++ b/res/about/version.gmi | |||
@@ -7,11 +7,12 @@ | |||
7 | # Release notes | 7 | # Release notes |
8 | 8 | ||
9 | ## 0.10 | 9 | ## 0.10 |
10 | * Added option to load inline images when pressing Space or ↓. If an image link is visible, the image will be loaded instead of scrolling. This option is disabled by default. | 10 | * Added option to load inline images when pressing Space or ↓ for a more focused reading experience — just keep tapping on a single key to proceed. If an image link is visible, it will be loaded instead of scrolling. This option is disabled by default. |
11 | * Added an option to use a proxy server for Gemini requests. | 11 | * Added an option to use a proxy server for Gemini requests. |
12 | * Added a keybinding to activate keyboard link navigation mode (default is "F"). | 12 | * Added a keybinding to activate keyboard link navigation mode (default is "F"). |
13 | * Clearing and resetting keybindings via a context menu. | 13 | * Clearing and resetting keybindings via a context menu. |
14 | * Added a Window tab in the Preferences dialog; moved some of the settings around for better organization. | 14 | * Added a Window tab in the Preferences dialog; moved some of the settings around for better organization. |
15 | * Improved page search visualization: if the match is inside a link URL, the link icon is now highlighted. Previously these matches were not visualized in any way. | ||
15 | * Improvements to URI parsing with regard to RFC 3986. Cases that are handled better are double slashes, query-only relative URIs, relative URIs that begin with a tilde, IPv6 literals, username in the authority. | 16 | * Improvements to URI parsing with regard to RFC 3986. Cases that are handled better are double slashes, query-only relative URIs, relative URIs that begin with a tilde, IPv6 literals, username in the authority. |
16 | * Replaced EB Garamond with Tinos for improved readability. | 17 | * Replaced EB Garamond with Tinos for improved readability. |
17 | * Replaced Kosugi Maru with Noto Sans CJK JP for better glyph coverage. | 18 | * Replaced Kosugi Maru with Noto Sans CJK JP for better glyph coverage. |
diff --git a/src/gmdocument.c b/src/gmdocument.c index 62a0ba55..80ddfc9d 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c | |||
@@ -38,12 +38,14 @@ iDeclareType(GmLink) | |||
38 | 38 | ||
39 | struct Impl_GmLink { | 39 | struct Impl_GmLink { |
40 | iString url; | 40 | iString url; |
41 | iRangecc urlRange; /* URL in the source */ | ||
41 | iTime when; | 42 | iTime when; |
42 | int flags; | 43 | int flags; |
43 | }; | 44 | }; |
44 | 45 | ||
45 | void init_GmLink(iGmLink *d) { | 46 | void init_GmLink(iGmLink *d) { |
46 | init_String(&d->url); | 47 | init_String(&d->url); |
48 | d->urlRange = iNullRange; | ||
47 | iZap(d->when); | 49 | iZap(d->when); |
48 | d->flags = 0; | 50 | d->flags = 0; |
49 | } | 51 | } |
@@ -161,7 +163,8 @@ static iRangecc addLink_GmDocument_(iGmDocument *d, iRangecc line, iGmLinkId *li | |||
161 | init_RegExpMatch(&m); | 163 | init_RegExpMatch(&m); |
162 | if (matchRange_RegExp(pattern_, line, &m)) { | 164 | if (matchRange_RegExp(pattern_, line, &m)) { |
163 | iGmLink *link = new_GmLink(); | 165 | iGmLink *link = new_GmLink(); |
164 | setRange_String(&link->url, capturedRange_RegExpMatch(&m, 1)); | 166 | link->urlRange = capturedRange_RegExpMatch(&m, 1); |
167 | setRange_String(&link->url, link->urlRange); | ||
165 | set_String(&link->url, absoluteUrl_String(&d->url, &link->url)); | 168 | set_String(&link->url, absoluteUrl_String(&d->url, &link->url)); |
166 | /* Check the URL. */ { | 169 | /* Check the URL. */ { |
167 | iUrl parts; | 170 | iUrl parts; |
@@ -1296,6 +1299,11 @@ const iString *linkUrl_GmDocument(const iGmDocument *d, iGmLinkId linkId) { | |||
1296 | return link ? &link->url : NULL; | 1299 | return link ? &link->url : NULL; |
1297 | } | 1300 | } |
1298 | 1301 | ||
1302 | iRangecc linkUrlRange_GmDocument(const iGmDocument *d, iGmLinkId linkId) { | ||
1303 | const iGmLink *link = link_GmDocument_(d, linkId); | ||
1304 | return link->urlRange; | ||
1305 | } | ||
1306 | |||
1299 | int linkFlags_GmDocument(const iGmDocument *d, iGmLinkId linkId) { | 1307 | int linkFlags_GmDocument(const iGmDocument *d, iGmLinkId linkId) { |
1300 | const iGmLink *link = link_GmDocument_(d, linkId); | 1308 | const iGmLink *link = link_GmDocument_(d, linkId); |
1301 | return link ? link->flags : 0; | 1309 | return link ? link->flags : 0; |
diff --git a/src/gmdocument.h b/src/gmdocument.h index 84af3c98..5234f890 100644 --- a/src/gmdocument.h +++ b/src/gmdocument.h | |||
@@ -144,6 +144,7 @@ const iGmRun * findRun_GmDocument (const iGmDocument *, iInt2 pos); | |||
144 | const char * findLoc_GmDocument (const iGmDocument *, iInt2 pos); | 144 | const char * findLoc_GmDocument (const iGmDocument *, iInt2 pos); |
145 | const iGmRun * findRunAtLoc_GmDocument (const iGmDocument *, const char *loc); | 145 | const iGmRun * findRunAtLoc_GmDocument (const iGmDocument *, const char *loc); |
146 | const iString * linkUrl_GmDocument (const iGmDocument *, iGmLinkId linkId); | 146 | const iString * linkUrl_GmDocument (const iGmDocument *, iGmLinkId linkId); |
147 | iRangecc linkUrlRange_GmDocument (const iGmDocument *, iGmLinkId linkId); | ||
147 | iMediaId linkImage_GmDocument (const iGmDocument *, iGmLinkId linkId); | 148 | iMediaId linkImage_GmDocument (const iGmDocument *, iGmLinkId linkId); |
148 | iMediaId linkAudio_GmDocument (const iGmDocument *, iGmLinkId linkId); | 149 | iMediaId linkAudio_GmDocument (const iGmDocument *, iGmLinkId linkId); |
149 | int linkFlags_GmDocument (const iGmDocument *, iGmLinkId linkId); | 150 | int linkFlags_GmDocument (const iGmDocument *, iGmLinkId linkId); |
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index c3c0f527..b1c166aa 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -2274,14 +2274,26 @@ static void fillRange_DrawContext_(iDrawContext *d, const iGmRun *run, enum iCol | |||
2274 | else { | 2274 | else { |
2275 | *isInside = iTrue; /* at least until the next run */ | 2275 | *isInside = iTrue; /* at least until the next run */ |
2276 | } | 2276 | } |
2277 | if (w > width_Rect(run->visBounds) - x) { | 2277 | if (w > width_Rect(run->bounds) - x) { |
2278 | w = width_Rect(run->visBounds) - x; | 2278 | w = width_Rect(run->bounds) - x; |
2279 | } | 2279 | } |
2280 | const iInt2 visPos = | 2280 | const iInt2 visPos = |
2281 | add_I2(run->bounds.pos, addY_I2(d->viewPos, -value_Anim(&d->widget->scrollY))); | 2281 | add_I2(run->bounds.pos, addY_I2(d->viewPos, -value_Anim(&d->widget->scrollY))); |
2282 | fillRect_Paint(&d->paint, (iRect){ addX_I2(visPos, x), | 2282 | fillRect_Paint(&d->paint, (iRect){ addX_I2(visPos, x), |
2283 | init_I2(w, height_Rect(run->bounds)) }, color); | 2283 | init_I2(w, height_Rect(run->bounds)) }, color); |
2284 | } | 2284 | } |
2285 | /* Link URLs are not part of the visible document, so they are ignored above. Handle | ||
2286 | these ranges as a special case. */ | ||
2287 | if (run->linkId && run->flags & decoration_GmRunFlag) { | ||
2288 | const iRangecc url = linkUrlRange_GmDocument(d->widget->doc, run->linkId); | ||
2289 | if (contains_Range(&url, mark.start) && | ||
2290 | (contains_Range(&url, mark.end) || url.end == mark.end)) { | ||
2291 | fillRect_Paint( | ||
2292 | &d->paint, | ||
2293 | moved_Rect(run->visBounds, addY_I2(d->viewPos, -value_Anim(&d->widget->scrollY))), | ||
2294 | color); | ||
2295 | } | ||
2296 | } | ||
2285 | } | 2297 | } |
2286 | 2298 | ||
2287 | static void drawMark_DrawContext_(void *context, const iGmRun *run) { | 2299 | static void drawMark_DrawContext_(void *context, const iGmRun *run) { |