Mercurial > vim
diff src/testdir/test_vim9_script.vim @ 24079:a9ff8368d35f v8.2.2581
patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Commit: https://github.com/vim/vim/commit/37294bd6a2afbf0fc8a1c34cbe102336b0bd0a82
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Mar 10 13:40:08 2021 +0100
patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Problem: Vim9: sourcing Vim9 script triggers a redraw.
Solution: Do not let setting/restoring 'cpoptions' cause a redraw.
(closes #7920)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 10 Mar 2021 13:45:03 +0100 |
parents | 5006d95ef82d |
children | 7d28bac98927 |
line wrap: on
line diff
--- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -5,6 +5,7 @@ source term_util.vim source view_util.vim source vim9.vim source shared.vim +source screendump.vim def Test_range_only() new @@ -3338,6 +3339,36 @@ def Test_restoring_cpo() set cpo&vim enddef +def Test_no_redraw_when_restoring_cpo() + CheckScreendump + + var lines =<< trim END + vim9script + def script#func() + enddef + END + mkdir('Xdir/autoload', 'p') + writefile(lines, 'Xdir/autoload/script.vim') + + lines =<< trim END + vim9script + set cpo+=M + exe 'set rtp^=' .. getcwd() .. '/Xdir' + au CmdlineEnter : ++once timer_start(0, () => script#func()) + setline(1, 'some text') + END + writefile(lines, 'XTest_redraw_cpo') + var buf = RunVimInTerminal('-S XTest_redraw_cpo', {'rows': 6}) + term_sendkeys(buf, "V:") + VerifyScreenDump(buf, 'Test_vim9_no_redraw', {}) + + # clean up + term_sendkeys(buf, "\<Esc>u") + StopVimInTerminal(buf) + delete('XTest_redraw_cpo') + delete('Xdir', 'rf') +enddef + def Test_unset_any_variable() var lines =<< trim END