]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0683: filetype completion mishandles finished sub options v9.2.0683
authorglepnir <glephunter@gmail.com>
Sun, 21 Jun 2026 12:55:58 +0000 (12:55 +0000)
committerChristian Brabandt <cb@256bit.org>
Sun, 21 Jun 2026 12:55:58 +0000 (12:55 +0000)
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: #20594

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/cmdexpand.c
src/testdir/test_cmdline.vim
src/version.c

index 63b4921604d11b4dafbcc764e185ea2a48341742..496ab7b8831383d2aeb5442bcfc78588b0913ea1 100644 (file)
@@ -2455,13 +2455,13 @@ set_context_in_filetype_cmd(expand_T *xp, char_u *arg)
 
     for (;;)
     {
-       if (STRNCMP(p, "plugin", 6) == 0)
+       if (STRNCMP(p, "plugin", 6) == 0 && VIM_ISWHITE(p[6]))
        {
            val |= EXPAND_FILETYPECMD_PLUGIN;
            p = skipwhite(p + 6);
            continue;
        }
-       if (STRNCMP(p, "indent", 6) == 0)
+       if (STRNCMP(p, "indent", 6) == 0 && VIM_ISWHITE(p[6]))
        {
            val |= EXPAND_FILETYPECMD_INDENT;
            p = skipwhite(p + 6);
index ad48c54ad5faf56603f8428d1ca3b1af87542dea..d1e20f6d2921bea5ae77b1fcbd7d7d08942f5781 100644 (file)
@@ -3648,6 +3648,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
 
index 4275dec4b87dad5ef137480d52c0dc7e0763cd10..fc1ecbce0d41d4349be6d111e86b87ba375c41f4 100644 (file)
@@ -759,6 +759,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    683,
 /**/
     682,
 /**/