diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-08-21 16:14:54 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-08-21 16:16:22 +0800 |
commit | 893437512c51fb31b4f99b90357e2b15e5b0c73b (patch) | |
tree | 0ee3d77dd1c646fe2288538fa7b8bb597f65121e | |
parent | dc01d68f27a0d80da62bac690e9ca4647bc70dd9 (diff) | |
download | rneovim-893437512c51fb31b4f99b90357e2b15e5b0c73b.tar.gz rneovim-893437512c51fb31b4f99b90357e2b15e5b0c73b.tar.bz2 rneovim-893437512c51fb31b4f99b90357e2b15e5b0c73b.zip |
vim-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 vim/vim#9613)
https://github.com/vim/vim/commit/dff97e65eb1bb24c44c2b7430a480888d8afb3f4
Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r-- | test/functional/ui/title_spec.lua | 2 | ||||
-rw-r--r-- | test/old/testdir/test_functions.vim | 23 |
2 files changed, 23 insertions, 2 deletions
diff --git a/test/functional/ui/title_spec.lua b/test/functional/ui/title_spec.lua index 2247d2e80f..66c0ff5c9c 100644 --- a/test/functional/ui/title_spec.lua +++ b/test/functional/ui/title_spec.lua @@ -49,7 +49,7 @@ describe('title', function() end) it('calling setbufvar() to set an option in a hidden buffer from i_CTRL-R', function() - command([[inoremap <F2> <C-R>=setbufvar(]]..buf2..[[, '&autoindent', 1) ? '' : ''<CR>]]) + command([[inoremap <F2> <C-R>=setbufvar(]]..buf2..[[, '&autoindent', 1) ?? ''<CR>]]) feed('i<F2><Esc>') command('redraw!') screen:expect(function() diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim index 1d713e91ce..c1952d82b0 100644 --- a/test/old/testdir/test_functions.vim +++ b/test/old/testdir/test_functions.vim @@ -2009,6 +2009,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 <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, ... ) @@ -2567,7 +2589,6 @@ endfunc func Test_state() CheckRunVimInTerminal - let g:test_is_flaky = 1 let getstate = ":echo 'state: ' .. g:state .. '; mode: ' .. g:mode\<CR>" |