From 1786f114da644f93c325f9df952c7e17873b0091 Mon Sep 17 00:00:00 2001 From: Armaan Bhojwani Date: Sun, 6 Jun 2021 01:16:18 -0400 Subject: [PATCH] Improve 'location' binding under the hood --- browser.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/browser.c b/browser.c index b12a809..5731056 100644 --- 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)); -- 2.39.2