To: vim_dev@googlegroups.com Subject: Patch 8.2.2908 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2908 Problem: Crash when using a terminal popup window from the cmdline window. Solution: Instead of checking cmdwin_type call cmdwin_is_active(). (closes #8286) Files: src/terminal.c, src/errors.h, src/testdir/test_cmdline.vim, src/testdir/dumps/Test_cmdwin_no_terminal.dump *** ../vim-8.2.2907/src/terminal.c 2021-05-08 20:09:21.208327902 +0200 --- src/terminal.c 2021-05-30 13:48:53.485799409 +0200 *************** *** 445,450 **** --- 445,457 ---- if (check_restricted() || check_secure()) return NULL; + #ifdef FEAT_CMDWIN + if (cmdwin_type != 0) + { + emsg(_(e_cannot_open_terminal_from_command_line_window)); + return NULL; + } + #endif if ((opt->jo_set & (JO_IN_IO + JO_OUT_IO + JO_ERR_IO)) == (JO_IN_IO + JO_OUT_IO + JO_ERR_IO) *** ../vim-8.2.2907/src/errors.h 2021-05-29 19:53:46.455055663 +0200 --- src/errors.h 2021-05-30 13:49:05.317765678 +0200 *************** *** 415,417 **** --- 415,419 ---- INIT(= N_("E1186: Expression does not result in a value: %s")); EXTERN char e_failed_to_source_defaults[] INIT(= N_("E1187: Failed to source defaults.vim")); + EXTERN char e_cannot_open_terminal_from_command_line_window[] + INIT(= N_("E1188: Cannot open a terminal from the command line window")); *** ../vim-8.2.2907/src/testdir/test_cmdline.vim 2021-05-26 19:49:06.420241287 +0200 --- src/testdir/test_cmdline.vim 2021-05-30 13:46:46.582160116 +0200 *************** *** 1192,1197 **** --- 1192,1211 ---- call delete('XTest_restore') endfunc + func Test_cmdwin_no_terminal() + CheckFeature cmdwin + CheckFeature terminal + + let buf = RunVimInTerminal('', {'rows': 12}) + call TermWait(buf, 50) + call term_sendkeys(buf, ":set cmdheight=2\") + call term_sendkeys(buf, "q:") + call term_sendkeys(buf, ":let buf = term_start(['/bin/echo'], #{hidden: 1})\") + call VerifyScreenDump(buf, 'Test_cmdwin_no_terminal', {}) + call term_sendkeys(buf, ":q\") + call StopVimInTerminal(buf) + endfunc + func Test_buffers_lastused() " check that buffers are sorted by time when wildmode has lastused call test_settime(1550020000) " middle *** ../vim-8.2.2907/src/testdir/dumps/Test_cmdwin_no_terminal.dump 2021-05-30 13:52:41.489146700 +0200 --- src/testdir/dumps/Test_cmdwin_no_terminal.dump 2021-05-30 13:51:11.081406142 +0200 *************** *** 0 **** --- 1,12 ---- + | +0&#ffffff0@74 + |[+1&&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1 + |:+0#4040ff13&|s+0#af5f00255&|e|t| +0#0000000&|c+0#e000e06&|m|d|h|e|i|g|h|t|=+0#0000000&|2| @58 + |:+0#4040ff13&> +0#0000000&@73 + |~+0#4040ff13&| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |[+3#0000000&|C|o|m@1|a|n|d| |L|i|n|e|]| @42|2|,|0|-|1| @9|A|l@1 + |E+0#ffffff16#e000002|1@1|8@1|:| |C|a|n@1|o|t| |o|p|e|n| |a| |t|e|r|m|i|n|a|l| |f|r|o|m| |t|h|e| |c|o|m@1|a|n|d| |l|i|n|e| |w|i|n|d|o|w| +0#0000000#ffffff0@16 + @75 *** ../vim-8.2.2907/src/version.c 2021-05-29 22:34:15.410318351 +0200 --- src/version.c 2021-05-30 13:52:17.737214932 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2908, /**/ -- The war between Emacs and Vi is over. Vi has won with 3 to 1. http://m.linuxjournal.com/files/linuxjournal.com/linuxjournal/articles/030/3044/3044s1.html /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///