]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0684: completion is inserted on Enter with "noselect" v9.1.0684
authorglepnir <glephunter@gmail.com>
Tue, 20 Aug 2024 17:58:44 +0000 (19:58 +0200)
committerChristian Brabandt <cb@256bit.org>
Tue, 20 Aug 2024 17:58:44 +0000 (19:58 +0200)
Problem:  completion is inserted on Enter with "noselect"
          (Carman Fu)
Solution: check noselect before update compl_shown_match
          (glepnir)

fixes: #15526
closes: #15530

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

index 9a8d0faac7c26d8848e92b34287fea56fba767f0..95076b7cd2793312d0ff24d9bce67edf19da7f33 100644 (file)
@@ -1311,7 +1311,8 @@ ins_compl_build_pum(void)
                {
                    did_find_shown_match = TRUE;
                    max_fuzzy_score = compl->cp_score;
-                   compl_shown_match = compl;
+                   if (!compl_no_select)
+                       compl_shown_match = compl;
                }
 
                if (!shown_match_ok && compl == compl_shown_match && !compl_no_select)
index becd0d8d059e90eab7cf341aeff17c186e19ed07..aee33936f642ee3da454e4bad17db86e05c7ce67 100644 (file)
@@ -2654,6 +2654,13 @@ func Test_complete_fuzzy_match()
   call feedkeys("Su\<C-X>\<C-L>\<C-P>\<Esc>0", 'tx!')
   call assert_equal('no one can save me but you', getline('.'))
 
+  " issue #15526
+  set completeopt=fuzzy,menuone,menu,noselect
+  call setline(1, ['Text', 'ToText', ''])
+  call cursor(2, 1)
+  call feedkeys("STe\<C-X>\<C-N>x\<CR>\<Esc>0", 'tx!')
+  call assert_equal('Tex', getline('.'))
+
   " clean up
   set omnifunc=
   bw!
index 8d26a0dc04591d5a59ef2124188c3e99dda59a23..12dae156017a992211d924ac3b671d728698766c 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    684,
 /**/
     683,
 /**/