summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-01-26 07:34:39 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-01-26 07:34:39 +0200
commit85ccb7e82dc080e033d7aee621b53651aaa457e7 (patch)
tree65c05dedceb1de9ed95c52469ad2c643d63504a7 /src/ui
parentc5668c7eb7004cb4edad0cb3a18422bf81a64c19 (diff)
parent37fefc85a9a23be7c3bc6dcddb8a30047459f534 (diff)
Merge branch 'pullrequests/Br0000k/dev' into dev
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/documentwidget.c2
-rw-r--r--src/ui/inputwidget.c10
-rw-r--r--src/ui/keys.c3
-rw-r--r--src/ui/keys.h4
4 files changed, 18 insertions, 1 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index c725a8f6..68f3c966 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -253,7 +253,7 @@ void init_DocumentWidget(iDocumentWidget *d) {
253 resizeToParentWidth_WidgetFlag | resizeToParentHeight_WidgetFlag); 253 resizeToParentWidth_WidgetFlag | resizeToParentHeight_WidgetFlag);
254#if !defined (iPlatformApple) /* in system menu */ 254#if !defined (iPlatformApple) /* in system menu */
255 addAction_Widget(w, reload_KeyShortcut, "navigate.reload"); 255 addAction_Widget(w, reload_KeyShortcut, "navigate.reload");
256 addAction_Widget(w, SDLK_w, KMOD_PRIMARY, "tabs.close"); 256 addAction_Widget(w, closeTab_KeyShortcut, "tabs.close");
257 addAction_Widget(w, SDLK_d, KMOD_PRIMARY, "bookmark.add"); 257 addAction_Widget(w, SDLK_d, KMOD_PRIMARY, "bookmark.add");
258 addAction_Widget(w, subscribeToPage_KeyModifier, "feeds.subscribe"); 258 addAction_Widget(w, subscribeToPage_KeyModifier, "feeds.subscribe");
259#endif 259#endif
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c
index 6992bbec..62f0341e 100644
--- a/src/ui/inputwidget.c
+++ b/src/ui/inputwidget.c
@@ -224,6 +224,16 @@ static void updateBuffered_InputWidget_(iInputWidget *d) {
224} 224}
225 225
226void setText_InputWidget(iInputWidget *d, const iString *text) { 226void setText_InputWidget(iInputWidget *d, const iString *text) {
227 if (d->inFlags & isUrl_InputWidgetFlag) {
228 /* If user wants URLs encoded, also Punycode the domain. */
229 if (!prefs_App()->decodeUserVisibleURLs) {
230 iString *enc = collect_String(copy_String(text));
231 /* Prevent address bar spoofing (mentioned as IDN homograph attack in
232 https://github.com/skyjake/lagrange/issues/73) */
233 punyEncodeUrlHost_String(enc);
234 text = enc;
235 }
236 }
227 clearUndo_InputWidget_(d); 237 clearUndo_InputWidget_(d);
228 clear_Array(&d->text); 238 clear_Array(&d->text);
229 iConstForEach(String, i, text) { 239 iConstForEach(String, i, text) {
diff --git a/src/ui/keys.c b/src/ui/keys.c
index ec681b6f..656a52ac 100644
--- a/src/ui/keys.c
+++ b/src/ui/keys.c
@@ -80,9 +80,12 @@ static const struct { int id; iMenuItem bind; int flags; } defaultBindings_[] =
80 { 45, { "Open link in new tab via home row keys", 'f', KMOD_SHIFT, "document.linkkeys arg:1 newtab:1" }, 0 }, 80 { 45, { "Open link in new tab via home row keys", 'f', KMOD_SHIFT, "document.linkkeys arg:1 newtab:1" }, 0 },
81 { 46, { "Hover on link via home row keys", 'h', 0, "document.linkkeys arg:1 hover:1" }, 0 }, 81 { 46, { "Hover on link via home row keys", 'h', 0, "document.linkkeys arg:1 hover:1" }, 0 },
82 { 47, { "Next set of home row key links", '.', 0, "document.linkkeys more:1" }, 0 }, 82 { 47, { "Next set of home row key links", '.', 0, "document.linkkeys more:1" }, 0 },
83 { 50, { "Add bookmark", 'd', KMOD_PRIMARY, "bookmark.add" }, 0 },
83 { 70, { "Zoom in", SDLK_EQUALS, KMOD_PRIMARY, "zoom.delta arg:10" }, 0 }, 84 { 70, { "Zoom in", SDLK_EQUALS, KMOD_PRIMARY, "zoom.delta arg:10" }, 0 },
84 { 71, { "Zoom out", SDLK_MINUS, KMOD_PRIMARY, "zoom.delta arg:-10" }, 0 }, 85 { 71, { "Zoom out", SDLK_MINUS, KMOD_PRIMARY, "zoom.delta arg:-10" }, 0 },
85 { 72, { "Reset zoom", SDLK_0, KMOD_PRIMARY, "zoom.set arg:100" }, 0 }, 86 { 72, { "Reset zoom", SDLK_0, KMOD_PRIMARY, "zoom.set arg:100" }, 0 },
87 { 76, { "New tab", newTab_KeyShortcut, "tabs.new" }, 0 },
88 { 77, { "Close tab", closeTab_KeyShortcut, "tabs.close" }, 0 },
86 { 80, { "Previous tab", prevTab_KeyShortcut, "tabs.prev" }, 0 }, 89 { 80, { "Previous tab", prevTab_KeyShortcut, "tabs.prev" }, 0 },
87 { 81, { "Next tab", nextTab_KeyShortcut, "tabs.next" }, 0 }, 90 { 81, { "Next tab", nextTab_KeyShortcut, "tabs.next" }, 0 },
88 { 100,{ "Toggle show URL on hover", '/', KMOD_PRIMARY, "prefs.hoverlink.toggle" }, 0 }, 91 { 100,{ "Toggle show URL on hover", '/', KMOD_PRIMARY, "prefs.hoverlink.toggle" }, 0 },
diff --git a/src/ui/keys.h b/src/ui/keys.h
index 8bcd4f53..f6f0b465 100644
--- a/src/ui/keys.h
+++ b/src/ui/keys.h
@@ -28,6 +28,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28 28
29#if defined (iPlatformApple) 29#if defined (iPlatformApple)
30# define reload_KeyShortcut SDLK_r, KMOD_PRIMARY 30# define reload_KeyShortcut SDLK_r, KMOD_PRIMARY
31# define newTab_KeyShortcut SDLK_t, KMOD_PRIMARY
32# define closeTab_KeyShortcut SDLK_w, KMOD_PRIMARY
31# define prevTab_KeyShortcut SDLK_LEFTBRACKET, KMOD_SHIFT | KMOD_PRIMARY 33# define prevTab_KeyShortcut SDLK_LEFTBRACKET, KMOD_SHIFT | KMOD_PRIMARY
32# define nextTab_KeyShortcut SDLK_RIGHTBRACKET, KMOD_SHIFT | KMOD_PRIMARY 34# define nextTab_KeyShortcut SDLK_RIGHTBRACKET, KMOD_SHIFT | KMOD_PRIMARY
33# define navigateBack_KeyShortcut SDLK_LEFT, KMOD_PRIMARY 35# define navigateBack_KeyShortcut SDLK_LEFT, KMOD_PRIMARY
@@ -40,6 +42,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
40# define subscribeToPage_KeyModifier SDLK_d, KMOD_SHIFT | KMOD_PRIMARY 42# define subscribeToPage_KeyModifier SDLK_d, KMOD_SHIFT | KMOD_PRIMARY
41#else 43#else
42# define reload_KeyShortcut SDLK_r, KMOD_PRIMARY 44# define reload_KeyShortcut SDLK_r, KMOD_PRIMARY
45# define newTab_KeyShortcut SDLK_t, KMOD_PRIMARY
46# define closeTab_KeyShortcut SDLK_w, KMOD_PRIMARY
43# define prevTab_KeyShortcut SDLK_PAGEUP, KMOD_PRIMARY 47# define prevTab_KeyShortcut SDLK_PAGEUP, KMOD_PRIMARY
44# define nextTab_KeyShortcut SDLK_PAGEDOWN, KMOD_PRIMARY 48# define nextTab_KeyShortcut SDLK_PAGEDOWN, KMOD_PRIMARY
45# define navigateBack_KeyShortcut SDLK_LEFT, KMOD_ALT 49# define navigateBack_KeyShortcut SDLK_LEFT, KMOD_ALT