about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarco Peereboom <marco@conformal.com>2011-11-15 16:05:54 -0600
committerMarco Peereboom <marco@conformal.com>2011-11-15 16:05:54 -0600
commit02709f21fe7340b3204d2a9526a1f7f8f64855a2 (patch)
tree0e4e1c0e2ed0f79bfca47dfae94ce1b1800834a9
parent55cb23d9edabe5c3f1871c94b91b168a9fb5513e (diff)
downloadxombrero-02709f21fe7340b3204d2a9526a1f7f8f64855a2.tar.gz
add vi mode that eats ctrl/mod commands in input
-rw-r--r--settings.c6
-rw-r--r--xxxterm.c6
2 files changed, 9 insertions, 3 deletions
diff --git a/settings.c b/settings.c
index 9d524a2..cb4d1eb 100644
--- a/settings.c
+++ b/settings.c
@@ -969,7 +969,7 @@ set_tab_style(struct settings *s, char *val)
 char *
 get_edit_mode(struct settings *s)
 {
-	if (tab_style == XT_EM_HYBRID)
+	if (edit_mode == XT_EM_HYBRID)
 		return (g_strdup("hybrid"));
 	else
 		return (g_strdup("vi"));
@@ -979,9 +979,9 @@ int
 set_edit_mode(struct settings *s, char *val)
 {
 	if (!strcmp(val, "hybrid"))
-		tab_style = XT_EM_HYBRID;
+		edit_mode = XT_EM_HYBRID;
 	else if (!strcmp(val, "vi"))
-		tab_style = XT_EM_VI;
+		edit_mode = XT_EM_VI;
 	else
 		return (1);
 
diff --git a/xxxterm.c b/xxxterm.c
index 1a8d97b..d904bbf 100644
--- a/xxxterm.c
+++ b/xxxterm.c
@@ -4786,6 +4786,12 @@ handle_keypress(struct tab *t, GdkEventKey *e, int entry)
 		TAILQ_FOREACH(k, &kbl, entry)
 			if (e->keyval == k->key
 			    && (entry ? k->use_in_entry : 1)) {
+				/* when we are edditing eat ctrl/mod keys */
+				if (edit_mode == XT_EM_VI &&
+				    t->mode == XT_MODE_INSERT &&
+				    (e->state & CTRL || e->state & MOD1))
+					return (XT_CB_PASSTHROUGH);
+
 				if (k->mask == 0) {
 					if ((e->state & (CTRL | MOD1)) == 0)
 						return (cmd_execute(t, k->cmd));