summary refs log tree commit diff
path: root/edit.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--edit.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/edit.c b/edit.c
index 16fa910..fe79e76 100644
--- a/edit.c
+++ b/edit.c
@@ -20,6 +20,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <wchar.h>
+#include <wctype.h>
 
 #include "chat.h"
 
@@ -150,11 +151,11 @@ void edit(size_t id, enum Edit op, wchar_t ch) {
 		break; case EditNext: if (pos < len) pos++;
 		break; case EditPrevWord: {
 			if (pos) pos--;
-			while (pos && buf[pos - 1] != L' ') pos--;
+			while (pos && !iswspace(buf[pos - 1])) pos--;
 		}
 		break; case EditNextWord: {
 			if (pos < len) pos++;
-			while (pos < len && buf[pos] != L' ') pos++;
+			while (pos < len && !iswspace(buf[pos])) pos++;
 		}
 
 		break; case EditDeleteHead: delete(0, pos); pos = 0;
@@ -164,14 +165,14 @@ void edit(size_t id, enum Edit op, wchar_t ch) {
 		break; case EditDeletePrevWord: {
 			if (!pos) break;
 			size_t word = pos - 1;
-			while (word && buf[word - 1] != L' ') word--;
+			while (word && !iswspace(buf[word - 1])) word--;
 			delete(word, pos - word);
 			pos = word;
 		}
 		break; case EditDeleteNextWord: {
 			if (pos == len) break;
 			size_t word = pos + 1;
-			while (word < len && buf[word] != L' ') word++;
+			while (word < len && !iswspace(buf[word])) word++;
 			delete(pos, word - pos);
 		}
 		break; case EditPaste: {
-0500'>2021-01-19Escape \ and / in mtags search patternsJune McEnroe 2021-01-20Use mtags in source-filterJune McEnroe 2021-01-19Add mtags to generate tags for make and mdocJune McEnroe 2021-01-19Map tags to IDs using only [[:alnum:]-._]June McEnroe 2021-01-19Don't use a pager if reading standard inputJune McEnroe 2021-01-19Support BSD make syntax and match *.amJune McEnroe These don't really go together, but... 2021-01-19Match tab following escaped newline in make assignmentsJune McEnroe Otherwise it ends up going into Shell state. 2021-01-18Allow matching lexers using first input lineJune McEnroe