mirror of
https://github.com/neovim/neovim.git
synced 2026-06-24 08:48:16 +00:00
vim-patch:9.2.0683: filetype completion mishandles finished sub options (#40351)
Problem: ":filetype plugin<Tab>" gives "pluginindent" because a
sub option before the cursor is treated as already given.
Solution: only skip plugin and indent when followed by white space.
(glepnir)
closes: vim/vim#20594
fe65f23aca
Co-authored-by: glepnir <glephunter@gmail.com>
This commit is contained in:
@@ -1957,12 +1957,12 @@ static const char *set_context_in_filetype_cmd(expand_T *xp, const char *arg)
|
||||
int val = 0;
|
||||
|
||||
while (true) {
|
||||
if (strncmp(p, "plugin", 6) == 0) {
|
||||
if (strncmp(p, "plugin", 6) == 0 && ascii_iswhite(p[6])) {
|
||||
val |= EXPAND_FILETYPECMD_PLUGIN;
|
||||
p = skipwhite(p + 6);
|
||||
continue;
|
||||
}
|
||||
if (strncmp(p, "indent", 6) == 0) {
|
||||
if (strncmp(p, "indent", 6) == 0 && ascii_iswhite(p[6])) {
|
||||
val |= EXPAND_FILETYPECMD_INDENT;
|
||||
p = skipwhite(p + 6);
|
||||
continue;
|
||||
|
||||
@@ -3585,6 +3585,10 @@ func Test_completion_filetypecmd()
|
||||
call assert_equal('"filetype off on', @:)
|
||||
call feedkeys(":filetype indent of\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||
call assert_equal('"filetype indent off', @:)
|
||||
call feedkeys(":filetype plugin\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||
call assert_equal('"filetype plugin', @:)
|
||||
call feedkeys(":filetype plugin indent\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||
call assert_equal('"filetype plugin indent', @:)
|
||||
set wildoptions&
|
||||
endfunc
|
||||
|
||||
|
||||
Reference in New Issue
Block a user