diff options
author | lonerover <pathfinder1644@yahoo.com> | 2017-01-04 13:16:21 +0800 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-01-04 06:16:21 +0100 |
commit | c56411ed87fe560149b68e67f63916f829affd1b (patch) | |
tree | 553b7e032138a878fd7926359822ed8437766d26 /src | |
parent | 15259c4b84c4de8aa7a7535c0195db3fd47d363e (diff) | |
download | rneovim-c56411ed87fe560149b68e67f63916f829affd1b.tar.gz rneovim-c56411ed87fe560149b68e67f63916f829affd1b.tar.bz2 rneovim-c56411ed87fe560149b68e67f63916f829affd1b.zip |
vim-patch:7.4.2043 (#5871)
Problem: setbuvfar() causes a screen redraw.
Solution: Only use aucmd_prepbuf() for options.
https://github.com/vim/vim/commit/93431df9eb02f7cf3d7f2142bb1bef24c5f325b2
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval.c | 20 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
2 files changed, 13 insertions, 9 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 006698d134..2e0b67593c 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -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) { buf_T *buf; - aco_save_T aco; char_u *varname, *bufvarname; typval_T *varp; char_u nbuf[NUMBUFLEN]; @@ -15086,29 +15085,34 @@ static void f_setbufvar(typval_T *argvars, typval_T *rettv, FunPtr fptr) varp = &argvars[2]; if (buf != NULL && varname != NULL && varp != NULL) { - /* set curbuf to be our buf, temporarily */ - aucmd_prepbuf(&aco, buf); - if (*varname == '&') { long numval; 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; numval = get_tv_number_chk(varp, &error); strval = get_tv_string_buf_chk(varp, nbuf); if (!error && strval != NULL) set_option_value(varname, numval, strval, OPT_LOCAL); + + // reset notion of buffer + aucmd_restbuf(&aco); } else { + buf_T *save_curbuf = curbuf; + bufvarname = xmalloc(STRLEN(varname) + 3); + curbuf = buf; STRCPY(bufvarname, "b:"); STRCPY(bufvarname + 2, varname); set_var(bufvarname, varp, TRUE); xfree(bufvarname); + curbuf = save_curbuf; } - - /* reset notion of buffer */ - aucmd_restbuf(&aco); } } diff --git a/src/nvim/version.c b/src/nvim/version.c index 7e08536b4e..678183107a 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -397,7 +397,7 @@ static int included_patches[] = { // 2046, // 2045 NA // 2044, - // 2043, + 2043, // 2042 NA // 2041 NA // 2040 NA |