Patch 8.2.3082
Problem: A channel command "echoerr" does not show anything.
Solution: Do not use silent errors when using an "echoerr" command.
(closes #8494)
Files: src/channel.c, src/testdir/test_channel.py,
src/testdir/test_channel.vim
*** ../vim-8.2.3081/src/channel.c 2021-06-30 22:00:13.600511975 +0200
--- src/channel.c 2021-07-01 21:55:25.617534799 +0200
***************
*** 2486,2497 ****
if (STRCMP(cmd, "ex") == 0)
{
! int called_emsg_before = called_emsg;
ch_log(channel, "Executing ex command '%s'", (char *)arg);
! ++emsg_silent;
do_cmdline_cmd(arg);
! --emsg_silent;
if (called_emsg > called_emsg_before)
ch_log(channel, "Ex command error: '%s'",
(char *)get_vim_var_str(VV_ERRMSG));
--- 2486,2502 ----
if (STRCMP(cmd, "ex") == 0)
{
! int called_emsg_before = called_emsg;
! char_u *p = arg;
! int do_emsg_silent;
ch_log(channel, "Executing ex command '%s'", (char *)arg);
! do_emsg_silent = !checkforcmd(&p, "echoerr", 5);
! if (do_emsg_silent)
! ++emsg_silent;
do_cmdline_cmd(arg);
! if (do_emsg_silent)
! --emsg_silent;
if (called_emsg > called_emsg_before)
ch_log(channel, "Ex command error: '%s'",
(char *)get_vim_var_str(VV_ERRMSG));
*** ../vim-8.2.3081/src/testdir/test_channel.py 2020-05-17 22:33:49.943137285
+0200
--- src/testdir/test_channel.py 2021-07-01 19:50:33.422312291 +0200
***************
*** 109,114 ****
--- 109,119 ----
print("sending: {0}".format(cmd))
self.request.sendall(cmd.encode('utf-8'))
response = "ok"
+ elif decoded[1] == 'echoerr':
+ cmd = '["ex","echoerr \\\"this is an error\\\""]'
+ print("sending: {0}".format(cmd))
+ self.request.sendall(cmd.encode('utf-8'))
+ response = "ok"
elif decoded[1] == 'bad command':
cmd = '["ex","foo bar"]'
print("sending: {0}".format(cmd))
*** ../vim-8.2.3081/src/testdir/test_channel.vim 2020-11-23
18:14:51.272875917 +0100
--- src/testdir/test_channel.vim 2021-07-01 22:06:55.924150165 +0200
***************
*** 115,120 ****
--- 115,132 ----
call WaitForAssert({-> assert_equal("added2", getline("$"))})
call assert_equal('added1', getline(line('$') - 1))
+ " Request command "echoerr 'this is an error'".
+ " This will throw an exception, catch it here.
+ let caught = 'no'
+ try
+ call assert_equal('ok', ch_evalexpr(handle, 'echoerr'))
+ catch /this is an error/
+ let caught = 'yes'
+ endtry
+ if caught != 'yes'
+ call assert_report("Expected exception from error message")
+ endif
+
" Request command "foo bar", which fails silently.
call assert_equal('ok', ch_evalexpr(handle, 'bad command'))
call WaitForAssert({-> assert_match("E492:.*foo bar", v:errmsg)})
*** ../vim-8.2.3081/src/version.c 2021-06-30 22:00:13.600511975 +0200
--- src/version.c 2021-07-01 22:09:14.491878275 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3082,
/**/
--
hundred-and-one symptoms of being an internet addict:
70. ISDN lines are added to your house on a hourly basis
/// 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/202107012011.161KBvBO1800743%40masaka.moolenaar.net.