To: vim_dev@googlegroups.com Subject: Patch 8.1.2108 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2108 Problem: Cannot close the cmdline window from CmdWinEnter. (George Brown) Solution: Reset cmdwin_result earlier. (Christian Brabandt, closes #4980) Files: src/ex_getln.c, src/testdir/test_autocmd.vim *** ../vim-8.1.2107/src/ex_getln.c 2019-09-21 23:09:00.971830733 +0200 --- src/ex_getln.c 2019-10-01 17:35:52.644828030 +0200 *************** *** 136,146 **** // Struct to store the state of 'incsearch' highlighting. typedef struct { pos_T search_start; // where 'incsearch' starts searching ! pos_T save_cursor; viewstate_T init_viewstate; viewstate_T old_viewstate; ! pos_T match_start; ! pos_T match_end; int did_incsearch; int incsearch_postponed; int magic_save; --- 136,146 ---- // Struct to store the state of 'incsearch' highlighting. typedef struct { pos_T search_start; // where 'incsearch' starts searching ! pos_T save_cursor; viewstate_T init_viewstate; viewstate_T old_viewstate; ! pos_T match_start; ! pos_T match_end; int did_incsearch; int incsearch_postponed; int magic_save; *************** *** 4152,4163 **** invalidate_botline(); redraw_later(SOME_VALID); ! /* No Ex mode here! */ exmode_active = 0; State = NORMAL; setmouse(); // Trigger CmdwinEnter autocommands. trigger_cmd_autocmd(cmdwin_type, EVENT_CMDWINENTER); if (restart_edit != 0) // autocmd with ":startinsert" --- 4152,4166 ---- invalidate_botline(); redraw_later(SOME_VALID); ! // No Ex mode here! exmode_active = 0; State = NORMAL; setmouse(); + // Reset here so it can be set by a CmdWinEnter autocommand. + cmdwin_result = 0; + // Trigger CmdwinEnter autocommands. trigger_cmd_autocmd(cmdwin_type, EVENT_CMDWINENTER); if (restart_edit != 0) // autocmd with ":startinsert" *************** *** 4169,4175 **** /* * Call the main loop until or CTRL-C is typed. */ - cmdwin_result = 0; main_loop(TRUE, FALSE); RedrawingDisabled = i; --- 4172,4177 ---- *** ../vim-8.1.2107/src/testdir/test_autocmd.vim 2019-09-22 23:24:09.810153903 +0200 --- src/testdir/test_autocmd.vim 2019-10-01 17:34:24.061216345 +0200 *************** *** 2259,2261 **** --- 2259,2290 ---- call StopVimInTerminal(buf) call delete('XSafeState') endfunc + + func Test_autocmd_CmdWinEnter() + CheckRunVimInTerminal + " There is not cmdwin switch, so + " test for cmdline_hist + " (both are available with small builds) + CheckFeature cmdline_hist + let lines =<< trim END + let b:dummy_var = 'This is a dummy' + autocmd CmdWinEnter * quit + let winnr = winnr('$') + END + let filename='XCmdWinEnter' + call writefile(lines, filename) + let buf = RunVimInTerminal('-S '.filename, #{rows: 6}) + + call term_sendkeys(buf, "q:") + call term_wait(buf) + call term_sendkeys(buf, ":echo b:dummy_var\") + call WaitForAssert({-> assert_match('^This is a dummy', term_getline(buf, 6))}, 1000) + call term_sendkeys(buf, ":echo &buftype\") + call WaitForAssert({-> assert_notmatch('^nofile', term_getline(buf, 6))}, 1000) + call term_sendkeys(buf, ":echo winnr\") + call WaitForAssert({-> assert_match('^1', term_getline(buf, 6))}, 1000) + + " clean up + call StopVimInTerminal(buf) + call delete(filename) + endfunc *** ../vim-8.1.2107/src/version.c 2019-10-01 17:01:56.346282798 +0200 --- src/version.c 2019-10-01 17:37:50.668304059 +0200 *************** *** 755,756 **** --- 755,758 ---- { /* Add new patch number below this line */ + /**/ + 2108, /**/ -- LAUNCELOT: I am, sir. I am a Knight of King Arthur. FATHER: 'Mm ... very nice castle, Camelot ... very good pig country.... "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///