mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.4953: with 'si' inserting '}' after completion goes wrong
Problem: With 'smartindent' inserting '}' after completion goes wrong.
Solution: Check the cursor is in indent. (closes vim/vim#10420)
2e444bbef0
This commit is contained in:
parent
24eb1af475
commit
dca0412d37
@ -9344,10 +9344,8 @@ static void ins_try_si(int c)
|
|||||||
/*
|
/*
|
||||||
* do some very smart indenting when entering '{' or '}'
|
* do some very smart indenting when entering '{' or '}'
|
||||||
*/
|
*/
|
||||||
if (((did_si || can_si_back) && c == '{') || (can_si && c == '}')) {
|
if (((did_si || can_si_back) && c == '{') || (can_si && c == '}' && inindent(0))) {
|
||||||
/*
|
// for '}' set indent equal to indent of line containing matching '{'
|
||||||
* for '}' set indent equal to indent of line containing matching '{'
|
|
||||||
*/
|
|
||||||
if (c == '}' && (pos = findmatch(NULL, '{')) != NULL) {
|
if (c == '}' && (pos = findmatch(NULL, '{')) != NULL) {
|
||||||
old_pos = curwin->w_cursor;
|
old_pos = curwin->w_cursor;
|
||||||
/*
|
/*
|
||||||
|
@ -67,6 +67,11 @@ func Test_si_after_completion()
|
|||||||
call setline(1, 'foo foot')
|
call setline(1, 'foo foot')
|
||||||
call feedkeys("o f\<C-X>\<C-N>#", 'tx')
|
call feedkeys("o f\<C-X>\<C-N>#", 'tx')
|
||||||
call assert_equal(' foo#', getline(2))
|
call assert_equal(' foo#', getline(2))
|
||||||
|
|
||||||
|
call setline(2, '')
|
||||||
|
call feedkeys("1Go f\<C-X>\<C-N>}", 'tx')
|
||||||
|
call assert_equal(' foo}', getline(2))
|
||||||
|
|
||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user