diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-01-11 08:31:11 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-01-11 08:31:11 +0200 |
commit | 964b9f752f086f58a6aae2602e83b30833412199 (patch) | |
tree | 94d9b6b6927e5df39ee78b9c456f9925c665372e /src/ui/documentwidget.c | |
parent | d52f3dfa2f81c9520b8ff1fdfe4adeac3907a7a4 (diff) |
Opening link in new tab via home row keys
Added a new keybinding for opening links via keyboard in new tab. The default binding is Shift+F.
The H key is now used for setting the hover link.
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r-- | src/ui/documentwidget.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 3373771d..8f2fc437 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -132,6 +132,7 @@ enum iDocumentWidgetFlag { | |||
132 | noHoverWhileScrolling_DocumentWidgetFlag = iBit(2), | 132 | noHoverWhileScrolling_DocumentWidgetFlag = iBit(2), |
133 | showLinkNumbers_DocumentWidgetFlag = iBit(3), | 133 | showLinkNumbers_DocumentWidgetFlag = iBit(3), |
134 | setHoverViaKeys_DocumentWidgetFlag = iBit(4), | 134 | setHoverViaKeys_DocumentWidgetFlag = iBit(4), |
135 | newTabViaHomeKeys_DocumentWidgetFlag = iBit(5), | ||
135 | }; | 136 | }; |
136 | 137 | ||
137 | enum iDocumentLinkOrdinalMode { | 138 | enum iDocumentLinkOrdinalMode { |
@@ -1789,6 +1790,8 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
1789 | iChangeFlags(d->flags, showLinkNumbers_DocumentWidgetFlag, iTrue); | 1790 | iChangeFlags(d->flags, showLinkNumbers_DocumentWidgetFlag, iTrue); |
1790 | iChangeFlags(d->flags, setHoverViaKeys_DocumentWidgetFlag, | 1791 | iChangeFlags(d->flags, setHoverViaKeys_DocumentWidgetFlag, |
1791 | argLabel_Command(cmd, "hover") != 0); | 1792 | argLabel_Command(cmd, "hover") != 0); |
1793 | iChangeFlags(d->flags, newTabViaHomeKeys_DocumentWidgetFlag, | ||
1794 | argLabel_Command(cmd, "newtab") != 0); | ||
1792 | } | 1795 | } |
1793 | invalidateVisibleLinks_DocumentWidget_(d); | 1796 | invalidateVisibleLinks_DocumentWidget_(d); |
1794 | refresh_Widget(d); | 1797 | refresh_Widget(d); |
@@ -2203,7 +2206,10 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
2203 | } | 2206 | } |
2204 | else { | 2207 | else { |
2205 | postCommandf_App("open newtab:%d url:%s", | 2208 | postCommandf_App("open newtab:%d url:%s", |
2206 | openTabMode_Sym(SDL_GetModState()), | 2209 | d->ordinalMode == |
2210 | numbersAndAlphabet_DocumentLinkOrdinalMode | ||
2211 | ? openTabMode_Sym(SDL_GetModState()) | ||
2212 | : (d->flags & newTabViaHomeKeys_DocumentWidgetFlag ? 1 : 0), | ||
2207 | cstr_String(absoluteUrl_String( | 2213 | cstr_String(absoluteUrl_String( |
2208 | d->mod.url, linkUrl_GmDocument(d->doc, run->linkId)))); | 2214 | d->mod.url, linkUrl_GmDocument(d->doc, run->linkId)))); |
2209 | } | 2215 | } |