vim-patch:7.4.2043 (#5871)

Problem:    setbuvfar() causes a screen redraw.
Solution:   Only use aucmd_prepbuf() for options.

93431df9eb
This commit is contained in:
lonerover 2017-01-04 13:16:21 +08:00 committed by Justin M. Keyes
parent 15259c4b84
commit c56411ed87
2 changed files with 13 additions and 9 deletions

View File

@ -15073,7 +15073,6 @@ static void f_serverstop(typval_T *argvars, typval_T *rettv, FunPtr fptr)
static void f_setbufvar(typval_T *argvars, typval_T *rettv, FunPtr fptr) static void f_setbufvar(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{ {
buf_T *buf; buf_T *buf;
aco_save_T aco;
char_u *varname, *bufvarname; char_u *varname, *bufvarname;
typval_T *varp; typval_T *varp;
char_u nbuf[NUMBUFLEN]; char_u nbuf[NUMBUFLEN];
@ -15086,29 +15085,34 @@ static void f_setbufvar(typval_T *argvars, typval_T *rettv, FunPtr fptr)
varp = &argvars[2]; varp = &argvars[2];
if (buf != NULL && varname != NULL && varp != NULL) { if (buf != NULL && varname != NULL && varp != NULL) {
/* set curbuf to be our buf, temporarily */
aucmd_prepbuf(&aco, buf);
if (*varname == '&') { if (*varname == '&') {
long numval; long numval;
char_u *strval; char_u *strval;
int error = FALSE; int error = false;
aco_save_T aco;
// set curbuf to be our buf, temporarily
aucmd_prepbuf(&aco, buf);
++varname; ++varname;
numval = get_tv_number_chk(varp, &error); numval = get_tv_number_chk(varp, &error);
strval = get_tv_string_buf_chk(varp, nbuf); strval = get_tv_string_buf_chk(varp, nbuf);
if (!error && strval != NULL) if (!error && strval != NULL)
set_option_value(varname, numval, strval, OPT_LOCAL); set_option_value(varname, numval, strval, OPT_LOCAL);
// reset notion of buffer
aucmd_restbuf(&aco);
} else { } else {
buf_T *save_curbuf = curbuf;
bufvarname = xmalloc(STRLEN(varname) + 3); bufvarname = xmalloc(STRLEN(varname) + 3);
curbuf = buf;
STRCPY(bufvarname, "b:"); STRCPY(bufvarname, "b:");
STRCPY(bufvarname + 2, varname); STRCPY(bufvarname + 2, varname);
set_var(bufvarname, varp, TRUE); set_var(bufvarname, varp, TRUE);
xfree(bufvarname); xfree(bufvarname);
curbuf = save_curbuf;
} }
/* reset notion of buffer */
aucmd_restbuf(&aco);
} }
} }

View File

@ -397,7 +397,7 @@ static int included_patches[] = {
// 2046, // 2046,
// 2045 NA // 2045 NA
// 2044, // 2044,
// 2043, 2043,
// 2042 NA // 2042 NA
// 2041 NA // 2041 NA
// 2040 NA // 2040 NA