Patch 9.0.0228
Problem:    Crash when pattern looks below the last line.
Solution:   Consider invalid lines to be empty. (closes #10938)
Files:      src/regexp_nfa.c, src/regexp_bt.c,
            src/testdir/test_regexp_latin.vim


*** ../vim-9.0.0227/src/regexp_nfa.c    2022-07-25 18:13:33.054580717 +0100
--- src/regexp_nfa.c    2022-08-19 13:52:58.397999918 +0100
***************
*** 6774,6783 ****
                        result = col > t->state->val * ts;
                    }
                    if (!result)
!                       result = nfa_re_num_cmp(t->state->val, op,
!                               (long_u)win_linetabsize(wp,
!                                               rex.reg_firstlnum + rex.lnum,
!                                               rex.line, col) + 1);
                    if (result)
                    {
                        add_here = TRUE;
--- 6774,6789 ----
                        result = col > t->state->val * ts;
                    }
                    if (!result)
!                   {
!                       linenr_T    lnum = rex.reg_firstlnum + rex.lnum;
!                       long_u      vcol = 0;
! 
!                       if (lnum > 0
!                                  && lnum <= wp->w_buffer->b_ml.ml_line_count)
!                           vcol = (long_u)win_linetabsize(wp, lnum,
!                                                               rex.line, col);
!                       result = nfa_re_num_cmp(t->state->val, op, vcol + 1);
!                   }
                    if (result)
                    {
                        add_here = TRUE;
*** ../vim-9.0.0227/src/regexp_bt.c     2022-07-25 18:13:33.054580717 +0100
--- src/regexp_bt.c     2022-08-19 13:52:31.742135915 +0100
***************
*** 3439,3450 ****
            break;
  
          case RE_VCOL:
!           if (!re_num_cmp((long_u)win_linetabsize(
!                           rex.reg_win == NULL ? curwin : rex.reg_win,
!                           rex.reg_firstlnum + rex.lnum,
!                           rex.line,
!                           (colnr_T)(rex.input - rex.line)) + 1, scan))
!               status = RA_NOMATCH;
            break;
  
          case BOW:     // \<word; rex.input points to w
--- 3439,3455 ----
            break;
  
          case RE_VCOL:
!           {
!               win_T       *wp = rex.reg_win == NULL ? curwin : rex.reg_win;
!               linenr_T    lnum = rex.reg_firstlnum + rex.lnum;
!               long_u      vcol = 0;
! 
!               if (lnum > 0 && lnum <= wp->w_buffer->b_ml.ml_line_count)
!                   vcol = (long_u)win_linetabsize(wp, lnum, rex.line,
!                                             (colnr_T)(rex.input - rex.line));
!               if (!re_num_cmp(vcol + 1, scan))
!                   status = RA_NOMATCH;
!           }
            break;
  
          case BOW:     // \<word; rex.input points to w
*** ../vim-9.0.0227/src/testdir/test_regexp_latin.vim   2022-07-14 
17:40:43.006466830 +0100
--- src/testdir/test_regexp_latin.vim   2022-08-19 13:51:46.206374607 +0100
***************
*** 1129,1132 ****
--- 1129,1144 ----
    delfunc Repl
  endfunc
  
+ def Test_compare_columns()
+   # this was using a line below the last line
+   enew
+   setline(1, ['', ''])
+   prop_type_add('name', {highlight: 'ErrorMsg'})
+   prop_add(1, 1, {length: 1, type: 'name'})
+   search('\%#=1\%>.l\n.*\%<2v', 'nW')
+   search('\%#=2\%>.l\n.*\%<2v', 'nW')
+   bwipe!
+   prop_type_delete('name')
+ enddef
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-9.0.0227/src/version.c       2022-08-19 13:17:18.098545090 +0100
--- src/version.c       2022-08-19 13:37:26.384425100 +0100
***************
*** 733,734 ****
--- 733,736 ----
  {   /* Add new patch number below this line */
+ /**/
+     228,
  /**/

-- 
The early bird gets the worm. The second mouse gets the cheese.

 /// 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/20220819130006.C98CD1C0ADA%40moolenaar.net.

Raspunde prin e-mail lui