about summary refs log tree commit diff
path: root/edit.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-09 04:20:07 -0500
committerJune McEnroe <june@causal.agency>2020-02-09 04:20:07 -0500
commitb08c2d03efa08bd319a0665d12bef34df08ab283 (patch)
treeb880a35e71127ad3165159df2b53888b2273fc6e /edit.c
parentAdd C-k (diff)
downloadcatgirl-b08c2d03efa08bd319a0665d12bef34df08ab283.tar.gz
catgirl-b08c2d03efa08bd319a0665d12bef34df08ab283.zip
Add M-b and M-f
Diffstat (limited to '')
-rw-r--r--edit.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/edit.c b/edit.c
index 7fcff40..38b2dea 100644
--- a/edit.c
+++ b/edit.c
@@ -137,6 +137,14 @@ void edit(size_t id, enum Edit op, wchar_t ch) {
 		break; case EditTail: pos = len;
 		break; case EditPrev: if (pos) pos--;
 		break; case EditNext: if (pos < len) pos++;
+		break; case EditPrevWord: {
+			if (pos) pos--;
+			while (pos && buf[pos - 1] != L' ') pos--;
+		}
+		break; case EditNextWord: {
+			if (pos < len) pos++;
+			while (pos < len && buf[pos] != L' ') pos++;
+		}
 
 		break; case EditDeletePrev: if (pos) delete(--pos, 1);
 		break; case EditDeleteNext: delete(pos, 1);