]> git.armaanb.net Git - chorizo.git/commitdiff
Improve 'location' binding under the hood
authorArmaan Bhojwani <me@armaanb.net>
Sun, 6 Jun 2021 05:16:18 +0000 (01:16 -0400)
committerArmaan Bhojwani <me@armaanb.net>
Sun, 6 Jun 2021 13:49:00 +0000 (09:49 -0400)
browser.c

index b12a809835004204716bab42618bdc8a7f2a6251..5731056992339696c2162cdbb4585dd3acc339ce 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -917,8 +917,10 @@ key_common(GtkWidget *widget, GdkEvent *event, gpointer data)
                                return TRUE;
                        } else if (def_key("location", GDK_KEY_t) == key) {
                                gtk_widget_grab_focus(c->location);
-                               gtk_entry_set_text(GTK_ENTRY(c->location),
-                                                                                                        webkit_web_view_get_uri(WEBKIT_WEB_VIEW(c->web_view)));
+                               const char *uri = webkit_web_view_get_uri(WEBKIT_WEB_VIEW(c->web_view));
+                               const char *goal = (uri) ? uri : "https://";
+                               gtk_entry_set_text(GTK_ENTRY(c->location), goal);
+                               gtk_editable_set_position(GTK_EDITABLE(c->location), -1);
                                return TRUE;
                        } else if (def_key("previous_tab", GDK_KEY_u) == key) {
                                gtk_notebook_prev_page(GTK_NOTEBOOK(mw.notebook));