about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-09 07:32:35 -0500
committerJune McEnroe <june@causal.agency>2020-02-09 07:32:35 -0500
commit02ca8e972bbf1b3a5b66df9ba0bd0e77903ba6d8 (patch)
tree976223c3cace260f06b415a376f15b82414019a0
parentAdd C-y (diff)
downloadcatgirl-02ca8e972bbf1b3a5b66df9ba0bd0e77903ba6d8.tar.gz
catgirl-02ca8e972bbf1b3a5b66df9ba0bd0e77903ba6d8.zip
Use iswspace for word movement
-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: {
> 2024-06-30Accommodate lower-case .jpg filesJune McEnroe 2024-06-23Add another BACKXWASH showJune McEnroe It was good! 2024-06-16Update bioJune McEnroe 2024-06-15Add photo descriptions from June 12June McEnroe 2024-06-10Add first roll of film from June 8June McEnroe 2024-06-10Cope with not having an EXIF infoJune McEnroe 2024-06-10Resize using target pixel counts for consistencyJune McEnroe This will resize film scans to about the same size as for the digital photos. 2024-06-10Add The Girl Who Was Convinced...June McEnroe Not much there. The illustrations are very nice though. 2024-06-09Add photos from May 31June McEnroe 2024-06-09Use monospace on photo pagesJune McEnroe 2024-06-09Put lens and (future) film at the tops of photo pagesJune McEnroe 2024-05-22Remove use of sysexits.hJune McEnroe 2024-05-22Add photo descriptions from 05-03 and 05-06June McEnroe 2024-05-21Fix = precedence in whenJune McEnroe