Wednesday, October 23, 2019

Re: [vim/vim] :cdo does not abort on error (and the test for it seems wrong) (#5102)

diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 81f2c8f5b..c03346878 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -1130,7 +1130,8 @@ ex_listdo(exarg_T *eap)
if (eap->cmdidx == CMD_cdo || eap->cmdidx == CMD_ldo
|| eap->cmdidx == CMD_cfdo || eap->cmdidx == CMD_lfdo)
{
- if (i >= qf_size || i >= eap->line2)
+ if (did_emsg || got_int || did_throw
+ || i >= qf_size || i >= eap->line2)
break;

qf_idx = qf_get_cur_idx(eap);
Hi Ralf,

Thanks for testing the changes. See below.

On Tue, Oct 22, 2019 at 12:01 PM Ralf Schandl <ralf.schandl@gmx.de> wrote:
>
> On 21.10.19 21:57, Yegappan Lakshmanan wrote:
> > Hi,
> >
> > On Mon, Oct 21, 2019 at 12:12 PM D. Ben Knoble
> ...
> >
> > Hi,
> >
> > Can you try the attached patch?
> >
> > Thanks,
> > Yegappan
> >
>
> Yegappan,
>
> thank you for providing a patch.
>
> It seems the patch didn't make it to GitHub. I pinged Ben & Dedowsdi via
> stackexchange. Hope they see it.
>
> I tested your patch in three ways:
>
> 1) :cdo s/TEST/HELLO/
>
> This will always fail, as there is no string "TEST" in any line. This
> error was ignored and :cdo worked on all lines.
>
> Is that intended?
>

Can you try the attached patch to see whether this is fixed? I am not able
to reproduce this behavior.

Thanks,
Yegappan

>
> 2) Calling a function from :cdo
>
> I build a qf list by :vimgrep for the word "dog". The function should
> replace "dog" with "cat". On the third invocation it throws an exception.
>
> 2.1) :cdo call Test_cdo()
>
> The first two entries were replaced and on the third entry a exception
> was thrown. Processing stops immediately. All other "dog"s were unchanged.
>
> 2.2) :cdo silent call Test_cdo()
>
> Acts like 2.1
>
> 2.3) :cdo silent! call Test_cdo()
>
> Ignores the exception and works on all entries of the qf list.
>
> 3) :cdo echo x
>
> The variable x is not defined. This was detected and the command was
> executed for the first entry of the qf list.
> With 'silent!' it processes all entries from the list.
>
> I'm not sure if the behavior in the first test case is intended. In the
> other two cases it worked like I expected.
>
> Regards,
> Ralf
>

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAAW7x7nbArhopqYwo7Z%2BU4Xeqnjg3%3D7%3D_n3nHo2Ysc51b-VoUw%40mail.gmail.com.

No comments:

Post a Comment