Patch 8.2.3940
Problem:    Match highlight disappears when doing incsearch for ":s/pat".
Solution:   Only use line limit for incsearch highlighting. (closes #9425)
Files:      src/match.c, src/testdir/test_match.vim,
            src/testdir/dumps/Test_match_with_incsearch_1.dump,
            src/testdir/dumps/Test_match_with_incsearch_2.dump


*** ../vim-8.2.3939/src/match.c 2021-11-29 19:18:33.910686983 +0000
--- src/match.c 2021-12-29 19:20:02.580324016 +0000
***************
*** 427,433 ****
      int               called_emsg_before = called_emsg;
  
      // for :{range}s/pat only highlight inside the range
!     if (lnum < search_first_line || lnum > search_last_line)
      {
        shl->lnum = 0;
        return;
--- 427,433 ----
      int               called_emsg_before = called_emsg;
  
      // for :{range}s/pat only highlight inside the range
!     if ((lnum < search_first_line || lnum > search_last_line) && cur == NULL)
      {
        shl->lnum = 0;
        return;
*** ../vim-8.2.3939/src/testdir/test_match.vim  2021-11-29 19:18:33.910686983 
+0000
--- src/testdir/test_match.vim  2021-12-29 19:18:02.760483671 +0000
***************
*** 366,371 ****
--- 366,392 ----
    call delete('XscriptMatchLinebreak')
  endfunc
  
+ func Test_match_with_incsearch()
+   CheckRunVimInTerminal
+ 
+   let lines =<< trim END
+     set incsearch
+     call setline(1, range(20))
+     call matchaddpos('ErrorMsg', [3])
+   END
+   call writefile(lines, 'XmatchWithIncsearch')
+   let buf = RunVimInTerminal('-S XmatchWithIncsearch', #{rows: 6})
+   call TermWait(buf)
+   call VerifyScreenDump(buf, 'Test_match_with_incsearch_1', {})
+ 
+   call term_sendkeys(buf, ":s/0")
+   call VerifyScreenDump(buf, 'Test_match_with_incsearch_2', {})
+ 
+   call term_sendkeys(buf, "\<CR>")
+   call StopVimInTerminal(buf)
+   call delete('XmatchWithIncsearch')
+ endfunc
+ 
  " Test for deleting matches outside of the screen redraw top/bottom lines
  " This should cause a redraw of those lines.
  func Test_matchdelete_redraw()
*** ../vim-8.2.3939/src/testdir/dumps/Test_match_with_incsearch_1.dump  
2021-12-29 19:20:28.932288614 +0000
--- src/testdir/dumps/Test_match_with_incsearch_1.dump  2021-12-29 
19:16:41.736590268 +0000
***************
*** 0 ****
--- 1,6 ----
+ >0+0&#ffffff0| @73
+ |1| @73
+ |2+0#ffffff16#e000002| +0#0000000#ffffff0@73
+ |3| @73
+ |4| @73
+ @57|1|,|1| @10|T|o|p| 
*** ../vim-8.2.3939/src/testdir/dumps/Test_match_with_incsearch_2.dump  
2021-12-29 19:20:28.936288609 +0000
--- src/testdir/dumps/Test_match_with_incsearch_2.dump  2021-12-29 
19:18:23.420456297 +0000
***************
*** 0 ****
--- 1,6 ----
+ |0+1&#ffffff0| +0&&@73
+ |1| @73
+ |2+0#ffffff16#e000002| +0#0000000#ffffff0@73
+ |3| @73
+ |4| @73
+ |:|s|/|0> @70
*** ../vim-8.2.3939/src/version.c       2021-12-29 18:16:18.361794199 +0000
--- src/version.c       2021-12-29 19:10:38.857047647 +0000
***************
*** 751,752 ****
--- 751,754 ----
  {   /* Add new patch number below this line */
+ /**/
+     3940,
  /**/

-- 
Fingers not found - Pound head on keyboard to continue.

 /// 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/20211229192418.3D9811C0641%40moolenaar.net.

Raspunde prin e-mail lui