diff options
author | Ron Yorston <rmy@pobox.com> | 2020-05-14 09:12:41 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2020-05-14 09:12:41 +0100 |
commit | 1d2a15e040b272155d3e40b597292a56de540e7d (patch) | |
tree | 434742eb6a06999214f4d81eadc88893021dc45d /shell/shell_common.c | |
parent | db46c292750493d2e98a21ec24a8a407fd8b3207 (diff) | |
download | busybox-w32-1d2a15e040b272155d3e40b597292a56de540e7d.tar.gz busybox-w32-1d2a15e040b272155d3e40b597292a56de540e7d.tar.bz2 busybox-w32-1d2a15e040b272155d3e40b597292a56de540e7d.zip |
ash: proper accounting for backspaces in the read builtin
When the '-n' option of the 'read' builtin is used we need to account
for backspaces: increase 'nchars' when backspace removes a character
from the buffer.
Diffstat (limited to 'shell/shell_common.c')
-rw-r--r-- | shell/shell_common.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/shell/shell_common.c b/shell/shell_common.c index 9092a8e2b..e50a79b78 100644 --- a/shell/shell_common.c +++ b/shell/shell_common.c | |||
@@ -248,6 +248,7 @@ shell_builtin_read(struct builtin_read_params *params) | |||
248 | else if (key == '\b') { | 248 | else if (key == '\b') { |
249 | if (bufpos > 0) { | 249 | if (bufpos > 0) { |
250 | --bufpos; | 250 | --bufpos; |
251 | ++nchars; | ||
251 | if (!(read_flags & BUILTIN_READ_SILENT)) { | 252 | if (!(read_flags & BUILTIN_READ_SILENT)) { |
252 | printf("\b \b"); | 253 | printf("\b \b"); |
253 | } | 254 | } |