To: vim_dev@googlegroups.com Subject: Patch 8.2.1729 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1729 Problem: Endless loop when ":normal" feeds popup window filter. Solution: Add the ex_normal_busy_done flag. Files: src/globals.h, src/getchar.c, src/evalfunc.c, src/ex_docmd.c, src/menu.c, src/testdir/test_popupwin.vim, src/testdir/dumps/Test_popupwin_normal_cmd.dump *** ../vim-8.2.1728/src/globals.h 2020-09-16 15:21:56.354720354 +0200 --- src/globals.h 2020-09-22 22:31:13.485744067 +0200 *************** *** 1152,1157 **** --- 1152,1162 ---- ; EXTERN int ex_normal_busy INIT(= 0); // recursiveness of ex_normal() EXTERN int ex_normal_lock INIT(= 0); // forbid use of ex_normal() + #ifdef FEAT_PROP_POPUP + // Set to TRUE when ex_normal_busy is set and out of typeahead. + EXTERN int ex_normal_busy_done INIT(= FALSE); + #endif + #ifdef FEAT_EVAL EXTERN int ignore_script INIT(= FALSE); // ignore script input #endif *** ../vim-8.2.1728/src/getchar.c 2020-09-05 19:59:33.784862273 +0200 --- src/getchar.c 2020-09-23 12:17:25.241491901 +0200 *************** *** 1888,1894 **** } #endif #ifdef FEAT_PROP_POPUP ! if (popup_do_filter(c)) { if (c == Ctrl_C) got_int = FALSE; // avoid looping --- 1888,1894 ---- } #endif #ifdef FEAT_PROP_POPUP ! if (!ex_normal_busy_done && popup_do_filter(c)) { if (c == Ctrl_C) got_int = FALSE; // avoid looping *************** *** 3168,3173 **** --- 3168,3177 ---- timedout = TRUE; continue; } + #ifdef FEAT_PROP_POPUP + ex_normal_busy_done = TRUE; + #endif + // When 'insertmode' is set, ESC just beeps in Insert // mode. Use CTRL-L to make edit() return. // For the command line only CTRL-C always breaks it. *** ../vim-8.2.1728/src/evalfunc.c 2020-09-22 21:55:16.214978662 +0200 --- src/evalfunc.c 2020-09-22 22:34:25.276910315 +0200 *************** *** 2610,2616 **** --- 2610,2622 ---- ++ex_normal_busy; exec_normal(TRUE, lowlevel, TRUE); if (!dangerous) + { --ex_normal_busy; + #ifdef FEAT_PROP_POPUP + if (ex_normal_busy == 0) + ex_normal_busy_done = FALSE; + #endif + } msg_scroll |= save_msg_scroll; } *** ../vim-8.2.1728/src/ex_docmd.c 2020-09-14 18:35:14.984866572 +0200 --- src/ex_docmd.c 2020-09-22 22:34:42.144836601 +0200 *************** *** 8030,8035 **** --- 8030,8039 ---- restore_current_state(&save_state); --ex_normal_busy; + #ifdef FEAT_PROP_POPUP + if (ex_normal_busy == 0) + ex_normal_busy_done = FALSE; + #endif setmouse(); #ifdef CURSOR_SHAPE ui_cursor_shape(); // may show different cursor shape *** ../vim-8.2.1728/src/menu.c 2020-07-23 17:16:15.050100601 +0200 --- src/menu.c 2020-09-22 22:35:51.532532833 +0200 *************** *** 2398,2403 **** --- 2398,2407 ---- menu->silent[idx]); restore_current_state(&save_state); --ex_normal_busy; + #ifdef FEAT_PROP_POPUP + if (ex_normal_busy == 0) + ex_normal_busy_done = FALSE; + #endif } else ins_typebuf(menu->strings[idx], menu->noremap[idx], 0, *** ../vim-8.2.1728/src/testdir/test_popupwin.vim 2020-09-22 21:55:16.214978662 +0200 --- src/testdir/test_popupwin.vim 2020-09-23 12:20:38.220467749 +0200 *************** *** 1539,1544 **** --- 1539,1561 ---- call popup_clear() endfunc + " this tests that the "ex_normal_busy_done" flag works + func Test_popup_filter_normal_cmd() + CheckScreendump + + let lines =<< trim END + let g:winid = popup_create('some text', {'filter': 'invalidfilter'}) + call timer_start(0, {-> win_execute(g:winid, 'norm! zz')}) + END + call writefile(lines, 'XtestPopupNormal') + let buf = RunVimInTerminal('-S XtestPopupNormal', #{rows: 10}) + call TermWait(buf, 100) + call VerifyScreenDump(buf, 'Test_popupwin_normal_cmd', {}) + + call StopVimInTerminal(buf) + call delete('XtestPopupNormal') + endfunc + func ShowDialog(key, result) let s:cb_res = 999 let winid = popup_dialog('do you want to quit (Yes/no)?', #{ *** ../vim-8.2.1728/src/testdir/dumps/Test_popupwin_normal_cmd.dump 2020-09-23 12:27:57.442154942 +0200 --- src/testdir/dumps/Test_popupwin_normal_cmd.dump 2020-09-23 12:19:11.420927575 +0200 *************** *** 0 **** --- 1,10 ---- + > +0&#ffffff0@74 + |~+0#4040ff13&| @73 + |~| @73 + |~| @73 + |~| @31| +0#0000000&@8| +0#4040ff13&@32 + |~| @73 + |~| @73 + |~| @73 + |~| @73 + | +0#0000000&@56|0|,|0|-|1| @8|A|l@1| *** ../vim-8.2.1728/src/version.c 2020-09-22 22:08:28.559532201 +0200 --- src/version.c 2020-09-22 22:39:26.947585157 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 1729, /**/ -- If you had to identify, in one word, the reason why the human race has not achieved, and never will achieve, its full potential, that word would be "meetings." /// 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 ///