diff options
-rw-r--r-- | src/nvim/ex_docmd.c | 6 | ||||
-rw-r--r-- | src/nvim/ex_getln.c | 2 | ||||
-rw-r--r-- | src/nvim/option.c | 3 | ||||
-rw-r--r-- | test/functional/ui/wildmode_spec.lua | 21 |
4 files changed, 27 insertions, 5 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 72b2e0f29b..108b7483b9 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -2687,7 +2687,7 @@ const char * set_one_cmd_context( // 2. skip comment lines and leading space, colons or bars const char *cmd; - for (cmd = buff; strchr(" \t:|", *cmd) != NULL; cmd++) { + for (cmd = buff; vim_strchr((const char_u *)" \t:|", *cmd) != NULL; cmd++) { } xp->xp_pattern = (char_u *)cmd; @@ -2748,7 +2748,7 @@ const char * set_one_cmd_context( } } // check for non-alpha command - if (p == cmd && strchr("@*!=><&~#", *p) != NULL) { + if (p == cmd && vim_strchr((const char_u *)"@*!=><&~#", *p) != NULL) { p++; } len = (size_t)(p - cmd); @@ -2779,7 +2779,7 @@ const char * set_one_cmd_context( return NULL; if (ea.cmdidx == CMD_SIZE) { - if (*cmd == 's' && strchr("cgriI", cmd[1]) != NULL) { + if (*cmd == 's' && vim_strchr((const char_u *)"cgriI", cmd[1]) != NULL) { ea.cmdidx = CMD_substitute; p = cmd + 1; } else if (cmd[0] >= 'A' && cmd[0] <= 'Z') { diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index eed4bf6066..ff68de7670 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -584,7 +584,7 @@ static int command_line_execute(VimState *state, int key) } if (vim_ispathsep(ccline.cmdbuff[s->j]) #ifdef BACKSLASH_IN_FILENAME - && strchr(" *?[{`$%#", ccline.cmdbuff[s->j + 1]) + && vim_strchr(" *?[{`$%#", ccline.cmdbuff[s->j + 1]) == NULL #endif ) { diff --git a/src/nvim/option.c b/src/nvim/option.c index b8d153500e..3658f17883 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -1411,7 +1411,8 @@ do_set ( errmsg = (char_u *)set_bool_option(opt_idx, varp, (int)value, opt_flags); } else { // Numeric or string. - if (strchr("=:&<", nextchar) == NULL || prefix != 1) { + if (vim_strchr((const char_u *)"=:&<", nextchar) == NULL + || prefix != 1) { errmsg = e_invarg; goto skip; } diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua index 6639bf272d..052cdd55a1 100644 --- a/test/functional/ui/wildmode_spec.lua +++ b/test/functional/ui/wildmode_spec.lua @@ -31,6 +31,27 @@ describe("'wildmode'", function() :sign define^ | ]]) end) + + it('does not crash after cycling back to original text', function() + command('set wildmode=full') + feed(':j<Tab><Tab><Tab>') + screen:expect([[ + | + ~ | + ~ | + join jumps | + :j^ | + ]]) + -- This would cause nvim to crash before #6650 + feed('<BS><Tab>') + screen:expect([[ + | + ~ | + ~ | + ! # & < = > @ > | + :!^ | + ]]) + end) end) end) |