From 17556517c68e070d6680de4a5cbf9b4d410aadda Mon Sep 17 00:00:00 2001
From: Daniel Carl <danielcarl@gmx.de>
Date: Fri, 21 Apr 2017 11:05:05 +0200
Subject: [PATCH] Clear input after load commited during search.

If a new page is opened during search, the search string was still
present in the input box even if the searching is paused in this case.
So now clear the input box and stop searching in case of a new page
load.
---
 src/command.c | 1 +
 src/main.c    | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/src/command.c b/src/command.c
index 4913ddc..fdea708 100644
--- a/src/command.c
+++ b/src/command.c
@@ -45,6 +45,7 @@ gboolean command_search(Client *c, const Arg *arg)
         c->state.search.matches = 0;
         c->state.search.active  = FALSE;
         vb_statusbar_update(c);
+        vb_echo(c, MSG_NORMAL, FALSE, "");
         return TRUE;
     }
 
diff --git a/src/main.c b/src/main.c
index 85b3c53..76b8779 100644
--- a/src/main.c
+++ b/src/main.c
@@ -28,6 +28,7 @@
 #include <webkit2/webkit2.h>
 
 #include "ascii.h"
+#include "command.h"
 #include "completion.h"
 #include "config.h"
 #include "ex.h"
@@ -1143,6 +1144,9 @@ static void on_webview_load_changed(WebKitWebView *webview,
             /* clear possible set marks */
             marks_clear(c);
 
+            /* Unset possible last search. */
+            command_search(c, &((Arg){0}));
+
             break;
 
         case WEBKIT_LOAD_FINISHED:
-- 
2.20.1