From: Daniel Carl <danielcarl@gmx.de>
Date: Mon, 19 Nov 2012 19:45:07 +0000 (+0100)
Subject: Allow to go back to normal mode via ctrl-c too.
X-Git-Url: https://git.owens.tech/projects.html/projects.html/git?a=commitdiff_plain;h=1752e8f33dfa418dc392d0b4f4069524d488fed3;p=vimb.git

Allow to go back to normal mode via ctrl-c too.
---

diff --git a/src/keybind.c b/src/keybind.c
index fc87bd9..4f2cef3 100644
--- a/src/keybind.c
+++ b/src/keybind.c
@@ -205,7 +205,7 @@ static gboolean keybind_keypress_callback(WebKitWebView* webview, GdkEventKey* e
     guint state  = (event->state & modifiers);
 
     /* check for escape or modkeys or counts */
-    if (keyval == GDK_Escape && state == 0) {
+    if (IS_ESCAPE_KEY(keyval, state)) {
         completion_clean();
         /* switch to normal mode and clear the input box */
         Arg a = {VP_MODE_NORMAL, ""};
diff --git a/src/keybind.h b/src/keybind.h
index ef9db09..7dab1ee 100644
--- a/src/keybind.h
+++ b/src/keybind.h
@@ -20,6 +20,8 @@
 #ifndef KEYBIND_H
 #define KEYBIND_H
 
+#define IS_ESCAPE_KEY(k, s) ((k == GDK_Escape && s == 0) || (k == GDK_c && s == GDK_CONTROL_MASK))
+
 #include <gdk/gdkkeysyms.h>
 #include <gdk/gdkkeysyms-compat.h>