Patch 8.0.1518
Problem:    Error messages suppressed after ":silent! try". (Ben Reilly)
Solution:   Restore emsg_silent before executing :try. (closes #2531)
Files:      src/ex_docmd.c, src/testdir/test_eval_stuff.vim


*** ../vim-8.0.1517/src/ex_docmd.c      2018-02-12 22:07:45.597058125 +0100
--- src/ex_docmd.c      2018-02-13 18:01:38.766019811 +0100
***************
*** 2880,2887 ****
      }
  #endif
  
  /*
!  * 7. Switch on command name.
   *
   * The "ea" structure holds the arguments that can be used.
   */
--- 2880,2897 ----
      }
  #endif
  
+     /* The :try command saves the emsg_silent flag, reset it here when
+      * ":silent! try" was used, it should only apply to :try itself. */
+     if (ea.cmdidx == CMD_try && did_esilent > 0)
+     {
+       emsg_silent -= did_esilent;
+       if (emsg_silent < 0)
+           emsg_silent = 0;
+       did_esilent = 0;
+     }
+ 
  /*
!  * 7. Execute the command.
   *
   * The "ea" structure holds the arguments that can be used.
   */
*** ../vim-8.0.1517/src/testdir/test_eval_stuff.vim     2017-12-22 
21:49:53.706738801 +0100
--- src/testdir/test_eval_stuff.vim     2018-02-13 17:47:26.180597617 +0100
***************
*** 11,13 ****
--- 11,27 ----
  func Test_catch_return_with_error()
    call assert_equal(1, s:foo())
  endfunc
+ 
+ func Test_nocatch_restore_silent_emsg()
+   silent! try
+     throw 1
+   catch
+   endtry
+   echoerr 'wrong'
+   let c1 = nr2char(screenchar(&lines, 1))
+   let c2 = nr2char(screenchar(&lines, 2))
+   let c3 = nr2char(screenchar(&lines, 3))
+   let c4 = nr2char(screenchar(&lines, 4))
+   let c5 = nr2char(screenchar(&lines, 5))
+   call assert_equal('wrong', c1 . c2 . c3 . c4 . c5)
+ endfunc
*** ../vim-8.0.1517/src/version.c       2018-02-13 16:35:02.371235935 +0100
--- src/version.c       2018-02-13 17:20:11.579592437 +0100
***************
*** 773,774 ****
--- 773,776 ----
  {   /* Add new patch number below this line */
+ /**/
+     1518,
  /**/

-- 
The early bird gets the worm. If you want something else for
breakfast, get up later.

 /// Bram Moolenaar -- b...@moolenaar.net -- 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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui