patch 9.1.0631: wrong completion list displayed with non-existing dir + fuzzy 
completion

Commit: 
https://github.com/vim/vim/commit/6b6280c4a270547f84f01c0e0d9be1b7d6bb9e20
Author: glepnir <glephun...@gmail.com>
Date:   Sat Jul 27 16:25:45 2024 +0200

    patch 9.1.0631: wrong completion list displayed with non-existing dir + 
fuzzy completion
    
    Problem:  wrong completion list displayed with non-existing dir + fuzzy
              completion (kawarimidoll)
    Solution: clear list of matches, if leader did not use fuzzy match
              (glepnir)
    
    fixes: #15357
    closes: #15365
    
    Signed-off-by: glepnir <glephun...@gmail.com>

diff --git a/src/insexpand.c b/src/insexpand.c
index 7a5298f02..2a5f8e804 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -3581,6 +3581,7 @@ get_next_filename_completion(void)
 
                // Move leader to the file part
                leader = last_sep + 1;
+               leader_len = STRLEN(leader);
            }
        }
     }
@@ -3643,12 +3644,18 @@ get_next_filename_completion(void)
            matches = sorted_matches;
            num_matches = fuzzy_indices.ga_len;
        }
+       else if (leader_len > 0)
+       {
+           FreeWild(num_matches, matches);
+           num_matches = 0;
+       }
 
        vim_free(compl_fuzzy_scores);
        ga_clear(&fuzzy_indices);
     }
 
-    ins_compl_add_matches(num_matches, matches, p_fic || p_wic);
+    if (num_matches > 0)
+       ins_compl_add_matches(num_matches, matches, p_fic || p_wic);
 }
 
 /*
diff --git a/src/testdir/dumps/Test_pum_highlights_15.dump 
b/src/testdir/dumps/Test_pum_highlights_15.dump
new file mode 100644
index 000000000..e923b439a
--- /dev/null
+++ b/src/testdir/dumps/Test_pum_highlights_15.dump
@@ -0,0 +1,20 @@
+|/+0&#ffffff0|n|o|n|_|e|x|i|t|_|f|o|l|d|e|r> @58
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|-+2#0000000&@1| |F|i|l|e| |n|a|m|e| |c|o|m|p|l|e|t|i|o|n| |(|^|F|^|N|^|P|)| 
|P+0#ffffff16#e000002|a|t@1|e|r|n| |n|o|t| |f|o|u|n|d| +0#0000000#ffffff0@24
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index 4c2fb4542..38324c1cd 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -1493,6 +1493,11 @@ func Test_pum_highlights_match()
   call TermWait(buf, 50)
   call VerifyScreenDump(buf, 'Test_pum_highlights_11', {})
 
+  " issue #15357
+  call term_sendkeys(buf, "\<ESC>S/non_exit_folder\<C-X>\<C-F>")
+  call TermWait(buf, 50)
+  call VerifyScreenDump(buf, 'Test_pum_highlights_15', {})
+
   call term_sendkeys(buf, "\<C-E>\<Esc>")
   call TermWait(buf)
 
diff --git a/src/version.c b/src/version.c
index 417e4003a..31b0c2462 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 */
+/**/
+    631,
 /**/
     630,
 /**/

-- 
-- 
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/E1sXiQw-00EaiY-Ux%40256bit.org.

Raspunde prin e-mail lui