summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-02-06 15:29:40 +0100
committerBram Moolenaar <Bram@vim.org>2016-02-06 15:29:40 +0100
commitab9fc7e0cf22bcee119b62d3433cac60f405e645 (patch)
treeacdab1b67db38bc80f1febfbc191aec9912e2e1c
parentf416086f264c1d998863b2e600f4c14f799d0d99 (diff)
downloadvim-ab9fc7e0cf22bcee119b62d3433cac60f405e645.zip
patch 7.4.1266
Problem: A BufAdd autocommand may cause an ml_get error (Christian Brabandt) Solution: Increment RedrawingDisabled earlier.
-rw-r--r--src/ex_cmds.c12
-rw-r--r--src/version.c2
2 files changed, 11 insertions, 3 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 3efdf8bbb..78d9f9561 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -3268,6 +3268,7 @@ do_ecmd(
int did_get_winopts = FALSE;
#endif
int readfile_flags = 0;
+ int did_inc_redrawing_disabled = FALSE;
if (eap != NULL)
command = eap->do_ecmd_cmd;
@@ -3600,6 +3601,11 @@ do_ecmd(
oldbuf = (flags & ECMD_OLDBUF);
}
+ /* Don't redraw until the cursor is in the right line, otherwise
+ * autocommands may cause ml_get errors. */
+ ++RedrawingDisabled;
+ did_inc_redrawing_disabled = TRUE;
+
#ifdef FEAT_AUTOCMD
buf = curbuf;
#endif
@@ -3697,9 +3703,6 @@ do_ecmd(
/*
* If we get here we are sure to start editing
*/
- /* don't redraw until the cursor is in the right line */
- ++RedrawingDisabled;
-
/* Assume success now */
retval = OK;
@@ -3899,6 +3902,7 @@ do_ecmd(
#endif
--RedrawingDisabled;
+ did_inc_redrawing_disabled = FALSE;
if (!skip_redraw)
{
n = p_so;
@@ -3933,6 +3937,8 @@ do_ecmd(
#endif
theend:
+ if (did_inc_redrawing_disabled)
+ --RedrawingDisabled;
#ifdef FEAT_AUTOCMD
if (did_set_swapcommand)
set_vim_var_string(VV_SWAPCOMMAND, NULL, -1);
diff --git a/src/version.c b/src/version.c
index 42cbad4e5..51f0503c6 100644
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1266,
+/**/
1265,
/**/
1264,