Mercurial > vim
diff src/testdir/test_messages.vim @ 16374:57c37c17ff9d v8.1.1192
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
commit https://github.com/vim/vim/commit/4c25bd785aa8b565bf973cbba12ed36b76daaa4f
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 20 23:38:07 2019 +0200
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Problem: Mode is not cleared when leaving Insert mode with mapped Esc.
Solution: Clear the mode when redraw_cmdline is set. (closes https://github.com/vim/vim/issues/4269)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 20 Apr 2019 23:45:04 +0200 |
parents | a3b5cbd2effe |
children | 6990c1160ea5 |
line wrap: on
line diff
--- a/src/testdir/test_messages.vim +++ b/src/testdir/test_messages.vim @@ -125,3 +125,31 @@ func Test_mode_message_at_leaving_insert exe buf . 'bwipe!' call delete(testfile) endfunc + +func Test_mode_message_at_leaving_insert_with_esc_mapped() + if !has('terminal') || has('gui_running') + return + endif + + " Set custom statusline built by user-defined function. + let testfile = 'Xtest.vim' + call writefile([ + \ 'set laststatus=2', + \ 'inoremap <Esc> <Esc>00', + \ ], testfile) + + let rows = 10 + let buf = term_start([GetVimProg(), '--clean', '-S', testfile], {'term_rows': rows}) + call term_wait(buf, 200) + call assert_equal('run', job_status(term_getjob(buf))) + + call term_sendkeys(buf, "i") + call WaitForAssert({-> assert_match('^-- INSERT --\s*$', term_getline(buf, rows))}) + call term_sendkeys(buf, "\<Esc>") + call WaitForAssert({-> assert_match('^\s*$', term_getline(buf, rows))}) + + call term_sendkeys(buf, ":qall!\<CR>") + call WaitForAssert({-> assert_equal('dead', job_status(term_getjob(buf)))}) + exe buf . 'bwipe!' + call delete(testfile) +endfunc