To: vim_dev@googlegroups.com Subject: Patch 8.2.0911 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0911 Problem: Crash when opening a buffer for the cmdline window fails. (Chris Barber) Solution: Check do_ecmd() succeeds. Reset got_int if "q" was used at the more prompt. (closes #6211) Files: src/ex_getln.c, src/testdir/test_cmdline.vim, src/testdir/dumps/Test_cmdwin_interrupted.dump *** ../vim-8.2.0910/src/ex_getln.c 2020-04-30 22:29:36.622024155 +0200 --- src/ex_getln.c 2020-06-06 15:05:01.132185217 +0200 *************** *** 682,688 **** // NOTE: must call restore_last_search_pattern() before returning! save_last_search_pattern(); ! if (!do_incsearch_highlighting(firstc, &search_delim, is_state, &skiplen, &patlen)) { restore_last_search_pattern(); return FAIL; --- 682,689 ---- // NOTE: must call restore_last_search_pattern() before returning! save_last_search_pattern(); ! if (!do_incsearch_highlighting(firstc, &search_delim, is_state, ! &skiplen, &patlen)) { restore_last_search_pattern(); return FAIL; *************** *** 4205,4214 **** ga_clear(&winsizes); return K_IGNORE; } ! cmdwin_type = get_cmdline_type(); // Create the command-line buffer empty. ! (void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL); apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf); (void)setfname(curbuf, (char_u *)"[Command Line]", NULL, TRUE); apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf); --- 4206,4224 ---- ga_clear(&winsizes); return K_IGNORE; } ! // Don't let quitting the More prompt make this fail. ! got_int = FALSE; // Create the command-line buffer empty. ! if (do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL) == FAIL) ! { ! // Some autocommand messed it up? ! win_close(curwin, TRUE); ! ga_clear(&winsizes); ! return Ctrl_C; ! } ! cmdwin_type = get_cmdline_type(); ! apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf); (void)setfname(curbuf, (char_u *)"[Command Line]", NULL, TRUE); apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf); *** ../vim-8.2.0910/src/testdir/test_cmdline.vim 2020-06-04 22:46:01.368159783 +0200 --- src/testdir/test_cmdline.vim 2020-06-06 15:05:45.159987387 +0200 *************** *** 1183,1188 **** --- 1183,1215 ---- call assert_equal(1, winnr('$')) endfunc + func Test_cmdwin_interrupted() + CheckScreendump + + " aborting the :smile output caused the cmdline window to use the current + " buffer. + let lines =<< trim [SCRIPT] + au WinNew * smile + [SCRIPT] + call writefile(lines, 'XTest_cmdwin') + + let buf = RunVimInTerminal('-S XTest_cmdwin', {'rows': 18}) + call TermWait(buf, 1000) + " open cmdwin + call term_sendkeys(buf, "q:") + call TermWait(buf, 500) + " quit more prompt for :smile command + call term_sendkeys(buf, "q") + call TermWait(buf, 500) + " execute a simple command + call term_sendkeys(buf, "aecho 'done'\") + call VerifyScreenDump(buf, 'Test_cmdwin_interrupted', {}) + + " clean up + call StopVimInTerminal(buf) + call delete('XTest_cmdwin') + endfunc + " Test for backtick expression in the command line func Test_cmd_backtick() %argd *** ../vim-8.2.0910/src/testdir/dumps/Test_cmdwin_interrupted.dump 2020-06-06 15:13:12.490059913 +0200 --- src/testdir/dumps/Test_cmdwin_interrupted.dump 2020-06-06 15:06:06.711891230 +0200 *************** *** 0 **** --- 1,18 ---- + > +0&#ffffff0@74 + |~+0#4040ff13&| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |d+0#0000000&|o|n|e| @52|0|,|0|-|1| @8|A|l@1| *** ../vim-8.2.0910/src/version.c 2020-06-06 13:23:42.169315432 +0200 --- src/version.c 2020-06-06 15:08:18.507312010 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 911, /**/ -- Facepalm statement #6: "Estland is a fantasy place, just like Middle Earth and Madagaskar" /// 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 ///