Patch 8.2.4738

7 views
Skip to first unread message

Bram Moolenaar

unread,
Apr 11, 2022, 2:39:45 PM4/11/22
to vim...@googlegroups.com

Patch 8.2.4738
Problem: Esc on commandline executes command instead of abandoning it.
Solution: Save and restore KeyTyped when removing the popup menu.
(closes #10154)
Files: src/cmdexpand.c, src/testdir/test_cmdline.vim,
src/testdir/dumps/Test_wildmenu_with_pum_foldexpr_1.dump,
src/testdir/dumps/Test_wildmenu_with_pum_foldexpr_2.dump


*** ../vim-8.2.4737/src/cmdexpand.c 2022-04-10 18:09:03.075959743 +0100
--- src/cmdexpand.c 2022-04-11 19:33:52.367440846 +0100
***************
*** 378,383 ****
--- 378,384 ----
void cmdline_pum_remove(void)
{
int save_p_lz = p_lz;
+ int save_KeyTyped = KeyTyped;

pum_undisplay();
VIM_CLEAR(compl_match_array);
***************
*** 385,390 ****
--- 386,395 ----
update_screen(0);
p_lz = save_p_lz;
redrawcmd();
+
+ // When a function is called (e.g. for 'foldtext') KeyTyped might be reset
+ // as a side effect.
+ KeyTyped = save_KeyTyped;
}

void cmdline_pum_cleanup(cmdline_info_T *cclp)
*** ../vim-8.2.4737/src/testdir/test_cmdline.vim 2022-04-04 15:46:37.606126838 +0100
--- src/testdir/test_cmdline.vim 2022-04-11 19:31:17.191411207 +0100
***************
*** 2510,2515 ****
--- 2510,2538 ----
cunmap <F2>
endfunc

+ func Test_wildmenu_with_pum_foldexpr()
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ call setline(1, ['folded one', 'folded two', 'some more text'])
+ func MyFoldText()
+ return 'foo'
+ endfunc
+ set foldtext=MyFoldText() wildoptions=pum
+ normal ggzfj
+ END
+ call writefile(lines, 'Xpumfold')
+ let buf = RunVimInTerminal('-S Xpumfold', #{rows: 10})
+ call term_sendkeys(buf, ":set\<Tab>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_with_pum_foldexpr_1', {})
+
+ call term_sendkeys(buf, "\<Esc>")
+ call VerifyScreenDump(buf, 'Test_wildmenu_with_pum_foldexpr_2', {})
+
+ call StopVimInTerminal(buf)
+ call delete('Xpumfold')
+ endfunc
+
" Test for opening the cmdline completion popup menu from the terminal window.
" The popup menu should be positioned correctly over the status line of the
" bottom-most window.
*** ../vim-8.2.4737/src/testdir/dumps/Test_wildmenu_with_pum_foldexpr_1.dump 2022-04-11 19:36:02.015458325 +0100
--- src/testdir/dumps/Test_wildmenu_with_pum_foldexpr_1.dump 2022-04-11 19:32:00.991420660 +0100
***************
*** 0 ****
--- 1,10 ----
+ |f+0#0000e05#a8a8a8255|o@1|-@71
+ |s+0#0000000#ffffff0|o|m|e| |m|o|r|e| |t|e|x|t| @60
+ |~+0#4040ff13&| @73
+ |~| @73
+ |~| @73
+ | +0#0000001#e0e0e08|s|e|t| @11| +0#4040ff13#ffffff0@58
+ | +0#0000001#ffd7ff255|s|e|t|f|i|l|e|t|y|p|e| @3| +0#4040ff13#ffffff0@58
+ | +0#0000001#ffd7ff255|s|e|t|g|l|o|b|a|l| @5| +0#4040ff13#ffffff0@58
+ | +0#0000001#ffd7ff255|s|e|t|l|o|c|a|l| @6| +0#4040ff13#ffffff0@58
+ |:+0#0000000&|s|e|t> @70
*** ../vim-8.2.4737/src/testdir/dumps/Test_wildmenu_with_pum_foldexpr_2.dump 2022-04-11 19:36:02.019458325 +0100
--- src/testdir/dumps/Test_wildmenu_with_pum_foldexpr_2.dump 2022-04-11 19:32:57.031431498 +0100
***************
*** 0 ****
--- 1,10 ----
+ >f+0#0000e05#a8a8a8255|o@1|-@71
+ |s+0#0000000#ffffff0|o|m|e| |m|o|r|e| |t|e|x|t| @60
+ |~+0#4040ff13&| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ | +0#0000000&@56|1|,|1| @10|A|l@1|
*** ../vim-8.2.4737/src/version.c 2022-04-11 17:36:33.456351921 +0100
--- src/version.c 2022-04-11 19:25:41.987298144 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4738,
/**/

--
Mrs Abbott: I'm a paediatrician.
Basil: Feet?
Mrs Abbott: Children.
Sybil: Oh, Basil!
Basil: Well, children have feet, don't they? That's how they move
around, my dear. You must take a look next time, it's most
interesting. (Fawlty Towers)

/// Bram Moolenaar -- Br...@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 ///
Reply all
Reply to author
Forward
0 new messages