To: vim_dev@googlegroups.com Subject: Patch 8.1.1189 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1189 Problem: Mode is not cleared when leaving Insert mode. Solution: Clear the mode when got_int is set. (Ozaki Kiichi, closes #4270) Files: src/edit.c, src/testdir/test_bufline.vim, src/testdir/test_messages.vim *** ../vim-8.1.1188/src/edit.c 2019-03-30 18:46:57.344077426 +0100 --- src/edit.c 2019-04-20 14:55:19.719612597 +0200 *************** *** 4564,4570 **** */ if (reg_recording != 0 || restart_edit != NUL) showmode(); ! else if (p_smd && !skip_showmode()) msg(""); return TRUE; /* exit Insert mode */ --- 4564,4570 ---- */ if (reg_recording != 0 || restart_edit != NUL) showmode(); ! else if (p_smd && (got_int || !skip_showmode())) msg(""); return TRUE; /* exit Insert mode */ *** ../vim-8.1.1188/src/testdir/test_bufline.vim 2018-09-21 16:59:40.113489779 +0200 --- src/testdir/test_bufline.vim 2019-04-20 14:55:19.719612597 +0200 *************** *** 18,24 **** let b = bufnr('%') wincmd w call assert_equal(1, setbufline(b, 5, ['x'])) ! call assert_equal(1, setbufline(1234, 1, ['x'])) call assert_equal(0, setbufline(b, 4, ['d', 'e'])) call assert_equal(['c'], getbufline(b, 3)) call assert_equal(['d'], getbufline(b, 4)) --- 18,24 ---- let b = bufnr('%') wincmd w call assert_equal(1, setbufline(b, 5, ['x'])) ! call assert_equal(1, setbufline(bufnr('$') + 1, 1, ['x'])) call assert_equal(0, setbufline(b, 4, ['d', 'e'])) call assert_equal(['c'], getbufline(b, 3)) call assert_equal(['d'], getbufline(b, 4)) *** ../vim-8.1.1188/src/testdir/test_messages.vim 2019-01-09 23:00:58.001176090 +0100 --- src/testdir/test_messages.vim 2019-04-20 14:55:19.719612597 +0200 *************** *** 1,5 **** --- 1,7 ---- " Tests for :messages, :echomsg, :echoerr + source shared.vim + function Test_messages() let oldmore = &more try *************** *** 92,94 **** --- 94,127 ---- call assert_match("function('\\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, "\") + call WaitForAssert({-> assert_match('^\s*$', term_getline(buf, rows))}) + + call term_sendkeys(buf, ":qall!\") + call WaitForAssert({-> assert_equal('dead', job_status(term_getjob(buf)))}) + exe buf . 'bwipe!' + call delete(testfile) + endfunc *** ../vim-8.1.1188/src/version.c 2019-04-20 14:39:42.796386124 +0200 --- src/version.c 2019-04-20 15:06:03.740022909 +0200 *************** *** 773,774 **** --- 773,776 ---- { /* Add new patch number below this line */ + /**/ + 1189, /**/ -- Experience is what you get when you don't get what you want. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///