Patch 8.2.4693 (after 8.2.4688)
Problem:    new regexp does not accept pattern "\%>0v".
Solution:   Do accept digit zero.
Files:      src/regexp_bt.c, src/regexp_nfa.c,
            src/testdir/test_regexp_latin.vim


*** ../vim-8.2.4692/src/regexp_bt.c     2022-04-04 18:32:29.185670084 +0100
--- src/regexp_bt.c     2022-04-05 13:58:50.272695409 +0100
***************
*** 1617,1622 ****
--- 1617,1623 ----
                              long_u    n = 0;
                              int       cmp;
                              int       cur = FALSE;
+                             int       got_digit = FALSE;
  
                              cmp = c;
                              if (cmp == '<' || cmp == '>')
***************
*** 1628,1633 ****
--- 1629,1635 ----
                              }
                              while (VIM_ISDIGIT(c))
                              {
+                                 got_digit = TRUE;
                                  n = n * 10 + (c - '0');
                                  c = getchr();
                              }
***************
*** 1645,1651 ****
                                  }
                                  break;
                              }
!                             else if (c == 'l' || c == 'c' || c == 'v')
                              {
                                  if (cur && n)
                                  {
--- 1647,1654 ----
                                  }
                                  break;
                              }
!                             else if ((c == 'l' || c == 'c' || c == 'v')
!                                         && (cur || got_digit))
                              {
                                  if (cur && n)
                                  {
*** ../vim-8.2.4692/src/regexp_nfa.c    2022-04-04 18:32:29.185670084 +0100
--- src/regexp_nfa.c    2022-04-05 13:46:56.561776325 +0100
***************
*** 1640,1645 ****
--- 1640,1646 ----
                        long_u  n = 0;
                        int     cmp = c;
                        int     cur = FALSE;
+                       int     got_digit = FALSE;
  
                        if (c == '<' || c == '>')
                            c = getchr();
***************
*** 1668,1679 ****
                            }
                            n = tmp;
                            c = getchr();
                        }
                        if (c == 'l' || c == 'c' || c == 'v')
                        {
                            long_u limit = INT_MAX;
  
!                           if (!cur && n == 0)
                            {
                                semsg(_(e_nfa_regexp_missing_value_in_chr),
                                                                  no_Magic(c));
--- 1669,1681 ----
                            }
                            n = tmp;
                            c = getchr();
+                           got_digit = TRUE;
                        }
                        if (c == 'l' || c == 'c' || c == 'v')
                        {
                            long_u limit = INT_MAX;
  
!                           if (!cur && !got_digit)
                            {
                                semsg(_(e_nfa_regexp_missing_value_in_chr),
                                                                  no_Magic(c));
*** ../vim-8.2.4692/src/testdir/test_regexp_latin.vim   2022-04-04 
18:32:29.185670084 +0100
--- src/testdir/test_regexp_latin.vim   2022-04-05 13:59:41.456825690 +0100
***************
*** 91,106 ****
    set re=0
  endfunc
  
! func Test_column_failure()
    set re=1
    call assert_fails('/\%v', 'E71:')
    call assert_fails('/\%c', 'E71:')
    call assert_fails('/\%l', 'E71:')
    set re=2
    call assert_fails('/\%v', 'E1273:')
    call assert_fails('/\%c', 'E1273:')
    call assert_fails('/\%l', 'E1273:')
    set re=0
  endfunc
  
  func Test_recursive_addstate()
--- 91,119 ----
    set re=0
  endfunc
  
! func Test_column_success_failure()
!   new
!   call setline(1, 'xbar')
! 
    set re=1
+   %s/\%>0v./A/
+   call assert_equal('Abar', getline(1))
    call assert_fails('/\%v', 'E71:')
+   call assert_fails('/\%>v', 'E71:')
    call assert_fails('/\%c', 'E71:')
+   call assert_fails('/\%<c', 'E71:')
    call assert_fails('/\%l', 'E71:')
    set re=2
+   %s/\%>0v./B/
+   call assert_equal('Bbar', getline(1))
    call assert_fails('/\%v', 'E1273:')
+   call assert_fails('/\%>v', 'E1273:')
    call assert_fails('/\%c', 'E1273:')
+   call assert_fails('/\%<c', 'E1273:')
    call assert_fails('/\%l', 'E1273:')
+ 
    set re=0
+   bwipe!
  endfunc
  
  func Test_recursive_addstate()
*** ../vim-8.2.4692/src/version.c       2022-04-05 13:16:57.544981206 +0100
--- src/version.c       2022-04-05 13:52:56.456902964 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     4693,
  /**/

-- 
Snoring is prohibited unless all bedroom windows are closed and securely
locked.
                [real standing law in Massachusetts, United States of America]

 /// 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/20220405130107.59EA51C0561%40moolenaar.net.

Raspunde prin e-mail lui