Patch 8.2.4365 (after 8.2.4348)
Problem:    sticky command modifiers are too sticky.
Solution:   Do not apply command modifiers to a called function. (closes #9751)
Files:      src/userfunc.c, src/testdir/test_vim9_cmd.vim


*** ../vim-8.2.4364/src/userfunc.c      2022-02-12 19:52:22.024702251 +0000
--- src/userfunc.c      2022-02-12 22:12:04.511165694 +0000
***************
*** 2513,2518 ****
--- 2513,2519 ----
  {
      sctx_T    save_current_sctx;
      int               using_sandbox = FALSE;
+     int               save_sticky_cmdmod_flags = sticky_cmdmod_flags;
      funccall_T        *fc;
      int               save_did_emsg;
      int               default_arg_err = FALSE;
***************
*** 2569,2574 ****
--- 2570,2576 ----
        if (do_profiling == PROF_YES)
            profile_may_start_func(&profile_info, fp, caller);
  #endif
+       sticky_cmdmod_flags = 0;
        call_def_function(fp, argcount, argvars, funcexe->fe_partial, rettv);
        funcdepth_decrement();
  #ifdef FEAT_PROFILE
***************
*** 2578,2583 ****
--- 2580,2586 ----
  #endif
        current_funccal = fc->caller;
        free_funccal(fc);
+       sticky_cmdmod_flags = save_sticky_cmdmod_flags;
        return;
      }
  
***************
*** 2797,2802 ****
--- 2800,2808 ----
                                 fc->caller == NULL ? NULL : fc->caller->func);
  #endif
  
+     // "legacy" does not apply to commands in the function
+     sticky_cmdmod_flags = 0;
+ 
      save_current_sctx = current_sctx;
      current_sctx = fp->uf_script_ctx;
      save_did_emsg = did_emsg;
***************
*** 2889,2894 ****
--- 2895,2901 ----
  #endif
      if (using_sandbox)
        --sandbox;
+     sticky_cmdmod_flags = save_sticky_cmdmod_flags;
  
      if (p_verbose >= 12 && SOURCING_NAME != NULL)
      {
*** ../vim-8.2.4364/src/testdir/test_vim9_cmd.vim       2022-02-12 
19:52:22.028702244 +0000
--- src/testdir/test_vim9_cmd.vim       2022-02-12 21:34:42.806961412 +0000
***************
*** 118,123 ****
--- 118,137 ----
    END
    v9.CheckScriptSuccess(lines)
    delete('Xvim9import.vim')
+ 
+   # "legacy" does not aply to a called function
+   lines =<< trim END
+       vim9script
+ 
+       def g:TheFunc()
+         if exists('something')
+           echo 'yes'
+         endif
+       enddef
+       legacy exe 'call g:TheFunc()'
+   END
+   v9.CheckScriptSuccess(lines)
+   delfunc g:TheFunc
  enddef
  
  def Test_edit_wildcards()
*** ../vim-8.2.4364/src/version.c       2022-02-12 21:59:47.800290197 +0000
--- src/version.c       2022-02-12 22:09:44.563385582 +0000
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     4365,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
34. You laugh at people with a 10 Mbit connection.

 /// 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/20220212221333.D28771C0DFF%40moolenaar.net.

Raspunde prin e-mail lui