To: vim_dev@googlegroups.com Subject: Patch 8.2.4346 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4346 Problem: A custom statusline may cause Esc to work like Enter on the command line when the popup menu is displayed. Solution: Save and restore KeyTyped. (closes #9749) Files: src/drawscreen.c, src/testdir/test_cmdline.vim, src/testdir/dumps/Test_wildmenu_pum_39.dump *** ../vim-8.2.4345/src/drawscreen.c 2022-02-08 12:07:41.831496906 +0000 --- src/drawscreen.c 2022-02-11 18:45:29.414316721 +0000 *************** *** 571,576 **** --- 571,577 ---- { static int entered = FALSE; int saved_did_emsg = did_emsg; + int saved_KeyTyped = KeyTyped; // When called recursively return. This can happen when the statusline // contains an expression that triggers a redraw. *************** *** 591,596 **** --- 592,600 ---- } did_emsg |= saved_did_emsg; entered = FALSE; + + // A user function may reset KeyTyped, restore it. + KeyTyped = saved_KeyTyped; } #endif *** ../vim-8.2.4345/src/testdir/test_cmdline.vim 2022-02-10 21:09:26.387235267 +0000 --- src/testdir/test_cmdline.vim 2022-02-11 18:42:43.446566124 +0000 *************** *** 1983,1988 **** --- 1983,1996 ---- return repeat(['aaaa'], 120) endfunc command -nargs=* -complete=customlist,CmdCompl Tcmd + + func MyStatusLine() abort + return 'status' + endfunc + func SetupStatusline() + set statusline=%!MyStatusLine() + set laststatus=2 + endfunc [CODE] call writefile(commands, 'Xtest') *************** *** 2166,2171 **** --- 2174,2186 ---- call term_sendkeys(buf, ":ls\") call term_sendkeys(buf, ":com\ ") call VerifyScreenDump(buf, 'Test_wildmenu_pum_38', {}) + call term_sendkeys(buf, "\\") + + " Esc still works to abort the command when 'statusline' is set + call term_sendkeys(buf, ":call SetupStatusline()\") + call term_sendkeys(buf, ":si\") + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_wildmenu_pum_39', {}) call term_sendkeys(buf, "\\") call StopVimInTerminal(buf) *** ../vim-8.2.4345/src/testdir/dumps/Test_wildmenu_pum_39.dump 2022-02-11 18:51:22.085821814 +0000 --- src/testdir/dumps/Test_wildmenu_pum_39.dump 2022-02-11 18:42:53.594550457 +0000 *************** *** 0 **** --- 1,10 ---- + > +0&#ffffff0@74 + |~+0#4040ff13&| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + |s+3#0000000&|t|a|t|u|s| @68 + | +0&&@74 *** ../vim-8.2.4345/src/version.c 2022-02-11 16:30:07.320908533 +0000 --- src/version.c 2022-02-11 18:33:34.211326740 +0000 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 4346, /**/ -- "Space is big. Really big. You just won't believe how vastly hugely mind- bogglingly big it is. I mean, you may think it's a long way down the road to the chemist, but that's just peanuts to space." -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy" /// 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 ///