mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
fix(completion): make sure the buffer name is valid (#25975)
Problem:
crash from
set complete+=f
open a empty buffer
C-N
Solution:
make sure the buffer name is valid.
regression from ae4ca4edf8
This commit is contained in:
parent
4e33ef747c
commit
d1b2a5cf5f
@ -3334,7 +3334,7 @@ static bool get_next_completion_match(int type, ins_compl_next_state_T *st, pos_
|
|||||||
static void get_next_bufname_token(void)
|
static void get_next_bufname_token(void)
|
||||||
{
|
{
|
||||||
FOR_ALL_BUFFERS(b) {
|
FOR_ALL_BUFFERS(b) {
|
||||||
if (b->b_p_bl) {
|
if (b->b_p_bl && b->b_sfname != NULL) {
|
||||||
char *start = get_past_head(b->b_sfname);
|
char *start = get_past_head(b->b_sfname);
|
||||||
char *current = start;
|
char *current = start;
|
||||||
char *p = (char *)path_next_component(start);
|
char *p = (char *)path_next_component(start);
|
||||||
|
@ -1237,7 +1237,7 @@ describe('completion', function()
|
|||||||
bufname = 'C:\\foo\\bar.txt'
|
bufname = 'C:\\foo\\bar.txt'
|
||||||
hidden = 'C:\\fooA\\.hidden'
|
hidden = 'C:\\fooA\\.hidden'
|
||||||
end
|
end
|
||||||
command('set complete+=f | edit '.. bufname ..' | edit '..hidden)
|
command('set complete+=f | edit '..bufname..' | edit '..hidden..' | enew')
|
||||||
feed('i<C-n>')
|
feed('i<C-n>')
|
||||||
|
|
||||||
screen:expect{grid=[[
|
screen:expect{grid=[[
|
||||||
|
Loading…
Reference in New Issue
Block a user