Patch 8.2.3950
Problem: Going beyond the end of the line with /\%V.
Solution: Check for valid column in getvcol().
Files: src/charset.c, src/testdir/test_regexp_latin.vim
*** ../vim-8.2.3949/src/charset.c 2021-12-15 15:41:41.085254846 +0000
--- src/charset.c 2021-12-30 15:25:49.720736874 +0000
***************
*** 1240,1249 ****
posptr = NULL; // continue until the NUL
else
{
! // Special check for an empty line, which can happen on exit, when
! // ml_get_buf() always returns an empty string.
! if (*ptr == NUL)
! pos->col = 0;
posptr = ptr + pos->col;
if (has_mbyte)
// always start on the first byte
--- 1240,1254 ----
posptr = NULL; // continue until the NUL
else
{
! colnr_T i;
!
! // In a few cases the position can be beyond the end of the line.
! for (i = 0; i < pos->col; ++i)
! if (ptr[i] == NUL)
! {
! pos->col = i;
! break;
! }
posptr = ptr + pos->col;
if (has_mbyte)
// always start on the first byte
*** ../vim-8.2.3949/src/testdir/test_regexp_latin.vim 2021-12-30
14:49:39.953445531 +0000
--- src/testdir/test_regexp_latin.vim 2021-12-30 15:24:33.776867088 +0000
***************
*** 1053,1056 ****
--- 1053,1064 ----
bwipe!
endfunc
+ func Test_using_invalid_visual_position()
+ " this was going beyond the end of the line
+ new
+ exe "norm 0o000\<Esc>0\<C-V>$s0"
+ /\%V
+ bwipe!
+ endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.3949/src/version.c 2021-12-30 14:49:39.953445531 +0000
--- src/version.c 2021-12-30 15:27:37.556529951 +0000
***************
*** 751,752 ****
--- 751,754 ----
{ /* Add new patch number below this line */
+ /**/
+ 3950,
/**/
--
hundred-and-one symptoms of being an internet addict:
155. You forget to eat because you're too busy surfing the net.
/// 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/20211230152948.5D39C1C0A5B%40moolenaar.net.