]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1161: preinsert requires bot "menu" and "menuone" to be set v9.1.1161
authorglepnir <glephunter@gmail.com>
Sat, 1 Mar 2025 15:12:23 +0000 (16:12 +0100)
committerChristian Brabandt <cb@256bit.org>
Sat, 1 Mar 2025 15:12:23 +0000 (16:12 +0100)
Problem:  preinsert requires bot "menu" and "menuone" to be set,
          but "menu" is redundant (after v9.1.1160)
Solution: preinsert only requires menuone (glepnir)

closes: #16763

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/doc/options.txt
src/insexpand.c
src/testdir/test_ins_complete.vim
src/version.c

index 48b4b599ae34fad1624baf25a6e5e52accecd97b..ccf26ceb5786925910ef7a2930c88df37a90c9ca 100644 (file)
@@ -1,4 +1,4 @@
-*options.txt*  For Vim version 9.1.  Last change: 2025 Feb 28
+*options.txt*  For Vim version 9.1.  Last change: 2025 Mar 01
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -2167,9 +2167,8 @@ A jump table for the options with a short description can be found at |Q_op|.
           preinsert
                    Preinsert the portion of the first candidate word that is
                    not part of the current completion leader and using the
-                   |hl-ComplMatchIns| highlight group. Does not work when
-                   "fuzzy" is set. Requires both "menu" and "menuone" to be
-                   set.
+                   |hl-ComplMatchIns| highlight group.  In order for it to
+                   work, "fuzzy" must not bet set and "menuone" must be set.
 
           preview  Show extra information about the currently selected
                    completion in the preview window.  Only works in
index 8a6f8afd8f31ed03c206fbd9bc131ddfcfb842d5..1616a0f3f67cd7da53aafc5b18510b5c0ffd6faf 100644 (file)
@@ -1985,15 +1985,15 @@ ins_compl_len(void)
 }
 
 /*
- * Return TRUE when preinsert is set AND both 'menu' and 'menuone' flags
- * are also set, otherwise return FALSE.
+ * Return TRUE when the 'completeopt' "preinsert" flag is in effect,
+ * otherwise return FALSE.
  */
     static int
 ins_compl_has_preinsert(void)
 {
     int cur_cot_flags = get_cot_flags();
-    return (cur_cot_flags & (COT_PREINSERT | COT_FUZZY | COT_MENU | COT_MENUONE))
-       == (COT_PREINSERT | COT_MENU | COT_MENUONE);
+    return (cur_cot_flags & (COT_PREINSERT | COT_FUZZY | COT_MENUONE))
+       == (COT_PREINSERT | COT_MENUONE);
 }
 
 /*
index e91a99e7cbb7e3394c3be1abead0b1a37878c2bc..a6859d569329f0f23d1d6c0d04313e7c7cc5a031 100644 (file)
@@ -3223,6 +3223,11 @@ function Test_completeopt_preinsert()
   call assert_equal("foo1bar", getline('.'))
   call assert_equal(7, col('.'))
 
+  set cot=preinsert,menuone
+  call feedkeys("Sfoo1 foo2\<CR>f\<C-X>\<C-N>", 'tx')
+  call assert_equal("foo1", getline('.'))
+  call assert_equal(1, col('.'))
+
   bw!
   set cot&
   set omnifunc&
index 12d4434ec12a7e49c9b22734eb3cf3063aba9d93..398d72509a36e6ad88daf88bd05cb96c6a896bce 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1161,
 /**/
     1160,
 /**/