about summary refs log tree commit diff
path: root/edit.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--edit.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/edit.c b/edit.c
index 8db92fc..782f449 100644
--- a/edit.c
+++ b/edit.c
@@ -57,15 +57,12 @@ static void right(void) {
 
 static void backWord(void) {
 	left();
-	editHead();
-	wchar_t *word = wcsrchr(line.buf, ' ');
-	editTail();
+	wchar_t *word = wcsnrchr(line.buf, line.ptr - line.buf, L' ');
 	line.ptr = (word ? &word[1] : line.buf);
 }
 static void foreWord(void) {
 	right();
-	editTail();
-	wchar_t *word = wcschr(line.ptr, ' ');
+	wchar_t *word = wcsnchr(line.ptr, line.end - line.ptr, L' ');
 	line.ptr = (word ? word : line.end);
 }
 
@@ -108,12 +105,10 @@ static void killForeWord(void) {
 static char *prefix;
 static void complete(struct Tag tag) {
 	if (!line.tab) {
-		editHead();
-		line.tab = wcsrchr(line.buf, L' ');
+		line.tab = wcsnrchr(line.buf, line.ptr - line.buf, L' ');
 		line.tab = (line.tab ? &line.tab[1] : line.buf);
-		prefix = awcstombs(line.tab);
+		prefix = awcsntombs(line.tab, line.ptr - line.tab);
 		if (!prefix) err(EX_DATAERR, "awcstombs");
-		editTail();
 	}
 
 	const char *next = tabNext(tag, prefix);
@@ -161,7 +156,7 @@ static void reject(void) {
 
 static void enter(struct Tag tag) {
 	if (line.end == line.buf) return;
-	editTail();
+	*line.end = L'\0';
 	char *str = awcstombs(line.buf);
 	if (!str) err(EX_DATAERR, "awcstombs");
 	input(tag, str);
09-13Fix len for format->split at end of stringJune McEnroe 2018-09-13Avoid uninitialized x in uiReadJune McEnroe 2018-09-13Add IRCDefault to colors enumJune McEnroe 2018-09-13Return a format->split even at the end of the stringJune McEnroe 2018-09-13Fix weird tab-complete after commaJune McEnroe 2018-09-13Rewrite UI againJune McEnroe 2018-09-12Add note about C-oJune McEnroe 2018-09-12Use formatParse split to position input cursorJune McEnroe 2018-09-12Factor out IRC formatting parsingJune McEnroe 2018-09-11Add /help equivalent to /manJune McEnroe 2018-09-11Don't render every PM as a pingJune McEnroe 2018-09-11Add urlOpenMatchJune McEnroe 2018-09-10Depend on man.sh for chroot.tar targetJune McEnroe 2018-09-10Set LESSSECURE=1 in man.shJune McEnroe 2018-09-10Add /man commandJune McEnroe 2018-09-10Install man page in chrootJune McEnroe 2018-09-10Install man pageJune McEnroe 2018-09-10Split keys into subsections and document colorsJune McEnroe 2018-09-10Add "blank" lines to chatte.1June McEnroe 2018-09-10Document key bindings in chatte.1June McEnroe 2018-09-08Document slash commands in chatte.1June McEnroe