To: vim_dev@googlegroups.com Subject: Patch 8.2.0194 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0194 (after 8.2.0193) Problem: Some commands can cause problems in terminal popup. Solution: Disallow more commands. Files: src/macros.h, src/popupwin.c, src/proto/popupwin.pro, src/arglist.c, src/ex_docmd.c, src/window.c, src/testdir/test_terminal.vim *** ../vim-8.2.0193/src/macros.h 2020-02-01 22:39:28.263160728 +0100 --- src/macros.h 2020-02-01 22:49:25.875917867 +0100 *************** *** 344,352 **** // Give an error in curwin is a popup window and evaluate to TRUE. #ifdef FEAT_PROP_POPUP ! # define ERROR_IF_POPUP_WINDOW error_if_popup_window() #else # define ERROR_IF_POPUP_WINDOW 0 #endif #if defined(FEAT_PROP_POPUP) && defined(FEAT_TERMINAL) # define ERROR_IF_TERM_POPUP_WINDOW error_if_term_popup_window() --- 344,354 ---- // Give an error in curwin is a popup window and evaluate to TRUE. #ifdef FEAT_PROP_POPUP ! # define ERROR_IF_POPUP_WINDOW error_if_popup_window(FALSE) ! # define ERROR_IF_ANY_POPUP_WINDOW error_if_popup_window(TRUE) #else # define ERROR_IF_POPUP_WINDOW 0 + # define ERROR_IF_ANY_POPUP_WINDOW 0 #endif #if defined(FEAT_PROP_POPUP) && defined(FEAT_TERMINAL) # define ERROR_IF_TERM_POPUP_WINDOW error_if_term_popup_window() *** ../vim-8.2.0193/src/popupwin.c 2020-02-01 22:18:34.307838671 +0100 --- src/popupwin.c 2020-02-01 22:53:05.158832429 +0100 *************** *** 2360,2366 **** int id = (int)tv_get_number(argvars); win_T *wp; ! if (ERROR_IF_POPUP_WINDOW) return; wp = find_popup_win(id); --- 2360,2366 ---- int id = (int)tv_get_number(argvars); win_T *wp; ! if (ERROR_IF_ANY_POPUP_WINDOW) return; wp = find_popup_win(id); *************** *** 2511,2517 **** void close_all_popups(void) { ! if (ERROR_IF_POPUP_WINDOW) return; while (first_popupwin != NULL) popup_close(first_popupwin->w_id); --- 2511,2517 ---- void close_all_popups(void) { ! if (ERROR_IF_ANY_POPUP_WINDOW) return; while (first_popupwin != NULL) popup_close(first_popupwin->w_id); *************** *** 2845,2858 **** } int ! error_if_popup_window() { // win_execute() may set "curwin" to a popup window temporarily, but many // commands are disallowed then. When a terminal runs in the popup most // things are allowed. if (WIN_IS_POPUP(curwin) # ifdef FEAT_TERMINAL ! && curbuf->b_term == NULL # endif ) { --- 2845,2858 ---- } int ! error_if_popup_window(int also_with_term UNUSED) { // win_execute() may set "curwin" to a popup window temporarily, but many // commands are disallowed then. When a terminal runs in the popup most // things are allowed. if (WIN_IS_POPUP(curwin) # ifdef FEAT_TERMINAL ! && (also_with_term || curbuf->b_term == NULL) # endif ) { *** ../vim-8.2.0193/src/proto/popupwin.pro 2020-02-01 21:57:00.844520950 +0100 --- src/proto/popupwin.pro 2020-02-01 22:57:01.305693939 +0100 *************** *** 41,47 **** void f_popup_getpos(typval_T *argvars, typval_T *rettv); void f_popup_locate(typval_T *argvars, typval_T *rettv); void f_popup_getoptions(typval_T *argvars, typval_T *rettv); ! int error_if_popup_window(void); int error_if_term_popup_window(void); void popup_reset_handled(int handled_flag); win_T *find_next_popup(int lowest, int handled_flag); --- 41,47 ---- void f_popup_getpos(typval_T *argvars, typval_T *rettv); void f_popup_locate(typval_T *argvars, typval_T *rettv); void f_popup_getoptions(typval_T *argvars, typval_T *rettv); ! int error_if_popup_window(int also_with_term); int error_if_term_popup_window(void); void popup_reset_handled(int handled_flag); win_T *find_next_popup(int lowest, int handled_flag); *** ../vim-8.2.0193/src/arglist.c 2020-01-13 20:54:48.215608391 +0100 --- src/arglist.c 2020-02-01 22:49:39.467849549 +0100 *************** *** 638,644 **** char_u *p; int old_arg_idx = curwin->w_arg_idx; ! if (ERROR_IF_POPUP_WINDOW) return; if (argn < 0 || argn >= ARGCOUNT) { --- 638,644 ---- char_u *p; int old_arg_idx = curwin->w_arg_idx; ! if (ERROR_IF_ANY_POPUP_WINDOW) return; if (argn < 0 || argn >= ARGCOUNT) { *** ../vim-8.2.0193/src/ex_docmd.c 2020-01-31 22:41:34.913183472 +0100 --- src/ex_docmd.c 2020-02-01 22:55:36.946097798 +0100 *************** *** 4633,4639 **** static void ex_bunload(exarg_T *eap) { ! if (ERROR_IF_POPUP_WINDOW) return; eap->errmsg = do_bufdel( eap->cmdidx == CMD_bdelete ? DOBUF_DEL --- 4633,4639 ---- static void ex_bunload(exarg_T *eap) { ! if (ERROR_IF_ANY_POPUP_WINDOW) return; eap->errmsg = do_bufdel( eap->cmdidx == CMD_bdelete ? DOBUF_DEL *************** *** 4649,4655 **** static void ex_buffer(exarg_T *eap) { ! if (ERROR_IF_POPUP_WINDOW) return; if (*eap->arg) eap->errmsg = e_trailing; --- 4649,4655 ---- static void ex_buffer(exarg_T *eap) { ! if (ERROR_IF_ANY_POPUP_WINDOW) return; if (*eap->arg) eap->errmsg = e_trailing; *************** *** 4683,4689 **** static void ex_bnext(exarg_T *eap) { ! if (ERROR_IF_POPUP_WINDOW) return; goto_buffer(eap, DOBUF_CURRENT, FORWARD, (int)eap->line2); --- 4683,4689 ---- static void ex_bnext(exarg_T *eap) { ! if (ERROR_IF_ANY_POPUP_WINDOW) return; goto_buffer(eap, DOBUF_CURRENT, FORWARD, (int)eap->line2); *************** *** 4700,4706 **** static void ex_bprevious(exarg_T *eap) { ! if (ERROR_IF_POPUP_WINDOW) return; goto_buffer(eap, DOBUF_CURRENT, BACKWARD, (int)eap->line2); --- 4700,4706 ---- static void ex_bprevious(exarg_T *eap) { ! if (ERROR_IF_ANY_POPUP_WINDOW) return; goto_buffer(eap, DOBUF_CURRENT, BACKWARD, (int)eap->line2); *************** *** 4717,4723 **** static void ex_brewind(exarg_T *eap) { ! if (ERROR_IF_POPUP_WINDOW) return; goto_buffer(eap, DOBUF_FIRST, FORWARD, 0); --- 4717,4723 ---- static void ex_brewind(exarg_T *eap) { ! if (ERROR_IF_ANY_POPUP_WINDOW) return; goto_buffer(eap, DOBUF_FIRST, FORWARD, 0); *************** *** 4732,4738 **** static void ex_blast(exarg_T *eap) { ! if (ERROR_IF_POPUP_WINDOW) return; goto_buffer(eap, DOBUF_LAST, BACKWARD, 0); --- 4732,4738 ---- static void ex_blast(exarg_T *eap) { ! if (ERROR_IF_ANY_POPUP_WINDOW) return; goto_buffer(eap, DOBUF_LAST, BACKWARD, 0); *************** *** 5762,5768 **** || eap->cmdidx == CMD_tabfind || eap->cmdidx == CMD_tabnew; ! if (ERROR_IF_POPUP_WINDOW) return; #ifdef FEAT_GUI --- 5762,5768 ---- || eap->cmdidx == CMD_tabfind || eap->cmdidx == CMD_tabnew; ! if (ERROR_IF_ANY_POPUP_WINDOW) return; #ifdef FEAT_GUI *************** *** 6145,6151 **** int need_hide; int exmode_was = exmode_active; ! if (eap->cmdidx != CMD_pedit && ERROR_IF_POPUP_WINDOW) return; /* * ":vi" command ends Ex mode. --- 6145,6152 ---- int need_hide; int exmode_was = exmode_active; ! if ((eap->cmdidx != CMD_pedit && ERROR_IF_POPUP_WINDOW) ! || ERROR_IF_TERM_POPUP_WINDOW) return; /* * ":vi" command ends Ex mode. *** ../vim-8.2.0193/src/window.c 2020-02-01 21:57:00.848520936 +0100 --- src/window.c 2020-02-01 22:55:57.194000594 +0100 *************** *** 122,128 **** #endif char_u cbuf[40]; ! if (ERROR_IF_POPUP_WINDOW) return; #ifdef FEAT_CMDWIN --- 122,128 ---- #endif char_u cbuf[40]; ! if (ERROR_IF_ANY_POPUP_WINDOW) return; #ifdef FEAT_CMDWIN *************** *** 784,790 **** int win_split(int size, int flags) { ! if (ERROR_IF_POPUP_WINDOW) return FAIL; // When the ":tab" modifier was used open a new tab page instead. --- 784,790 ---- int win_split(int size, int flags) { ! if (ERROR_IF_ANY_POPUP_WINDOW) return FAIL; // When the ":tab" modifier was used open a new tab page instead. *************** *** 1574,1580 **** win_T *wp2; int temp; ! if (ERROR_IF_POPUP_WINDOW) return; if (ONE_WINDOW) // just one window { --- 1574,1580 ---- win_T *wp2; int temp; ! if (ERROR_IF_ANY_POPUP_WINDOW) return; if (ONE_WINDOW) // just one window { *************** *** 2441,2447 **** int had_diffmode = win->w_p_diff; #endif ! if (ERROR_IF_POPUP_WINDOW) return FAIL; if (last_window()) --- 2441,2447 ---- int had_diffmode = win->w_p_diff; #endif ! if (ERROR_IF_ANY_POPUP_WINDOW) return FAIL; if (last_window()) *************** *** 4344,4350 **** #endif #ifdef FEAT_PROP_POPUP ! if (ERROR_IF_POPUP_WINDOW || ERROR_IF_TERM_POPUP_WINDOW) return; if (popup_is_popup(wp)) { --- 4344,4350 ---- #endif #ifdef FEAT_PROP_POPUP ! if (ERROR_IF_ANY_POPUP_WINDOW) return; if (popup_is_popup(wp)) { *** ../vim-8.2.0193/src/testdir/test_terminal.vim 2020-02-01 21:57:00.848520936 +0100 --- src/testdir/test_terminal.vim 2020-02-01 23:03:17.772587778 +0100 *************** *** 2357,2363 **** call VerifyScreenDump(buf, 'Test_terminal_popup_3', {}) call term_sendkeys(buf, ":q\") ! call term_wait(buf, 50) " wait for terminal to vanish call StopVimInTerminal(buf) call delete('XtermPopup') --- 2357,2363 ---- call VerifyScreenDump(buf, 'Test_terminal_popup_3', {}) call term_sendkeys(buf, ":q\") ! call term_wait(buf, 100) " wait for terminal to vanish call StopVimInTerminal(buf) call delete('XtermPopup') *** ../vim-8.2.0193/src/version.c 2020-02-01 22:39:28.263160728 +0100 --- src/version.c 2020-02-01 23:03:52.300497693 +0100 *************** *** 744,745 **** --- 744,747 ---- { /* Add new patch number below this line */ + /**/ + 194, /**/ -- If they don't keep on exercising their lips, he thought, their brains start working. -- 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/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///