]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 7.4.1266 v7.4.1266
authorBram Moolenaar <Bram@vim.org>
Sat, 6 Feb 2016 14:29:40 +0000 (15:29 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 6 Feb 2016 14:29:40 +0000 (15:29 +0100)
Problem:    A BufAdd autocommand may cause an ml_get error (Christian
            Brabandt)
Solution:   Increment RedrawingDisabled earlier.

src/ex_cmds.c
src/version.c

index 3efdf8bbbbf4138c04fca0909346123a0a5b2fbc..78d9f95613e6967c744f826b5c1df69503559a78 100644 (file)
@@ -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);
index 42cbad4e54de2ead4f4fc783d8ec37fc7f136866..51f0503c699ada6b40f8e9684575c4d877ca3e12 100644 (file)
@@ -742,6 +742,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1266,
 /**/
     1265,
 /**/