Bram,
I see a potential problem when running `:s/../\=Function/gn` command.
If the function aborts, the sandbox might still be set, which causes an
unusable Vim. This just happened to me several times with some errors in
Function. However, when trying to reproduce, aborting() does not seem to
return True with a simple error (like undefined variable or so), so I
don't currently know how to create a test for that :(
So here is just the patch:
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index b99e54bce..932e3d2f0 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -4880,7 +4880,7 @@ do_sub(exarg_T *eap)
pos_T old_cursor = curwin->w_cursor;
int start_nsubs;
#ifdef FEAT_EVAL
- int save_ma = 0;
+ int save_ma = curbuf->b_p_ma;
#endif
cmd = eap->arg;
@@ -5556,7 +5556,6 @@ do_sub(exarg_T *eap)
if (subflags.do_count)
{
/* prevent accidentally changing the buffer by a function */
- save_ma = curbuf->b_p_ma;
curbuf->b_p_ma = FALSE;
sandbox++;
}
@@ -5571,12 +5570,9 @@ do_sub(exarg_T *eap)
#ifdef FEAT_EVAL
// If getting the substitute string caused an error, don't do
// the replacement.
- if (aborting())
- goto skip;
-
// Don't keep flags set by a recursive call.
subflags = subflags_save;
- if (subflags.do_count)
+ if (aborting() || subflags.do_count)
{
curbuf->b_p_ma = save_ma;
if (sandbox > 0)
Mit freundlichen Grüßen
Christian
--
Blitzt und donnert es mit Schauern, kriecht das Vieh ins Bett zum Bauern.
--
--
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/20190518101140.GI2769%40256bit.org.
For more options, visit https://groups.google.com/d/optout.