summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ui/documentwidget.c21
-rw-r--r--src/ui/keys.c1
2 files changed, 22 insertions, 0 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 40f34db4..8640e7ae 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -228,6 +228,7 @@ void init_DocumentWidget(iDocumentWidget *d) {
228 addAction_Widget(w, navigateForward_KeyShortcut, "navigate.forward"); 228 addAction_Widget(w, navigateForward_KeyShortcut, "navigate.forward");
229 addAction_Widget(w, navigateParent_KeyShortcut, "navigate.parent"); 229 addAction_Widget(w, navigateParent_KeyShortcut, "navigate.parent");
230 addAction_Widget(w, navigateRoot_KeyShortcut, "navigate.root"); 230 addAction_Widget(w, navigateRoot_KeyShortcut, "navigate.root");
231 addAction_Widget(w, 'f', 0, "document.linkkeys");
231} 232}
232 233
233void deinit_DocumentWidget(iDocumentWidget *d) { 234void deinit_DocumentWidget(iDocumentWidget *d) {
@@ -965,6 +966,11 @@ static void refreshWhileScrolling_DocumentWidget_(iAny *ptr) {
965} 966}
966 967
967static void smoothScroll_DocumentWidget_(iDocumentWidget *d, int offset, int duration) { 968static void smoothScroll_DocumentWidget_(iDocumentWidget *d, int offset, int duration) {
969 /* Get rid of link numbers when scrolling. */
970 if (offset && d->flags & showLinkNumbers_DocumentWidgetFlag) {
971 d->flags &= ~showLinkNumbers_DocumentWidgetFlag;
972 invalidate_DocumentWidget_(d);
973 }
968 if (!prefs_App()->smoothScrolling) { 974 if (!prefs_App()->smoothScrolling) {
969 duration = 0; /* always instant */ 975 duration = 0; /* always instant */
970 } 976 }
@@ -1520,6 +1526,12 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)
1520 fetch_DocumentWidget_(d); 1526 fetch_DocumentWidget_(d);
1521 return iTrue; 1527 return iTrue;
1522 } 1528 }
1529 else if (equal_Command(cmd, "document.linkkeys") && document_App() == d) {
1530 iChangeFlags(d->flags, showLinkNumbers_DocumentWidgetFlag, iTrue);
1531 invalidate_DocumentWidget_(d);
1532 refresh_Widget(d);
1533 return iTrue;
1534 }
1523 else if (equal_Command(cmd, "navigate.back") && document_App() == d) { 1535 else if (equal_Command(cmd, "navigate.back") && document_App() == d) {
1524 goBack_History(d->mod.history); 1536 goBack_History(d->mod.history);
1525 return iTrue; 1537 return iTrue;
@@ -1868,11 +1880,20 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e
1868 : 0, 1880 : 0,
1869 cstr_String(absoluteUrl_String( 1881 cstr_String(absoluteUrl_String(
1870 d->mod.url, linkUrl_GmDocument(d->doc, run->linkId)))); 1882 d->mod.url, linkUrl_GmDocument(d->doc, run->linkId))));
1883 iChangeFlags(d->flags, showLinkNumbers_DocumentWidgetFlag, iFalse);
1871 return iTrue; 1884 return iTrue;
1872 } 1885 }
1873 } 1886 }
1874 } 1887 }
1875 switch (key) { 1888 switch (key) {
1889 case SDLK_ESCAPE:
1890 if (d->flags & showLinkNumbers_DocumentWidgetFlag && document_App() == d) {
1891 iChangeFlags(d->flags, showLinkNumbers_DocumentWidgetFlag, iFalse);
1892 invalidate_DocumentWidget_(d);
1893 refresh_Widget(d);
1894 return iTrue;
1895 }
1896 break;
1876 case SDLK_LALT: 1897 case SDLK_LALT:
1877 case SDLK_RALT: 1898 case SDLK_RALT:
1878 if (document_App() == d) { 1899 if (document_App() == d) {
diff --git a/src/ui/keys.c b/src/ui/keys.c
index 98a28825..6d68cc57 100644
--- a/src/ui/keys.c
+++ b/src/ui/keys.c
@@ -69,6 +69,7 @@ static void bindDefaults_(void) {
69 bindLabel_Keys(31, "navigate.forward", navigateForward_KeyShortcut, "Go forward"); 69 bindLabel_Keys(31, "navigate.forward", navigateForward_KeyShortcut, "Go forward");
70 bindLabel_Keys(32, "navigate.parent", navigateParent_KeyShortcut, "Go to parent directory"); 70 bindLabel_Keys(32, "navigate.parent", navigateParent_KeyShortcut, "Go to parent directory");
71 bindLabel_Keys(33, "navigate.root", navigateRoot_KeyShortcut, "Go to site root"); 71 bindLabel_Keys(33, "navigate.root", navigateRoot_KeyShortcut, "Go to site root");
72 bindLabel_Keys(40, "document.linkkeys", 'f', 0, "Open link via keyboard");
72 /* The following cannot currently be changed (built-in duplicates). */ 73 /* The following cannot currently be changed (built-in duplicates). */
73 bind_Keys(1000, "scroll.page arg:-1", SDLK_SPACE, KMOD_SHIFT); 74 bind_Keys(1000, "scroll.page arg:-1", SDLK_SPACE, KMOD_SHIFT);
74 bind_Keys(1001, "scroll.page arg:1", SDLK_SPACE, 0); 75 bind_Keys(1001, "scroll.page arg:1", SDLK_SPACE, 0);