Patch 8.2.3733
Problem:    Vim9: using "legacy" before range does not work.
Solution:   Skip over range before parsing command. (closes #9270)
Files:      src/vim9compile.c, src/usercmd.c, src/testdir/test_vim9_cmd.vim


*** ../vim-8.2.3732/src/vim9compile.c   2021-12-01 17:37:56.440650135 +0000
--- src/vim9compile.c   2021-12-04 11:27:58.229305317 +0000
***************
*** 9903,9917 ****
         * in "$ENV->func()" the "$" is not a range
         */
        cmd = ea.cmd;
!       if (!(local_cmdmod.cmod_flags & CMOD_LEGACY)
!               && (*cmd != '$' || starts_with_colon)
                && (starts_with_colon || !(*cmd == '\''
                       || (cmd[0] == cmd[1] && (*cmd == '+' || *cmd == '-')))))
        {
            ea.cmd = skip_range(ea.cmd, TRUE, NULL);
            if (ea.cmd > cmd)
            {
!               if (!starts_with_colon)
                {
                    semsg(_(e_colon_required_before_range_str), cmd);
                    goto erret;
--- 9903,9917 ----
         * in "$ENV->func()" the "$" is not a range
         */
        cmd = ea.cmd;
!       if ((*cmd != '$' || starts_with_colon)
                && (starts_with_colon || !(*cmd == '\''
                       || (cmd[0] == cmd[1] && (*cmd == '+' || *cmd == '-')))))
        {
            ea.cmd = skip_range(ea.cmd, TRUE, NULL);
            if (ea.cmd > cmd)
            {
!               if (!starts_with_colon
!                                  && !(local_cmdmod.cmod_flags & CMOD_LEGACY))
                {
                    semsg(_(e_colon_required_before_range_str), cmd);
                    goto erret;
***************
*** 9920,9930 ****
                if (ends_excmd2(line, ea.cmd))
                {
                    // A range without a command: jump to the line.
-                   line = skipwhite(line);
-                   while (*line == ':')
-                       ++line;
                    generate_EXEC(&cctx, ISN_EXECRANGE,
!                                           vim_strnsave(line, ea.cmd - line));
                    line = ea.cmd;
                    goto nextline;
                }
--- 9920,9927 ----
                if (ends_excmd2(line, ea.cmd))
                {
                    // A range without a command: jump to the line.
                    generate_EXEC(&cctx, ISN_EXECRANGE,
!                                             vim_strnsave(cmd, ea.cmd - cmd));
                    line = ea.cmd;
                    goto nextline;
                }
*** ../vim-8.2.3732/src/usercmd.c       2021-11-20 19:13:35.945146370 +0000
--- src/usercmd.c       2021-12-04 11:34:51.513437617 +0000
***************
*** 1394,1399 ****
--- 1394,1400 ----
  #ifdef HAVE_SANDBOX
        {CMOD_SANDBOX, "sandbox"},
  #endif
+       {CMOD_LEGACY, "legacy"},
        {0, NULL}
      };
  
*** ../vim-8.2.3732/src/testdir/test_vim9_cmd.vim       2021-12-01 
10:09:12.408191471 +0000
--- src/testdir/test_vim9_cmd.vim       2021-12-04 11:51:20.588510163 +0000
***************
*** 1019,1024 ****
--- 1019,1029 ----
    CheckScriptSuccess(['vim9script', 'silent keepjump :1d _'])
    assert_equal('', getline(1))
    bwipe!
+ 
+   var lines =<< trim END
+       legacy /pat/
+   END
+   CheckDefExecAndScriptFailure(lines, 'E486: Pattern not found: pat')
  enddef
  
  def Test_silent_pattern()
*** ../vim-8.2.3732/src/version.c       2021-12-03 21:18:10.560101905 +0000
--- src/version.c       2021-12-04 11:52:13.708441748 +0000
***************
*** 755,756 ****
--- 755,758 ----
  {   /* Add new patch number below this line */
+ /**/
+     3733,
  /**/

-- 
A salesperson says:            Translation:
"backward compatible"          Old technology
"Premium"                      Overpriced
"Can't keep it on the shelf"   Unavailable
"Stands alone"                 Piece of shit
"Proprietary"                  Incompatible
                                (Scott Adams - The Dilbert principle)

 /// 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/20211204115728.0ED591C0BCC%40moolenaar.net.

Raspunde prin e-mail lui