Mercurial > vim
diff src/testdir/test_messages.vim @ 16368:a3b5cbd2effe v8.1.1189
patch 8.1.1189: mode is not cleared when leaving Insert mode
commit https://github.com/vim/vim/commit/abc7c7fc5a098374f5543a237e6c9dd918848b34
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 20 15:10:13 2019 +0200
patch 8.1.1189: mode is not cleared when leaving Insert mode
Problem: Mode is not cleared when leaving Insert mode.
Solution: Clear the mode when got_int is set. (Ozaki Kiichi, closes https://github.com/vim/vim/issues/4270)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 20 Apr 2019 15:15:05 +0200 |
parents | 63b02fcf1361 |
children | 57c37c17ff9d |
line wrap: on
line diff
--- a/src/testdir/test_messages.vim +++ b/src/testdir/test_messages.vim @@ -1,5 +1,7 @@ " Tests for :messages, :echomsg, :echoerr +source shared.vim + function Test_messages() let oldmore = &more try @@ -92,3 +94,34 @@ func Test_echoerr() call assert_match("function('<lambda>\\d*')", execute(':echoerr {-> 1234}')) call test_ignore_error('RESET') endfunc + +func Test_mode_message_at_leaving_insert_by_ctrl_c() + if !has('terminal') || has('gui_running') + return + endif + + " Set custom statusline built by user-defined function. + let testfile = 'Xtest.vim' + call writefile([ + \ 'func StatusLine() abort', + \ ' return ""', + \ 'endfunc', + \ 'set statusline=%!StatusLine()', + \ 'set laststatus=2', + \ ], 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, "\<C-C>") + 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