Patch 8.2.2215
Problem:    Vim9: `=expr` not recognized in global command.
Solution:   Skip over pattern. (issue #7541)
Files:      src/vim9compile.c, src/testdir/test_vim9_cmd.vim


*** ../vim-8.2.2214/src/vim9compile.c   2020-12-25 13:20:36.799341018 +0100
--- src/vim9compile.c   2020-12-25 18:23:08.178625858 +0100
***************
*** 2947,2953 ****
  }
  
  /*
!  * parse a lambda: {arg, arg -> expr}
   * "*arg" points to the '{'.
   */
      static int
--- 2947,2953 ----
  }
  
  /*
!  * parse a lambda: "{arg, arg -> expr}" or "(arg, arg) => expr"
   * "*arg" points to the '{'.
   */
      static int
***************
*** 7315,7320 ****
--- 7315,7333 ----
            eap->arg = skiptowhite(eap->arg);
      }
  
+     if ((eap->cmdidx == CMD_global || eap->cmdidx == CMD_vglobal)
+                                                      && STRLEN(eap->arg) > 4)
+     {
+       int delim = *eap->arg;
+ 
+       p = skip_regexp_ex(eap->arg + 1, delim, TRUE, NULL, NULL);
+       if (*p == delim)
+       {
+           eap->arg = p + 1;
+           has_expr = TRUE;
+       }
+     }
+ 
      if (has_expr && (p = (char_u *)strstr((char *)eap->arg, "`=")) != NULL)
      {
        int     count = 0;
*** ../vim-8.2.2214/src/testdir/test_vim9_cmd.vim       2020-12-21 
20:32:40.126103572 +0100
--- src/testdir/test_vim9_cmd.vim       2020-12-25 18:28:13.069613278 +0100
***************
*** 25,30 ****
--- 25,39 ----
    CheckDefFailure(['edit `="foo"'], 'E1083:')
  enddef
  
+ def Test_global_backtick_expansion()
+   new
+   setline(1, 'xx')
+   var name = 'foobar'
+   g/^xx/s/.*/`=name`
+   assert_equal('foobar', getline(1))
+   bwipe!
+ enddef
+ 
  def Test_hardcopy_wildcards()
    CheckUnix
    CheckFeature postscript
*** ../vim-8.2.2214/src/version.c       2020-12-25 17:36:23.714969848 +0100
--- src/version.c       2020-12-25 18:35:13.128230482 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2215,
  /**/

-- 
How To Keep A Healthy Level Of Insanity:
10. Ask people what sex they are. Laugh hysterically after they answer.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            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/202012251736.0BPHafDH3596048%40masaka.moolenaar.net.

Raspunde prin e-mail lui