diff options
author | Alison Winters <alisonatwork@outlook.com> | 2021-02-27 15:18:45 -0800 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-03-01 14:26:36 +0100 |
commit | 63d9da322f438a98bb654cc4976874fa89f1fa62 (patch) | |
tree | 694857920f5e31495f34048079bc6b7c69db4c09 | |
parent | 9b6bcfda0e11c0e73a966a77110f6c68425cff34 (diff) | |
download | busybox-63d9da322f438a98bb654cc4976874fa89f1fa62.tar.gz |
vi: restore 0 offset after :set noXXX command
Fixes bug where commands after the first noXXX command are ignored.
e.g. :set noic tabstop=4
While at it, stop recognizing "notabstop=NNN".
function old new delta
colon 2990 2965 -25
Signed-off-by: Alison Winters <alisonatwork@outlook.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | editors/vi.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/editors/vi.c b/editors/vi.c index 458ca6293..e77c348fb 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -2709,7 +2709,6 @@ static void colon(char *buf) # if ENABLE_FEATURE_VI_SETOPTS char *argp; # endif - i = 0; // offset into args // only blank is regarded as args delimiter. What about tab '\t'? if (!args[0] || strcasecmp(args, "all") == 0) { // print out values of all options @@ -2732,15 +2731,16 @@ static void colon(char *buf) # if ENABLE_FEATURE_VI_SETOPTS argp = args; while (*argp) { - if (strncmp(argp, "no", 2) == 0) - i = 2; // ":set noautoindent" + i = 0; + if (argp[0] == 'n' && argp[1] == 'o') // "noXXX" + i = 2; setops(argp, "autoindent ", i, "ai", VI_AUTOINDENT); setops(argp, "flash " , i, "fl", VI_ERR_METHOD); setops(argp, "ignorecase ", i, "ic", VI_IGNORECASE); setops(argp, "showmatch " , i, "sm", VI_SHOWMATCH ); - if (strncmp(argp + i, "tabstop=", 8) == 0) { + if (strncmp(argp, "tabstop=", 8) == 0) { int t = 0; - sscanf(argp + i+8, "%u", &t); + sscanf(argp + 8, "%u", &t); if (t > 0 && t <= MAX_TABSTOP) tabstop = t; } |