0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 7.4.1266

Problem:    A BufAdd autocommand may cause an ml_get error (Christian
            Brabandt)
Solution:   Increment RedrawingDisabled earlier.
This commit is contained in:
Bram Moolenaar 2016-02-06 15:29:40 +01:00
parent f416086f26
commit ab9fc7e0cf
2 changed files with 11 additions and 3 deletions

View File

@ -3268,6 +3268,7 @@ do_ecmd(
int did_get_winopts = FALSE; int did_get_winopts = FALSE;
#endif #endif
int readfile_flags = 0; int readfile_flags = 0;
int did_inc_redrawing_disabled = FALSE;
if (eap != NULL) if (eap != NULL)
command = eap->do_ecmd_cmd; command = eap->do_ecmd_cmd;
@ -3600,6 +3601,11 @@ do_ecmd(
oldbuf = (flags & ECMD_OLDBUF); 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 #ifdef FEAT_AUTOCMD
buf = curbuf; buf = curbuf;
#endif #endif
@ -3697,9 +3703,6 @@ do_ecmd(
/* /*
* If we get here we are sure to start editing * 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 */ /* Assume success now */
retval = OK; retval = OK;
@ -3899,6 +3902,7 @@ do_ecmd(
#endif #endif
--RedrawingDisabled; --RedrawingDisabled;
did_inc_redrawing_disabled = FALSE;
if (!skip_redraw) if (!skip_redraw)
{ {
n = p_so; n = p_so;
@ -3933,6 +3937,8 @@ do_ecmd(
#endif #endif
theend: theend:
if (did_inc_redrawing_disabled)
--RedrawingDisabled;
#ifdef FEAT_AUTOCMD #ifdef FEAT_AUTOCMD
if (did_set_swapcommand) if (did_set_swapcommand)
set_vim_var_string(VV_SWAPCOMMAND, NULL, -1); set_vim_var_string(VV_SWAPCOMMAND, NULL, -1);

View File

@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1266,
/**/ /**/
1265, 1265,
/**/ /**/