Christian Brabandt wrote:

> >> I think, this happens, because after the error, did_emsg isn't reset yet
> >> when calling the foldtext() function. I am not sure, if it is safe to
> >> reset did_emsg in main_loop() earlier, but at the very least, we
> >> can guard updatescreen(0) by temporarily resetting did_emsg, like the
> >> attached patch does.
> >
> > Where does the value of did_emsg get used then?  It's not obvious,
> > get_foldtext() doesn't check it.
> 
> Well get_foldtext() walks up the entire eval() stack again. And in eval7()
> you have in line 5163
> 
> /* Invoke the function */
> ret = get_func_tv(...)
> Here ret gets OK from the function call, and then a couple of lines
> later:
> 
> if (aborting())
> {
>     if (re == OK)
>         clear_tv(rettv);
>     ret = FAIL;
> }
> 
> ret will be set to FAIL because aborting() I think checks the old
> did_emsg variable.
> 
> Since the evaluation fails, it returns NULL to text in get_foldtext()
> and so in get_foldtext() text will be set to NULL and it runs into
> this statement:
> 
> if (text == NULL)
> #endif
> {    sprintf((char *)buf, _("+--%3ld lines folded "), [...]
> and so the foldtext() function returns the wrong text.

OK, so it's deep down in eval.

What should happen is when evaluating 'foldtext' it should check if this
results in an error, and then stop evaluating it.  Like what happens in
win_line() with b_syn_error.  It's a bit more work, but it's probably
the right way to do it.

-- 
Don't believe everything you hear or anything you say.

 /// 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].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui