From b36a1347022965fdbe1b61298dc6a05be2d2a34d Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Wed, 12 Sep 2018 22:55:02 -0400 Subject: Use formatParse split to position input cursor --- edit.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'edit.c') diff --git a/edit.c b/edit.c index 5aca61f..38ee843 100644 --- a/edit.c +++ b/edit.c @@ -33,17 +33,10 @@ static struct { .end = line.buf, }; -// XXX: editTail must always be called after editHead. -static wchar_t tail; const wchar_t *editHead(void) { - tail = *line.ptr; - *line.ptr = L'\0'; return line.buf; } const wchar_t *editTail(void) { - if (tail) *line.ptr = tail; - *line.end = L'\0'; - tail = L'\0'; return line.ptr; } @@ -180,10 +173,12 @@ void edit(struct Tag tag, enum Edit op, wchar_t ch) { break; case EditKillBackWord: reject(); killBackWord(); break; case EditKillForeWord: reject(); killForeWord(); - break; case EditKillLine: reject(); line.end = line.ptr; + break; case EditKillLine: reject(); line.end = line.ptr; break; case EditComplete: complete(tag); break; case EditEnter: accept(); enter(tag); } + + *line.end = L'\0'; } -- cgit 1.4.1-2-gfad0