about summary refs log tree commit diff
path: root/edit.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2022-03-12 15:32:08 -0500
committerJune McEnroe <june@causal.agency>2022-03-12 15:34:50 -0500
commit6cdda636227b492d9ed606a3d7de22909d241c48 (patch)
tree0d79cf9dd5346d95dfe8de15029689e93124dbaa /edit.h
parentSeparate emacs key bindings (diff)
downloadcatgirl-6cdda636227b492d9ed606a3d7de22909d241c48.tar.gz
catgirl-6cdda636227b492d9ed606a3d7de22909d241c48.zip
Implement basic esc/i mode switching
Diffstat (limited to 'edit.h')
-rw-r--r--edit.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/edit.h b/edit.h
index db0d416..535b575 100644
--- a/edit.h
+++ b/edit.h
@@ -28,17 +28,18 @@
 #include <stdbool.h>
 #include <stddef.h>
 
-enum EditMode {
-	EditInsert,
-};
-
 struct Edit {
-	enum EditMode mode;
 	wchar_t *buf;
 	size_t pos;
 	size_t len;
 	size_t cap;
 	struct Edit *cut;
+	struct {
+		enum EditViMode {
+			EditViInsert,
+			EditViCommand,
+		} mode;
+	} vi;
 };
 
 enum EditFn {
@@ -63,6 +64,9 @@ enum EditFn {
 // Perform an editing function.
 int editFn(struct Edit *e, enum EditFn fn);
 
+// Perform a vi editing function.
+int editVi(struct Edit *e, wchar_t ch);
+
 // Insert a character at the cursor.
 int editInsert(struct Edit *e, wchar_t ch);