mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 9.0.1273: "1v" may select block with wrong size
Problem: "1v" may select block with wrong size. (Evgeni Chasnovski) Solution: Compute "curswant" in the right line. (closes #11925)
This commit is contained in:
@@ -5493,8 +5493,13 @@ nv_visual(cmdarg_T *cap)
|
|||||||
}
|
}
|
||||||
else if (VIsual_mode == Ctrl_V)
|
else if (VIsual_mode == Ctrl_V)
|
||||||
{
|
{
|
||||||
|
// Update curswant on the original line, that is where "col" is
|
||||||
|
// valid.
|
||||||
|
linenr_T lnum = curwin->w_cursor.lnum;
|
||||||
|
curwin->w_cursor.lnum = VIsual.lnum;
|
||||||
update_curswant_force();
|
update_curswant_force();
|
||||||
curwin->w_curswant += + resel_VIsual_vcol * cap->count0 - 1;
|
curwin->w_curswant += resel_VIsual_vcol * cap->count0 - 1;
|
||||||
|
curwin->w_cursor.lnum = lnum;
|
||||||
coladvance(curwin->w_curswant);
|
coladvance(curwin->w_curswant);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -1318,6 +1318,17 @@ func Test_visual_block_with_substitute()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_visual_reselect_with_count()
|
func Test_visual_reselect_with_count()
|
||||||
|
enew
|
||||||
|
call setline(1, ['aaaaaa', '✗ bbbb', '✗ bbbb'])
|
||||||
|
exe "normal! 2Gw\<C-V>jed"
|
||||||
|
exe "normal! gg0lP"
|
||||||
|
call assert_equal(['abbbbaaaaa', '✗bbbb ', '✗ '], getline(1, '$'))
|
||||||
|
|
||||||
|
exe "normal! 1vr."
|
||||||
|
call assert_equal(['a....aaaaa', '✗.... ', '✗ '], getline(1, '$'))
|
||||||
|
|
||||||
|
bwipe!
|
||||||
|
|
||||||
" this was causing an illegal memory access
|
" this was causing an illegal memory access
|
||||||
let lines =<< trim END
|
let lines =<< trim END
|
||||||
|
|
||||||
|
@@ -695,6 +695,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 */
|
||||||
|
/**/
|
||||||
|
1273,
|
||||||
/**/
|
/**/
|
||||||
1272,
|
1272,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user