mirror of
https://github.com/vim/vim.git
synced 2025-10-01 04:54:07 -04:00
patch 9.1.0012: regression with empty inner blocks introduced
Problem: regression with empty inner blocks introduced (after v9.1.0007) Solution: Set correct cursor position, Check for visual mode being active (Maxim Kim) relates: #13514 closes: #13819 Signed-off-by: Maxim Kim <habamax@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
7b7672d5ca
commit
3779516988
@@ -643,7 +643,7 @@ endfunc
|
|||||||
|
|
||||||
func Test_inner_block_empty_paren()
|
func Test_inner_block_empty_paren()
|
||||||
new
|
new
|
||||||
call setline(1, ["(text)()", "", "(text)(", ")", "", "()()"])
|
call setline(1, ["(text)()", "", "(text)(", ")", "", "()()", "", "text()"])
|
||||||
|
|
||||||
" Example 1
|
" Example 1
|
||||||
call cursor(1, 1)
|
call cursor(1, 1)
|
||||||
@@ -665,12 +665,18 @@ func Test_inner_block_empty_paren()
|
|||||||
call assert_beeps('call feedkeys("0f(viby", "xt")')
|
call assert_beeps('call feedkeys("0f(viby", "xt")')
|
||||||
call assert_equal(3, getpos('.')[2])
|
call assert_equal(3, getpos('.')[2])
|
||||||
call assert_equal('(', @")
|
call assert_equal('(', @")
|
||||||
|
|
||||||
|
" Change empty inner block
|
||||||
|
call cursor(8, 1)
|
||||||
|
call feedkeys("0cibtext", "xt")
|
||||||
|
call assert_equal("text(text)", getline('.'))
|
||||||
|
|
||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_inner_block_empty_bracket()
|
func Test_inner_block_empty_bracket()
|
||||||
new
|
new
|
||||||
call setline(1, ["[text][]", "", "[text][", "]", "", "[][]"])
|
call setline(1, ["[text][]", "", "[text][", "]", "", "[][]", "", "text[]"])
|
||||||
|
|
||||||
" Example 1
|
" Example 1
|
||||||
call cursor(1, 1)
|
call cursor(1, 1)
|
||||||
@@ -692,12 +698,18 @@ func Test_inner_block_empty_bracket()
|
|||||||
call assert_beeps('call feedkeys("0f[viby", "xt")')
|
call assert_beeps('call feedkeys("0f[viby", "xt")')
|
||||||
call assert_equal(3, getpos('.')[2])
|
call assert_equal(3, getpos('.')[2])
|
||||||
call assert_equal('[', @")
|
call assert_equal('[', @")
|
||||||
|
|
||||||
|
" Change empty inner block
|
||||||
|
call cursor(8, 1)
|
||||||
|
call feedkeys("0ci[text", "xt")
|
||||||
|
call assert_equal("text[text]", getline('.'))
|
||||||
|
|
||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_inner_block_empty_brace()
|
func Test_inner_block_empty_brace()
|
||||||
new
|
new
|
||||||
call setline(1, ["{text}{}", "", "{text}{", "}", "", "{}{}"])
|
call setline(1, ["{text}{}", "", "{text}{", "}", "", "{}{}", "", "text{}"])
|
||||||
|
|
||||||
" Example 1
|
" Example 1
|
||||||
call cursor(1, 1)
|
call cursor(1, 1)
|
||||||
@@ -719,6 +731,12 @@ func Test_inner_block_empty_brace()
|
|||||||
call assert_beeps('call feedkeys("0f{viby", "xt")')
|
call assert_beeps('call feedkeys("0f{viby", "xt")')
|
||||||
call assert_equal(3, getpos('.')[2])
|
call assert_equal(3, getpos('.')[2])
|
||||||
call assert_equal('{', @")
|
call assert_equal('{', @")
|
||||||
|
|
||||||
|
" Change empty inner block
|
||||||
|
call cursor(8, 1)
|
||||||
|
call feedkeys("0ciBtext", "xt")
|
||||||
|
call assert_equal("text{text}", getline('.'))
|
||||||
|
|
||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@@ -1131,10 +1131,15 @@ current_block(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EQUAL_POS(start_pos, *end_pos))
|
/*
|
||||||
// empty block like this: ()
|
* In Visual mode, when resulting area is empty
|
||||||
// there is no inner block to select, abort
|
* i.e. there is no inner block to select, abort.
|
||||||
|
*/
|
||||||
|
if (EQUAL_POS(start_pos, *end_pos) && VIsual_active)
|
||||||
|
{
|
||||||
|
curwin->w_cursor = old_pos;
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In Visual mode, when the resulting area is not bigger than what we
|
* In Visual mode, when the resulting area is not bigger than what we
|
||||||
|
@@ -704,6 +704,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 */
|
||||||
|
/**/
|
||||||
|
12,
|
||||||
/**/
|
/**/
|
||||||
11,
|
11,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user