Mercurial > vim
comparison src/popupwin.c @ 19271:ebeeb4b4a1fa v8.2.0194
patch 8.2.0194: some commands can cause problems in terminal popup
Commit: https://github.com/vim/vim/commit/3c01c4a02897163996639f6f2604c68eab2bd18b
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 1 23:04:24 2020 +0100
patch 8.2.0194: some commands can cause problems in terminal popup
Problem: Some commands can cause problems in terminal popup.
Solution: Disallow more commands.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 01 Feb 2020 23:15:03 +0100 |
parents | c7903f92ed75 |
children | 2142fb624658 |
comparison
equal
deleted
inserted
replaced
19270:6eca0794f137 | 19271:ebeeb4b4a1fa |
---|---|
2358 f_popup_close(typval_T *argvars, typval_T *rettv UNUSED) | 2358 f_popup_close(typval_T *argvars, typval_T *rettv UNUSED) |
2359 { | 2359 { |
2360 int id = (int)tv_get_number(argvars); | 2360 int id = (int)tv_get_number(argvars); |
2361 win_T *wp; | 2361 win_T *wp; |
2362 | 2362 |
2363 if (ERROR_IF_POPUP_WINDOW) | 2363 if (ERROR_IF_ANY_POPUP_WINDOW) |
2364 return; | 2364 return; |
2365 | 2365 |
2366 wp = find_popup_win(id); | 2366 wp = find_popup_win(id); |
2367 if (wp != NULL) | 2367 if (wp != NULL) |
2368 popup_close_and_callback(wp, &argvars[1]); | 2368 popup_close_and_callback(wp, &argvars[1]); |
2509 } | 2509 } |
2510 | 2510 |
2511 void | 2511 void |
2512 close_all_popups(void) | 2512 close_all_popups(void) |
2513 { | 2513 { |
2514 if (ERROR_IF_POPUP_WINDOW) | 2514 if (ERROR_IF_ANY_POPUP_WINDOW) |
2515 return; | 2515 return; |
2516 while (first_popupwin != NULL) | 2516 while (first_popupwin != NULL) |
2517 popup_close(first_popupwin->w_id); | 2517 popup_close(first_popupwin->w_id); |
2518 while (curtab->tp_first_popupwin != NULL) | 2518 while (curtab->tp_first_popupwin != NULL) |
2519 popup_close(curtab->tp_first_popupwin->w_id); | 2519 popup_close(curtab->tp_first_popupwin->w_id); |
2843 # endif | 2843 # endif |
2844 } | 2844 } |
2845 } | 2845 } |
2846 | 2846 |
2847 int | 2847 int |
2848 error_if_popup_window() | 2848 error_if_popup_window(int also_with_term UNUSED) |
2849 { | 2849 { |
2850 // win_execute() may set "curwin" to a popup window temporarily, but many | 2850 // win_execute() may set "curwin" to a popup window temporarily, but many |
2851 // commands are disallowed then. When a terminal runs in the popup most | 2851 // commands are disallowed then. When a terminal runs in the popup most |
2852 // things are allowed. | 2852 // things are allowed. |
2853 if (WIN_IS_POPUP(curwin) | 2853 if (WIN_IS_POPUP(curwin) |
2854 # ifdef FEAT_TERMINAL | 2854 # ifdef FEAT_TERMINAL |
2855 && curbuf->b_term == NULL | 2855 && (also_with_term || curbuf->b_term == NULL) |
2856 # endif | 2856 # endif |
2857 ) | 2857 ) |
2858 { | 2858 { |
2859 emsg(_("E994: Not allowed in a popup window")); | 2859 emsg(_("E994: Not allowed in a popup window")); |
2860 return TRUE; | 2860 return TRUE; |