Comment #2 on issue 48 by chrisbr...@gmail.com: E490 foldopen error can’t be caught
http://code.google.com/p/vim/issues/detail?id=48

Bram,
the problem is, the do{} while loop in ex_docmd.c in do_cmdline (line 1289).

If you look at this line:
&& !(did_emsg && used_getline
    && (getline_equal(fgetline, cookie, getexmodeline)
       || getline_equal(fgetline, cookie, getexline)))
Then the loop will always terminate, if did_emsg is set, even so a catch later on might actually catch the error. So one probably also needs to check whether a try-clause if active and if those, let the loop continue.

Something like this patch:

diff --git a/src/ex_docmd.c b/src/ex_docmd.c
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -1295,9 +1295,14 @@
                && cstack.cs_trylevel == 0
 #endif
            )
-           && !(did_emsg && used_getline
+           && !(used_getline
&& (getline_equal(fgetline, cookie, getexmodeline) - || getline_equal(fgetline, cookie, getexline))) + || getline_equal(fgetline, cookie, getexline))
+           && did_emsg
+#ifdef FEAT_EVAL
+           && cstack.cs_trylevel == 0
+#endif
+           )
            && (next_cmdline != NULL
 #ifdef FEAT_EVAL
                        || cstack.cs_idx >= 0

This almost works, except when using an unknown command like this:
try | foobar|catch|echom v:exception|endtry
then the loop won't terminate.
I am not sure, what the correct abort condition needs to be
in this case.
(and I don't understand all conditions in that loop).

--
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

Raspunde prin e-mail lui