]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0705: Sorting of fuzzy filename completion is not stable v9.1.0705
authorzeertzjq <zeertzjq@outlook.com>
Sat, 31 Aug 2024 15:05:39 +0000 (17:05 +0200)
committerChristian Brabandt <cb@256bit.org>
Sat, 31 Aug 2024 15:05:39 +0000 (17:05 +0200)
Problem:  Sorting of fuzzy filename completion is not stable
Solution: Compare indexes when scores are equal.  Fix some typos.
          (zeertzjq)

closes: #15593

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/insexpand.c
src/search.c
src/testdir/dumps/Test_pum_highlights_15.dump
src/testdir/test_popup.vim
src/version.c

index af818d4ad396536b9031fac415f1bcf3044b199c..d424fff0071a6048c0e49ace6d82c8a82fe1d67f 100644 (file)
@@ -3546,7 +3546,8 @@ static int compare_scores(const void *a, const void *b)
     int idx_b = *(const int *)b;
     int score_a = compl_fuzzy_scores[idx_a];
     int score_b = compl_fuzzy_scores[idx_b];
-    return (score_a > score_b) ? -1 : (score_a < score_b) ? 1 : 0;
+    return score_a == score_b ? (idx_a == idx_b ? 0 : (idx_a < idx_b ? -1 : 1))
+                       : (score_a > score_b ? -1 : 1);
 }
 
 /*
index e5936d8294129fed708a9459f94466e6844d1ad3..a7fd44e680369b7e10e1cd584a46d52b8ac4e476 100644 (file)
@@ -5217,7 +5217,7 @@ search_for_fuzzy_match(
 {
     pos_T      current_pos = *pos;
     pos_T      circly_end;
-    int                found_new_match = FAIL;
+    int                found_new_match = FALSE;
     int                looped_around = FALSE;
 
     if (whole_line)
index e923b439a36d4c349dff7ee55db55042964b0ee3..199f753af11da23c46d5f2359b2fe51a834f8123 100644 (file)
@@ -1,4 +1,4 @@
-|/+0&#ffffff0|n|o|n|_|e|x|i|t|_|f|o|l|d|e|r> @58
+|/+0&#ffffff0|n|o|n|_|e|x|i|s|t|i|n|g|_|f|o|l|d|e|r> @54
 |~+0#4040ff13&| @73
 |~| @73
 |~| @73
index fe958da0e20fd84e2c18ea1e250dc9b583c33cdd..caec8ff0f5540c9eb210799adb8b8ae5cd7fce16 100644 (file)
@@ -1494,7 +1494,7 @@ func Test_pum_highlights_match()
   call VerifyScreenDump(buf, 'Test_pum_highlights_11', {})
 
   " issue #15357
-  call term_sendkeys(buf, "\<ESC>S/non_exit_folder\<C-X>\<C-F>")
+  call term_sendkeys(buf, "\<ESC>S/non_existing_folder\<C-X>\<C-F>")
   call TermWait(buf, 50)
   call VerifyScreenDump(buf, 'Test_pum_highlights_15', {})
 
index 44137b736fd216c588931c474c6d28d7a1758461..6d374eb78181376cfe369d1d835bdb193f90b309 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    705,
 /**/
     704,
 /**/