patch 9.1.0098: CompletionChanged not triggered when new leader added without 
matches

Commit: 
https://github.com/vim/vim/commit/0d3c0a66a39570cbc52b9536604c39e324b989b3
Author: glepnir <glephun...@gmail.com>
Date:   Sun Feb 11 17:52:40 2024 +0100

    patch 9.1.0098: CompletionChanged not triggered when new leader added 
without matches
    
    Problem:  CompletionChanged not triggered when new leader added causing
              no matching item in the completion menu
    Solution: When completion is active but no items matched still trigger
              CompletChanged event
              (glepnir)
    
    closes: #13982
    
    Signed-off-by: glepnir <glephun...@gmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/insexpand.c b/src/insexpand.c
index d712181bc..68e970a71 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -1350,7 +1350,13 @@ ins_compl_show_pum(void)
     }
 
     if (compl_match_array == NULL)
+    {
+#ifdef FEAT_EVAL
+       if (compl_started && has_completechanged())
+           trigger_complete_changed_event(cur);
+#endif
        return;
+    }
 
     // In Replace mode when a $ is displayed at the end of the line only
     // part of the screen would be updated.  We do need to redraw here.
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index 879d1fa3e..f5cb8b2a1 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -1139,6 +1139,10 @@ func Test_CompleteChanged()
     let g:event = copy(v:event)
     let g:item = get(v:event, 'completed_item', {})
     let g:word = get(g:item, 'word', v:null)
+    let l:line = getline('.')
+    if g:word == v:null && l:line == "bc"
+      let g:word = l:line
+    endif
   endfunction
   augroup AAAAA_Group
     au!
@@ -1158,6 +1162,8 @@ func Test_CompleteChanged()
   call assert_equal(v:null, g:word)
   call feedkeys("a\<C-N>\<C-N>\<C-N>\<C-N>\<C-P>", 'tx')
   call assert_equal('foobar', g:word)
+  call feedkeys("S\<C-N>bc", 'tx')
+  call assert_equal("bc", g:word)
 
   func Omni_test(findstart, base)
     if a:findstart
diff --git a/src/version.c b/src/version.c
index 98cb8bc9b..7fd6982f3 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    98,
 /**/
     97,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1rZDBT-009A6E-N6%40256bit.org.

Reply via email to