Patch 8.2.3489
Problem: ml_get error after search with range.
Solution: Limit the line number to the buffer line count.
Files: src/ex_docmd.c, src/testdir/test_search.vim
*** ../vim-8.2.3488/src/ex_docmd.c 2021-10-04 22:17:32.778131139 +0100
--- src/ex_docmd.c 2021-10-09 13:52:44.288910589 +0100
***************
*** 4229,4236 ****
// When '/' or '?' follows another address, start from
// there.
! if (lnum != MAXLNUM)
! curwin->w_cursor.lnum = lnum;
// Start a forward search at the end of the line (unless
// before the first line).
--- 4229,4238 ----
// When '/' or '?' follows another address, start from
// there.
! if (lnum > 0 && lnum != MAXLNUM)
! curwin->w_cursor.lnum =
! lnum > curbuf->b_ml.ml_line_count
! ? curbuf->b_ml.ml_line_count : lnum;
// Start a forward search at the end of the line (unless
// before the first line).
*** ../vim-8.2.3488/src/testdir/test_search.vim 2021-10-04 20:09:16.238548053
+0100
--- src/testdir/test_search.vim 2021-10-09 13:46:11.823460466 +0100
***************
*** 1989,1993 ****
--- 1989,2007 ----
call feedkeys("??\<C-T>", 'xt')
endfunc
+ func Test_search_with_invalid_range()
+ new
+ let lines =<< trim END
+ /\%.v
+ 5/
+ c
+ END
+ call writefile(lines, 'Xrangesearch')
+ source Xrangesearch
+
+ bwipe!
+ call delete('Xrangesearch')
+ endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.3488/src/version.c 2021-10-09 12:49:02.712420769 +0100
--- src/version.c 2021-10-09 13:47:40.852694633 +0100
***************
*** 759,760 ****
--- 759,762 ----
{ /* Add new patch number below this line */
+ /**/
+ 3489,
/**/
--
I have a watch cat! Just break in and she'll watch.
/// 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/20211009130423.8BD17C80055%40moolenaar.net.