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>
This commit is contained in:
parent
9b6bcfda0e
commit
63d9da322f
10
editors/vi.c
10
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user