aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlison Winters <alisonatwork@outlook.com>2021-02-27 15:18:45 -0800
committerDenys Vlasenko <vda.linux@googlemail.com>2021-03-01 14:26:36 +0100
commit63d9da322f438a98bb654cc4976874fa89f1fa62 (patch)
tree694857920f5e31495f34048079bc6b7c69db4c09
parent9b6bcfda0e11c0e73a966a77110f6c68425cff34 (diff)
downloadbusybox-w32-63d9da322f438a98bb654cc4976874fa89f1fa62.tar.gz
busybox-w32-63d9da322f438a98bb654cc4976874fa89f1fa62.tar.bz2
busybox-w32-63d9da322f438a98bb654cc4976874fa89f1fa62.zip
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.c10
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)
2709# if ENABLE_FEATURE_VI_SETOPTS 2709# if ENABLE_FEATURE_VI_SETOPTS
2710 char *argp; 2710 char *argp;
2711# endif 2711# endif
2712 i = 0; // offset into args
2713 // only blank is regarded as args delimiter. What about tab '\t'? 2712 // only blank is regarded as args delimiter. What about tab '\t'?
2714 if (!args[0] || strcasecmp(args, "all") == 0) { 2713 if (!args[0] || strcasecmp(args, "all") == 0) {
2715 // print out values of all options 2714 // print out values of all options
@@ -2732,15 +2731,16 @@ static void colon(char *buf)
2732# if ENABLE_FEATURE_VI_SETOPTS 2731# if ENABLE_FEATURE_VI_SETOPTS
2733 argp = args; 2732 argp = args;
2734 while (*argp) { 2733 while (*argp) {
2735 if (strncmp(argp, "no", 2) == 0) 2734 i = 0;
2736 i = 2; // ":set noautoindent" 2735 if (argp[0] == 'n' && argp[1] == 'o') // "noXXX"
2736 i = 2;
2737 setops(argp, "autoindent ", i, "ai", VI_AUTOINDENT); 2737 setops(argp, "autoindent ", i, "ai", VI_AUTOINDENT);
2738 setops(argp, "flash " , i, "fl", VI_ERR_METHOD); 2738 setops(argp, "flash " , i, "fl", VI_ERR_METHOD);
2739 setops(argp, "ignorecase ", i, "ic", VI_IGNORECASE); 2739 setops(argp, "ignorecase ", i, "ic", VI_IGNORECASE);
2740 setops(argp, "showmatch " , i, "sm", VI_SHOWMATCH ); 2740 setops(argp, "showmatch " , i, "sm", VI_SHOWMATCH );
2741 if (strncmp(argp + i, "tabstop=", 8) == 0) { 2741 if (strncmp(argp, "tabstop=", 8) == 0) {
2742 int t = 0; 2742 int t = 0;
2743 sscanf(argp + i+8, "%u", &t); 2743 sscanf(argp + 8, "%u", &t);
2744 if (t > 0 && t <= MAX_TABSTOP) 2744 if (t > 0 && t <= MAX_TABSTOP)
2745 tabstop = t; 2745 tabstop = t;
2746 } 2746 }