From: Daniel Carl <danielcarl@gmx.de>
Date: Thu, 21 Feb 2013 21:03:59 +0000 (+0100)
Subject: Fixed wrong mode if new window was opened.
X-Git-Url: https://git.owens.tech/dummy.html/dummy.html/git?a=commitdiff_plain;h=a56cc0ec804b4481f6dfc1706d6bc8151d280fe9;p=vimb.git

Fixed wrong mode if new window was opened.

If there was opened a uri into a new window the first window kept in command
mode. This caused that the normal mode keybindings did not work until <esc>
was pressed.
---

diff --git a/src/main.c b/src/main.c
index fa47b68..c6cc1e4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -327,6 +327,10 @@ gboolean vp_load_uri(const Arg* arg)
     } else {
         uri = g_strrstr(path, "://") ? g_strdup(path) : g_strdup_printf("http://%s", path);
     }
+
+    /* change state to normal mode */
+    vp_set_mode(VP_MODE_NORMAL, FALSE);
+
     if (arg->i == VP_TARGET_NEW) {
         char *argv[64];
 
@@ -346,9 +350,6 @@ gboolean vp_load_uri(const Arg* arg)
         /* spawn a new browser instance */
         g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
     } else {
-        /* change state to normal mode */
-        vp_set_mode(VP_MODE_NORMAL, FALSE);
-
         /* Load a web page into the browser instance */
         webkit_web_view_load_uri(vp.gui.webview, uri);
     }