diff options
author | Curtis McEnroe | 2018-09-12 22:55:02 -0400 |
---|---|---|
committer | Curtis McEnroe | 2018-09-12 22:55:02 -0400 |
commit | b36a1347022965fdbe1b61298dc6a05be2d2a34d (patch) | |
tree | b758829545252a09cac25ac7e89774faa36ae186 /edit.c | |
parent | 872608e5c4fb814604a359a4b8b2f3bcf317cf0f (diff) |
Use formatParse split to position input cursor
Diffstat (limited to 'edit.c')
-rw-r--r-- | edit.c | 11 |
1 files changed, 3 insertions, 8 deletions
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'; } |