mirror of
https://github.com/vim/vim.git
synced 2025-07-04 23:07:33 -04:00
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 #10420)
This commit is contained in:
parent
98feacedf9
commit
2e444bbef0
@ -1197,7 +1197,8 @@ ins_try_si(int c)
|
|||||||
int temp;
|
int temp;
|
||||||
|
|
||||||
// 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)
|
||||||
|
@ -140,6 +140,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
|
||||||
|
|
||||||
|
@ -746,6 +746,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
4953,
|
||||||
/**/
|
/**/
|
||||||
4952,
|
4952,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user