patch 9.1.0918: tiny Vim crashes with fuzzy buffer completion
Problem: tiny Vim crashes with fuzzy buffer completion
Solution: Adjust #ifdefs in ExpandBufnames() (826814741_6)
closes: #16200
Signed-off-by: h-east <h.east.727@gmail.com>
Signed-off-by: 826814741_6 <44406129+826814741-6@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/buffer.c b/src/buffer.c
index 3b05f25..147d20d 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2985,9 +2985,9 @@
vim_free(patc);
}
-#ifdef FEAT_VIMINFO
if (!fuzzy)
{
+#ifdef FEAT_VIMINFO
if (matches != NULL)
{
int i;
@@ -3007,13 +3007,13 @@
}
vim_free(matches);
}
+#endif
}
else
{
if (fuzzymatches_to_strmatches(fuzmatch, file, count, FALSE) == FAIL)
return FAIL;
}
-#endif
*num_file = count;
return (count == 0 ? FAIL : OK);
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index bdf058c..7285354 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -21,7 +21,8 @@
test25 \
test26 \
test27 \
- test28
+ test28 \
+ test29
SCRIPTS_TINY_OUT = \
test10.out \
@@ -33,7 +34,8 @@
test25.out \
test26.out \
test27.out \
- test28.out
+ test28.out \
+ test29.out
# Tests for Vim9 script.
TEST_VIM9 = \
diff --git a/src/testdir/test29.in b/src/testdir/test29.in
new file mode 100644
index 0000000..047803c
--- /dev/null
+++ b/src/testdir/test29.in
@@ -0,0 +1,14 @@
+Test for buffer name completion when 'wildoptions' contains "fuzzy"
+(Confirm that Vim does not crash)
+
+STARTTEST
+:set wildoptions=fuzzy
+:new buf_a
+:b buf_a
+:q!
+:set wildoptions&
+:$w! test.out
+:qa!
+ENDTEST
+
+I'm alive!
diff --git a/src/testdir/test29.ok b/src/testdir/test29.ok
new file mode 100644
index 0000000..6a0a7c9
--- /dev/null
+++ b/src/testdir/test29.ok
@@ -0,0 +1 @@
+I'm alive!
diff --git a/src/version.c b/src/version.c
index 96b3803..4fb60ac 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 918,
+/**/
917,
/**/
916,