# HG changeset patch # User Bram Moolenaar # Date 1643055303 -3600 # Node ID dfaba853a792a571a0a58ac8a7f956aa6ceaf97b # Parent e5c83812d1738d973eba657dd0a89f3130f003b1 patch 8.2.4208: using setbufvar() may change the window title Commit: https://github.com/vim/vim/commit/dff97e65eb1bb24c44c2b7430a480888d8afb3f4 Author: Bram Moolenaar Date: Mon Jan 24 20:00:55 2022 +0000 patch 8.2.4208: using setbufvar() may change the window title Problem: Using setbufvar() may change the window title. Solution: Do not redraw when creating the autocommand window. (closes https://github.com/vim/vim/issues/9613) diff --git a/src/autocmd.c b/src/autocmd.c --- a/src/autocmd.c +++ b/src/autocmd.c @@ -1518,7 +1518,10 @@ aucmd_prepbuf( p_acd = FALSE; #endif + // no redrawing and don't set the window title + ++RedrawingDisabled; (void)win_split_ins(0, WSP_TOP, aucmd_win, 0); + --RedrawingDisabled; (void)win_comp_pos(); // recompute window positions p_ea = save_ea; #ifdef FEAT_AUTOCHDIR diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim --- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -1630,6 +1630,28 @@ func Test_setbufvar_options() bwipe! endfunc +func Test_setbufvar_keep_window_title() + CheckRunVimInTerminal + + let lines =<< trim END + edit Xa.txt + let g:buf = bufadd('Xb.txt') + inoremap =setbufvar(g:buf, '&autoindent', 1) ?? '' + END + call writefile(lines, 'Xsetbufvar') + let buf = RunVimInTerminal('-S Xsetbufvar', {}) + call assert_match('Xa.txt', term_gettitle(buf)) + + call term_sendkeys(buf, "i\") + call TermWait(buf) + call term_sendkeys(buf, "\") + call TermWait(buf) + call assert_match('Xa.txt', term_gettitle(buf)) + + call StopVimInTerminal(buf) + call delete('Xsetbufvar') +endfunc + func Test_redo_in_nested_functions() nnoremap g. :set opfunc=Operatorg@ function Operator( type, ... ) @@ -2308,7 +2330,6 @@ endfunc func Test_state() CheckRunVimInTerminal - let g:test_is_flaky = 1 let getstate = ":echo 'state: ' .. g:state .. '; mode: ' .. g:mode\" diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4208, +/**/ 4207, /**/ 4206,