diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-10-11 08:15:03 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-10-11 08:15:03 +0300 |
commit | 463174066a2490522afc9b4dc95efeffbc498354 (patch) | |
tree | f90aa69ba3473a9adf76f91f895d95c9144f49d6 /src/ui/window.c | |
parent | a4bb1b093e1a452831b55dc40efb38c5479b13b5 (diff) |
Focus behavior of the URL entry field
Opening a new tab will now set input focus to the URL field.
Switching tabs when the URL field is focused will select the full new URL.
There was an issue previously where selecting a bookmark while the URL field was focused would cause unexpected behavior. The URL was first unfocused and that would trigger the document to fetch the URL that was in the input field.
Diffstat (limited to 'src/ui/window.c')
-rw-r--r-- | src/ui/window.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/ui/window.c b/src/ui/window.c index b90b2b55..41d8078f 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -236,7 +236,8 @@ static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) { | |||
236 | setText_InputWidget(url, url_DocumentWidget(document_App())); | 236 | setText_InputWidget(url, url_DocumentWidget(document_App())); |
237 | return iTrue; | 237 | return iTrue; |
238 | } | 238 | } |
239 | if (arg_Command(cmd) && !isFocused_Widget(findWidget_App("lookup"))) { | 239 | if (arg_Command(cmd) && argLabel_Command(cmd, "enter") && |
240 | !isFocused_Widget(findWidget_App("lookup"))) { | ||
240 | postCommandf_App( | 241 | postCommandf_App( |
241 | "open url:%s", | 242 | "open url:%s", |
242 | cstr_String(absoluteUrl_String(&iStringLiteral(""), text_InputWidget(url)))); | 243 | cstr_String(absoluteUrl_String(&iStringLiteral(""), text_InputWidget(url)))); |
@@ -261,9 +262,6 @@ static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) { | |||
261 | } | 262 | } |
262 | else if (equal_Command(cmd, "document.request.started")) { | 263 | else if (equal_Command(cmd, "document.request.started")) { |
263 | iInputWidget *url = findChild_Widget(navBar, "url"); | 264 | iInputWidget *url = findChild_Widget(navBar, "url"); |
264 | if (isFocused_Widget(as_Widget(url))) { | ||
265 | setFocus_Widget(NULL); | ||
266 | } | ||
267 | setTextCStr_InputWidget(url, suffixPtr_Command(cmd, "url")); | 265 | setTextCStr_InputWidget(url, suffixPtr_Command(cmd, "url")); |
268 | updateTextCStr_LabelWidget(reloadButton, stopCStr_); | 266 | updateTextCStr_LabelWidget(reloadButton, stopCStr_); |
269 | return iFalse; | 267 | return iFalse; |