Patch 8.2.3033
Problem:    No error when using alpha delimiter with :global.
Solution:   Check the delimiter like with :substitute. (closes #8415)
Files:      src/ex_cmds.c, src/testdir/test_global.vim


*** ../vim-8.2.3032/src/ex_cmds.c       2021-06-06 21:38:04.941344567 +0200
--- src/ex_cmds.c       2021-06-21 21:47:44.709549807 +0200
***************
*** 3643,3648 ****
--- 3643,3659 ----
      return p;
  }
  
+     static int
+ check_regexp_delim(int c)
+ {
+     if (isalpha(c))
+     {
+       emsg(_("E146: Regular expressions can't be delimited by letters"));
+       return FAIL;
+     }
+     return OK;
+ }
+ 
  /*
   * Perform a substitution from line eap->line1 to line eap->line2 using the
   * command pointed to by eap->arg which should be of the form:
***************
*** 3705,3715 ****
                && vim_strchr((char_u *)"0123456789cegriIp|\"", *cmd) == NULL)
      {
                                // don't accept alphanumeric for separator
!       if (isalpha(*cmd))
!       {
!           emsg(_("E146: Regular expressions can't be delimited by letters"));
            return;
!       }
        /*
         * undocumented vi feature:
         *  "\/sub/" and "\?sub?" use last used search pattern (almost like
--- 3716,3724 ----
                && vim_strchr((char_u *)"0123456789cegriIp|\"", *cmd) == NULL)
      {
                                // don't accept alphanumeric for separator
!       if (check_regexp_delim(*cmd) == FAIL)
            return;
! 
        /*
         * undocumented vi feature:
         *  "\/sub/" and "\?sub?" use last used search pattern (almost like
***************
*** 4909,4914 ****
--- 4918,4927 ----
        emsg(_("E148: Regular expression missing from global"));
        return;
      }
+     else if (check_regexp_delim(*cmd) == FAIL)
+     {
+       return;
+     }
      else
      {
        delim = *cmd;           // get the delimiter
*** ../vim-8.2.3032/src/testdir/test_global.vim 2020-09-04 21:18:40.484161926 
+0200
--- src/testdir/test_global.vim 2021-06-21 21:54:27.844391479 +0200
***************
*** 83,86 ****
--- 83,90 ----
    close!
  endfunc
  
+ func Test_wrong_delimiter()
+   call assert_fails('g x^bxd', 'E146:')
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.3032/src/version.c       2021-06-21 21:08:04.928547486 +0200
--- src/version.c       2021-06-21 21:48:46.541371615 +0200
***************
*** 757,758 ****
--- 757,760 ----
  {   /* Add new patch number below this line */
+ /**/
+     3033,
  /**/

-- 
How To Keep A Healthy Level Of Insanity:
5. Put decaf in the coffee maker for 3 weeks. Once everyone has gotten
   over their caffeine addictions, switch to espresso.

 /// 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/202106211955.15LJtqYe692765%40masaka.moolenaar.net.

Raspunde prin e-mail lui