To: vim_dev@googlegroups.com Subject: Patch 7.4.1961 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1961 Problem: When 'insertmode' is reset while doing completion the popup menu remains even though Vim is in Normal mode. Solution: Ignore stop_insert_mode when the popup menu is visible. Don't set stop_insert_mode when 'insertmode' was already off. (Christian Brabandt) Files: src/edit.c, src/option.c, src/Makefile, src/testdir/test_alot.vim, src/testdir/test_popup.vim *** ../vim-7.4.1960/src/edit.c 2016-06-12 21:18:38.203260733 +0200 --- src/edit.c 2016-06-26 18:06:21.432577825 +0200 *************** *** 649,655 **** if (update_Insstart_orig) Insstart_orig = Insstart; ! if (stop_insert_mode) { /* ":stopinsert" used or 'insertmode' reset */ count = 0; --- 649,659 ---- if (update_Insstart_orig) Insstart_orig = Insstart; ! if (stop_insert_mode ! #ifdef FEAT_INS_EXPAND ! && !pum_visible() ! #endif ! ) { /* ":stopinsert" used or 'insertmode' reset */ count = 0; *** ../vim-7.4.1960/src/option.c 2016-06-04 20:25:01.181991001 +0200 --- src/option.c 2016-06-26 18:09:53.872804547 +0200 *************** *** 8001,8007 **** need_start_insertmode = TRUE; stop_insert_mode = FALSE; } ! else { need_start_insertmode = FALSE; stop_insert_mode = TRUE; --- 8001,8008 ---- need_start_insertmode = TRUE; stop_insert_mode = FALSE; } ! /* only reset if it was set previously */ ! else if (old_value) { need_start_insertmode = FALSE; stop_insert_mode = TRUE; *** ../vim-7.4.1960/src/Makefile 2016-06-26 16:24:01.285129401 +0200 --- src/Makefile 2016-06-26 17:57:49.725666274 +0200 *************** *** 2045,2050 **** --- 2045,2051 ---- test_packadd \ test_partial \ test_perl \ + test_popup \ test_quickfix \ test_regexp_latin \ test_regexp_utf8 \ *** ../vim-7.4.1960/src/testdir/test_alot.vim 2016-05-24 11:31:10.523505120 +0200 --- src/testdir/test_alot.vim 2016-06-26 17:56:46.578787799 +0200 *************** *** 21,26 **** --- 21,27 ---- source test_menu.vim source test_messages.vim source test_partial.vim + source test_popup.vim source test_reltime.vim source test_searchpos.vim source test_set.vim *** ../vim-7.4.1960/src/testdir/test_popup.vim 2016-06-26 18:36:24.892543964 +0200 --- src/testdir/test_popup.vim 2016-06-26 18:31:32.961729560 +0200 *************** *** 0 **** --- 1,35 ---- + " Test for completion menu + + inoremap =ListMonths() + let g:months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] + let g:setting = '' + + func ListMonths() + if g:setting != '' + exe ":set" g:setting + endif + call complete(col('.'), g:months) + return '' + endfunc + + func! Test_popup_completion_insertmode() + new + call feedkeys("a\\\\", 'tx') + call assert_equal('February', getline(1)) + %d + let g:setting = 'noinsertmode' + call feedkeys("a\\\\", 'tx') + call assert_equal('February', getline(1)) + call assert_false(pumvisible()) + %d + let g:setting = '' + call feedkeys("a\". repeat("\",12)."\\", 'tx') + call assert_equal('', getline(1)) + %d + call feedkeys("a\\\\", 'tx') + call assert_equal('', getline(1)) + %d + call feedkeys("a\\\\\", 'tx') + call assert_equal('December', getline(1)) + bwipe! + endfunc *** ../vim-7.4.1960/src/version.c 2016-06-26 17:53:02.814756926 +0200 --- src/version.c 2016-06-26 18:36:07.992844156 +0200 *************** *** 755,756 **** --- 755,758 ---- { /* Add new patch number below this line */ + /**/ + 1961, /**/ -- hundred-and-one symptoms of being an internet addict: 137. You decide to stay in college for an additional year or two, just so you can have the free Internet access. /// 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 ///