Patch 8.2.1928

5 views
Skip to first unread message

Bram Moolenaar

unread,
Oct 30, 2020, 4:50:32 PM10/30/20
to vim...@googlegroups.com

Patch 8.2.1928
Problem: Vim9: "silent!" not effective when list index is wrong.
Solution: Ignore list indes failure when emsg_silent is set. (closes #7232)
Files: src/vim9execute.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.1927/src/vim9execute.c 2020-10-30 20:46:22.670118038 +0100
--- src/vim9execute.c 2020-10-30 21:49:16.566641050 +0100
***************
*** 2869,2874 ****
--- 2869,2878 ----
continue;

on_error:
+ // If "emsg_silent" is set then ignore the error.
+ if (did_emsg == did_emsg_before && emsg_silent)
+ continue;
+
// If we are not inside a try-catch started here, abort execution.
if (trylevel <= trylevel_at_start)
goto failed;
*** ../vim-8.2.1927/src/testdir/test_vim9_func.vim 2020-10-28 20:19:56.376057067 +0100
--- src/testdir/test_vim9_func.vim 2020-10-30 21:41:58.724408497 +0100
***************
*** 1477,1483 ****
enddef

" This can't be a :def function, because the assert would not be reached.
- " And this must not be inside a try/endtry.
func Test_ignore_silent_error()
let g:did_it = 'no'
call SilentlyError()
--- 1477,1482 ----
***************
*** 1490,1495 ****
--- 1489,1511 ----
unlet g:did_it
endfunc

+ def Test_ignore_silent_error_in_filter()
+ var lines =<< trim END
+ vim9script
+ def Filter(winid: number, key: string): bool
+ if key == 'o'
+ silent! eval [][0]
+ return true
+ endif
+ return popup_filter_menu(winid, key)
+ enddef
+
+ popup_create('popup', #{filter: Filter})
+ feedkeys("o\r", 'xnt')
+ END
+ CheckScriptSuccess(lines)
+ enddef
+
def Fibonacci(n: number): number
if n < 2
return n
*** ../vim-8.2.1927/src/version.c 2020-10-30 20:46:22.670118038 +0100
--- src/version.c 2020-10-30 21:43:43.947963086 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 1928,
/**/

--
Two sheep in a meadow. One says "baaah". The other says "exactly!".

/// Bram Moolenaar -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages