about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2022-03-12 16:25:02 -0500
committerJune McEnroe <june@causal.agency>2022-03-12 16:25:02 -0500
commita1340f1d434c8ae3bb41b529b3bef6e641298096 (patch)
treef0219cca603f47f50fee2e296e1e9ac63ae76ea8
parentAdd edit option to set line editing mode (diff)
downloadcatgirl-a1340f1d434c8ae3bb41b529b3bef6e641298096.tar.gz
catgirl-a1340f1d434c8ae3bb41b529b3bef6e641298096.zip
Call editVi from input.c
-rw-r--r--input.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/input.c b/input.c
index 889bde7..abfc421 100644
--- a/input.c
+++ b/input.c
@@ -499,6 +499,7 @@ static void keyCtrl(wchar_t ch) {
 		break; case L'S': windowSearch(editString(edit, &buf, &cap, NULL), +1);
 		break; case L'V': windowScroll(ScrollPage, -1);
 		break; case L'X': error = macroExpand(edit); tabAccept();
+		break; default: if (inputMode == InputVi) error = editVi(edit, ch);
 	}
 	if (error) err(EX_OSERR, "editFn");
 }
@@ -586,9 +587,12 @@ void inputRead(void) {
 		} else if (iswcntrl(ch)) {
 			tabbing = (ch == (L'I' ^ L'@'));
 			keyCtrl(ch);
-		} else {
+		} else if (inputMode == InputEmacs) {
 			int error = editInsert(&edits[windowID()], ch);
 			if (error) err(EX_OSERR, "editInsert");
+		} else if (inputMode == InputVi) {
+			int error = editVi(&edits[windowID()], ch);
+			if (error) err(EX_OSERR, "editVi");
 		}
 		style = false;
 		literal = false;