diff options
author | Ron Yorston <rmy@pobox.com> | 2022-04-20 09:23:30 +0100 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2022-04-20 16:06:04 +0200 |
commit | c93eb1a95b1f06c145d4169a8776a318a2085e8b (patch) | |
tree | 85d6d038e6871ab65fae32323cd8f45bc079b2ac | |
parent | 57fea029cc3d6faf5a8b9ad4b17b543359fe7ccb (diff) | |
download | busybox-w32-c93eb1a95b1f06c145d4169a8776a318a2085e8b.tar.gz busybox-w32-c93eb1a95b1f06c145d4169a8776a318a2085e8b.tar.bz2 busybox-w32-c93eb1a95b1f06c145d4169a8776a318a2085e8b.zip |
vi: fix backspace over tab in commands
Colon and search commands are entered on the status line. Since
the cursor position wasn't being tracked backspacing over a tab
resulted in a mismatch between the actual and apparent content
of the command.
function old new delta
get_input_line 178 180 +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 2/0) Total: 2 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-rw-r--r-- | editors/vi.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/editors/vi.c b/editors/vi.c index 4257c0fdc..6fa0a4e18 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -1217,10 +1217,11 @@ static char *get_input_line(const char *prompt) | |||
1217 | break; // this is end of input | 1217 | break; // this is end of input |
1218 | if (isbackspace(c)) { | 1218 | if (isbackspace(c)) { |
1219 | // user wants to erase prev char | 1219 | // user wants to erase prev char |
1220 | write1("\b \b"); // erase char on screen | ||
1221 | buf[--i] = '\0'; | 1220 | buf[--i] = '\0'; |
1221 | go_bottom_and_clear_to_eol(); | ||
1222 | if (i <= 0) // user backs up before b-o-l, exit | 1222 | if (i <= 0) // user backs up before b-o-l, exit |
1223 | break; | 1223 | break; |
1224 | write1(buf); | ||
1224 | } else if (c > 0 && c < 256) { // exclude Unicode | 1225 | } else if (c > 0 && c < 256) { // exclude Unicode |
1225 | // (TODO: need to handle Unicode) | 1226 | // (TODO: need to handle Unicode) |
1226 | buf[i] = c; | 1227 | buf[i] = c; |