Patch 9.0.1273
Problem: "1v" may select block with wrong size. (Evgeni Chasnovski)
Solution: Compute "curswant" in the right line. (closes #11925)
Files: src/normal.c, src/testdir/test_visual.vim
*** ../vim-9.0.1272/src/normal.c 2023-01-16 18:19:01.907301080 +0000
--- src/normal.c 2023-02-01 17:31:19.903435055 +0000
***************
*** 5493,5500 ****
}
else if (VIsual_mode == Ctrl_V)
{
update_curswant_force();
! curwin->w_curswant += + resel_VIsual_vcol * cap->count0 - 1;
coladvance(curwin->w_curswant);
}
else
--- 5493,5505 ----
}
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();
! curwin->w_curswant += resel_VIsual_vcol * cap->count0 - 1;
! curwin->w_cursor.lnum = lnum;
coladvance(curwin->w_curswant);
}
else
*** ../vim-9.0.1272/src/testdir/test_visual.vim 2023-01-28 19:18:56.741720608
+0000
--- src/testdir/test_visual.vim 2023-02-01 17:30:19.627433991 +0000
***************
*** 1318,1323 ****
--- 1318,1334 ----
endfunc
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
let lines =<< trim END
*** ../vim-9.0.1272/src/version.c 2023-02-01 15:31:20.271541983 +0000
--- src/version.c 2023-02-01 17:20:16.207382752 +0000
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1273,
/**/
--
>From "know your smileys":
:^[/ mean-smiley-with-cigarette
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20230201173354.4C2341C0903%40moolenaar.net.