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 #9613)
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 156a752..3f197ca 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -1630,6 +1630,28 @@
bwipe!
endfunc
+func Test_setbufvar_keep_window_title()
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ edit Xa.txt
+ let g:buf = bufadd('Xb.txt')
+ inoremap <F2> <C-R>=setbufvar(g:buf, '&autoindent', 1) ?? ''<CR>
+ END
+ call writefile(lines, 'Xsetbufvar')
+ let buf = RunVimInTerminal('-S Xsetbufvar', {})
+ call assert_match('Xa.txt', term_gettitle(buf))
+
+ call term_sendkeys(buf, "i\<F2>")
+ call TermWait(buf)
+ call term_sendkeys(buf, "\<Esc>")
+ 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=Operator<CR>g@
function Operator( type, ... )
@@ -2308,7 +2330,6 @@
func Test_state()
CheckRunVimInTerminal
- let g:test_is_flaky = 1
let getstate = ":echo 'state: ' .. g:state .. '; mode: ' .. g:mode\<CR>"