Patch 8.2.2134
Problem:    Vim9: get E1099 when autocmd triggered in builtin function.
Solution:   Check that did_emsg increased instead of checking that it changed.
            (closes #7448)
Files:      src/vim9execute.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.2133/src/vim9execute.c   2020-12-10 19:43:36.629155311 +0100
--- src/vim9execute.c   2020-12-12 20:40:12.455661471 +0100
***************
*** 583,589 ****
      for (idx = 0; idx < argcount; ++idx)
        clear_tv(&argvars[idx]);
  
!     if (did_emsg != did_emsg_before)
        return FAIL;
      return OK;
  }
--- 583,589 ----
      for (idx = 0; idx < argcount; ++idx)
        clear_tv(&argvars[idx]);
  
!     if (did_emsg > did_emsg_before)
        return FAIL;
      return OK;
  }
*** ../vim-8.2.2133/src/testdir/test_vim9_func.vim      2020-12-12 
14:33:37.096920916 +0100
--- src/testdir/test_vim9_func.vim      2020-12-12 20:39:40.107780960 +0100
***************
*** 1824,1829 ****
--- 1824,1849 ----
    delfunc! g:Func
  enddef
  
+ def Test_did_emsg_reset()
+   # executing an autocommand resets did_emsg, this should not result in a
+   # builtin function considered failing
+   var lines =<< trim END
+       vim9script
+       au BufWinLeave * #
+       def Func()
+           popup_menu('', {callback: {-> popup_create('', {})->popup_close()}})
+           eval [][0]
+       enddef
+       nno <F3> <cmd>call <sid>Func()<cr>
+       feedkeys("\<F3>\e", 'xt')
+   END
+   writefile(lines, 'XemsgReset')
+   assert_fails('so XemsgReset', ['E684:', 'E684:'], lines, 2)
+   delete('XemsgReset')
+   nunmap <F3>
+   au! BufWinLeave
+ enddef
+ 
  def Test_abort_with_silent_call()
    var lines =<< trim END
        vim9script
*** ../vim-8.2.2133/src/version.c       2020-12-12 18:58:36.788284026 +0100
--- src/version.c       2020-12-12 20:32:58.473304663 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2134,
  /**/

-- 
Corn oil comes from corn and olive oil comes from olives, so where
does baby oil come from?

 /// 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/202012121943.0BCJh3IP2876926%40masaka.moolenaar.net.

Raspunde prin e-mail lui