summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.c5
-rw-r--r--src/ui/inputwidget.c10
-rw-r--r--src/ui/window.c6
3 files changed, 14 insertions, 7 deletions
diff --git a/src/app.c b/src/app.c
index 0916919e..347e3661 100644
--- a/src/app.c
+++ b/src/app.c
@@ -959,7 +959,7 @@ iBool handleCommand_App(const char *cmd) {
959 const iBool isDuplicate = argLabel_Command(cmd, "duplicate") != 0; 959 const iBool isDuplicate = argLabel_Command(cmd, "duplicate") != 0;
960 newTab_App(isDuplicate ? document_App() : NULL, iTrue); 960 newTab_App(isDuplicate ? document_App() : NULL, iTrue);
961 if (!isDuplicate) { 961 if (!isDuplicate) {
962 postCommand_App("navigate.home"); 962 postCommand_App("navigate.home focus:1");
963 } 963 }
964 return iTrue; 964 return iTrue;
965 } 965 }
@@ -1055,6 +1055,9 @@ iBool handleCommand_App(const char *cmd) {
1055 cstr_String(constAt_StringSet(urls, iRandoms(0, size_StringSet(urls))))); 1055 cstr_String(constAt_StringSet(urls, iRandoms(0, size_StringSet(urls)))));
1056 } 1056 }
1057 } 1057 }
1058 if (argLabel_Command(cmd, "focus")) {
1059 postCommand_App("navigate.focus");
1060 }
1058 return iTrue; 1061 return iTrue;
1059 } 1062 }
1060 else if (equal_Command(cmd, "bookmark.add")) { 1063 else if (equal_Command(cmd, "bookmark.add")) {
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c
index d29548f1..0fcca40a 100644
--- a/src/ui/inputwidget.c
+++ b/src/ui/inputwidget.c
@@ -181,8 +181,14 @@ void setText_InputWidget(iInputWidget *d, const iString *text) {
181 iConstForEach(String, i, text) { 181 iConstForEach(String, i, text) {
182 pushBack_Array(&d->text, &i.value); 182 pushBack_Array(&d->text, &i.value);
183 } 183 }
184 iZap(d->mark); 184 if (isFocused_Widget(d)) {
185 d->cursor = iMin(d->cursor, size_Array(&d->text)); 185 d->cursor = size_Array(&d->text);
186 selectAll_InputWidget(d);
187 }
188 else {
189 d->cursor = iMin(d->cursor, size_Array(&d->text));
190 iZap(d->mark);
191 }
186 refresh_Widget(as_Widget(d)); 192 refresh_Widget(as_Widget(d));
187} 193}
188 194
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;