Skip to content

Commit 4895ae8

Browse files
girishjichrisbra
authored andcommitted
patch 9.1.2064: completion: segfault during file name completion
Problem: completion: segfault during file name completion Solution: Initialize compl_num_bests (Girish Palya) closes: #19134 Signed-off-by: Girish Palya <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 0084e4b commit 4895ae8

4 files changed

Lines changed: 33 additions & 0 deletions

File tree

src/insexpand.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7210,6 +7210,7 @@ ins_complete(int c, int enable_pum)
72107210
compl_curr_buf = curwin->w_buffer;
72117211
compl_shown_match = compl_curr_match;
72127212
compl_shows_dir = compl_direction;
7213+
compl_num_bests = 0;
72137214

72147215
// Find next match (and following matches).
72157216
save_w_wrow = curwin->w_wrow;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
|s+0&#ffffff0|e|t| |a|c| |c|o|t|=|f|u|z@1|y|,|l|o|n|g|e|s|t| @50
2+
|.|n|a> @71
3+
|~+0#4040ff13&| @73
4+
|~| @73
5+
|~| @73
6+
|~| @73
7+
|~| @73
8+
|~| @73
9+
|~| @73
10+
|-+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

src/testdir/test_ins_complete.vim

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6155,4 +6155,24 @@ func Test_longest_preinsert_accept()
61556155
call test_override("char_avail", 0)
61566156
endfunc
61576157

6158+
" Issue 19114
6159+
func Test_fuzzy_filenames_compl_autocompl()
6160+
CheckScreendump
6161+
let dir = 'Xtempdir'
6162+
call mkdir(dir, 'pR')
6163+
call writefile([], dir .. '/.name')
6164+
call writefile([], dir .. '/name')
6165+
call writefile([], dir .. '/test.vim')
6166+
6167+
let buf = RunVimInTerminal('', {'rows': 10})
6168+
call term_sendkeys(buf, ':call test_override("char_avail", 1)')
6169+
call term_sendkeys(buf, "\<CR>")
6170+
call term_sendkeys(buf, "iset ac cot=fuzzy,longest\<ESC>")
6171+
call term_sendkeys(buf, ":source\<CR>")
6172+
call term_sendkeys(buf, "o.na\<C-X>\<C-F>") " this used to cause segfault
6173+
call TermWait(buf, 200)
6174+
call VerifyScreenDump(buf, 'Test_fuzzy_filenames_compl_autocompl', {})
6175+
call StopVimInTerminal(buf)
6176+
endfunc
6177+
61586178
" vim: shiftwidth=2 sts=2 expandtab nofoldenable

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@ static char *(features[]) =
734734

735735
static int included_patches[] =
736736
{ /* Add new patch number below this line */
737+
/**/
738+
2064,
737739
/**/
738740
2063,
739741
/**/

0 commit comments

Comments
 (0)