Patch 8.2.3489

9 views
Skip to first unread message

Bram Moolenaar

unread,
Oct 9, 2021, 9:04:29 AM10/9/21
to vim...@googlegroups.com

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 -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages