vim-patch:8.2.4710: smart indenting does not work after completion (#18030)

Problem:    Smart indenting does not work after completion.
Solution:   Set "can_si". (Christian Brabandt, closes vim/vim#10113, closes vim/vim#558)
ac72c21da6
This commit is contained in:
zeertzjq 2022-04-08 07:12:47 +08:00 committed by GitHub
parent 8c25dbff46
commit 65a5cea0d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View File

@ -1393,6 +1393,7 @@ static void insert_do_complete(InsertState *s)
compl_cont_status = 0;
}
compl_busy = false;
can_si = true; // allow smartindenting
}
static void insert_do_cindent(InsertState *s)

View File

@ -707,4 +707,23 @@ func Test_z1_complete_no_history()
close!
endfunc
func FooBarComplete(findstart, base)
if a:findstart
return col('.') - 1
else
return ["Foo", "Bar", "}"]
endif
endfunc
func Test_complete_smartindent()
new
setlocal smartindent completefunc=FooBarComplete
exe "norm! o{\<cr>\<c-x>\<c-u>\<c-p>}\<cr>\<esc>"
let result = getline(1,'$')
call assert_equal(['', '{','}',''], result)
bw!
delfunction! FooBarComplete
endfunc
" vim: shiftwidth=2 sts=2 expandtab