From: Benjamin Petrenko <benjamin.petrenko@gmail.com>
Date: Sat, 18 Jul 2015 07:48:32 +0000 (+0300)
Subject: ESC deselects
X-Git-Url: https://git.owens.tech/assets/editable-focus.html/assets/editable-focus.html/git?a=commitdiff_plain;h=fa122ea51d2571d1bbd3535ea0936713bbd6a1ac;p=vimb.git

ESC deselects
---

diff --git a/src/normal.c b/src/normal.c
index f1f1be8..9d11c26 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -336,6 +336,14 @@ VbResult pass_keypress(int key)
 
 static VbResult normal_clear_input(const NormalCmdInfo *info)
 {
+    /* if there's a text selection, deselect it */
+    char *clipboard_text = gtk_clipboard_wait_for_text(PRIMARY_CLIPBOARD());
+    gtk_clipboard_clear(PRIMARY_CLIPBOARD());
+    if (clipboard_text) {
+        gtk_clipboard_set_text(PRIMARY_CLIPBOARD(), clipboard_text, -1);
+    }
+    g_free(clipboard_text);
+
     gtk_widget_grab_focus(GTK_WIDGET(vb.gui.webview));
     vb_echo(VB_MSG_NORMAL, false, "");
     command_search(&((Arg){0}));