summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-01-23 15:33:54 +0100
committerBram Moolenaar <Bram@vim.org>2020-01-23 15:33:54 +0100
commit8bf716cdba0e48f56b8bfcbed0f4c702a705e095 (patch)
tree312caee27661142e38be9d8856a8fcb9f2f268e4
parent0d76683e094c6cac2e879601aff3acf1163cbe0b (diff)
downloadvim-git-8bf716cdba0e48f56b8bfcbed0f4c702a705e095.tar.gz
patch 8.2.0142: possible to enter popup window with CTRL-W pv8.2.0142
Problem: Possible to enter popup window with CTRL-W p. (John Devin) Solution: Check entered window is not a popup window. (closes #5515)
-rw-r--r--src/popupwin.c2
-rw-r--r--src/testdir/dumps/Test_popupwin_previewpopup_10.dump14
-rw-r--r--src/testdir/dumps/Test_popupwin_previewpopup_9.dump14
-rw-r--r--src/testdir/test_popupwin.vim6
-rw-r--r--src/version.c2
-rw-r--r--src/window.c7
6 files changed, 45 insertions, 0 deletions
diff --git a/src/popupwin.c b/src/popupwin.c
index e1f73bd4a..47e9238ba 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -2484,6 +2484,8 @@ popup_close_tabpage(tabpage_T *tp, int id)
void
close_all_popups(void)
{
+ if (ERROR_IF_POPUP_WINDOW)
+ return;
while (first_popupwin != NULL)
popup_close(first_popupwin->w_id);
while (curtab->tp_first_popupwin != NULL)
diff --git a/src/testdir/dumps/Test_popupwin_previewpopup_10.dump b/src/testdir/dumps/Test_popupwin_previewpopup_10.dump
new file mode 100644
index 000000000..7003b43fd
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_previewpopup_10.dump
@@ -0,0 +1,14 @@
+|o+0&#ffffff0|n|e| @71
+|#|i|n|c|l|u|d|e| |"|X|h|e|a|d|e|r|.|h|"| @54
+|t|h|r|e@1| @69
+|f|o|u|r| @70
+|f|i|v|e| @28|╔+0#0000001#ffd7ff255| |X|h|e|a|d|e|r|.|h| |═@28|X
+|s+0#0000000#ffffff0|i|x| @29|║+0#0000001#ffd7ff255|1+0#e000002&|0| +0#0000001&@36| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255
+|s+0#0000000#ffffff0|e|v|e|n| @27|║+0#0000001#ffd7ff255|s|e|a|r|c|h|e|d| |w|o|r|d| |i|s| |h|e|r|e| @17| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255
+|f+0#0000000#ffffff0|i|n|d| |t|h|e|w|o|r|d| |s|o|m|e|w|h|e|r|e| @10|║+0#0000001#ffd7ff255|1+0#e000002&|2| +0#0000001&@36| +0#0000000#0000001|║+0#0000001#ffd7ff255
+|n+0#0000000#ffffff0|i|n|e| @28|║+0#0000001#ffd7ff255|1+0#e000002&|3| +0#0000001&@36| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255
+|t+0#0000000#ffffff0|h|i|s| |i|s| |a|n|o|t|h|e|r| |w|o|r|d| @12|╚+0#0000001#ffd7ff255|═@39|⇲
+|v+0#0000000#ffffff0|e|r|y| |l|o|n|g| |l|i|n|e| |w|h|e|r|e| |t|h|e| |w|o|r|d| |i|s| |a|l|s|o| >a|n|o|t|h|e|r| @29
+|~+0#4040ff13&| @73
+|~| @73
+|E+0#ffffff16#e000002|9@1|4|:| |N|o|t| |a|l@1|o|w|e|d| |i|n| |a| |p|o|p|u|p| |w|i|n|d|o|w| +0#0000000#ffffff0@21|1@1|,|3|9| @8|A|l@1|
diff --git a/src/testdir/dumps/Test_popupwin_previewpopup_9.dump b/src/testdir/dumps/Test_popupwin_previewpopup_9.dump
new file mode 100644
index 000000000..f555a00dc
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_previewpopup_9.dump
@@ -0,0 +1,14 @@
+|o+0&#ffffff0|n|e| @71
+|#|i|n|c|l|u|d|e| |"|X|h|e|a|d|e|r|.|h|"| @54
+|t|h|r|e@1| @69
+|f|o|u|r| @70
+|f|i|v|e| @28|╔+0#0000001#ffd7ff255| |X|h|e|a|d|e|r|.|h| |═@28|X
+|s+0#0000000#ffffff0|i|x| @29|║+0#0000001#ffd7ff255|1+0#e000002&|0| +0#0000001&@36| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255
+|s+0#0000000#ffffff0|e|v|e|n| @27|║+0#0000001#ffd7ff255|s|e|a|r|c|h|e|d| |w|o|r|d| |i|s| |h|e|r|e| @17| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255
+|f+0#0000000#ffffff0|i|n|d| |t|h|e|w|o|r|d| |s|o|m|e|w|h|e|r|e| @10|║+0#0000001#ffd7ff255|1+0#e000002&|2| +0#0000001&@36| +0#0000000#0000001|║+0#0000001#ffd7ff255
+|n+0#0000000#ffffff0|i|n|e| @28|║+0#0000001#ffd7ff255|1+0#e000002&|3| +0#0000001&@36| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255
+|t+0#0000000#ffffff0|h|i|s| |i|s| |a|n|o|t|h|e|r| |w|o|r|d| @12|╚+0#0000001#ffd7ff255|═@39|⇲
+|v+0#0000000#ffffff0|e|r|y| |l|o|n|g| |l|i|n|e| |w|h|e|r|e| |t|h|e| |w|o|r|d| |i|s| |a|l|s|o| >a|n|o|t|h|e|r| @29
+|~+0#4040ff13&| @73
+|~| @73
+|E+0#ffffff16#e000002|3|6@1|:| |N|o|t| |a|l@1|o|w|e|d| |t|o| |e|n|t|e|r| |a| |p|o|p|u|p| |w|i|n|d|o|w| +0#0000000#ffffff0@15|1@1|,|3|9| @8|A|l@1|
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index 654501b29..ebcc1f414 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -2804,6 +2804,12 @@ func Test_previewpopup()
call term_sendkeys(buf, ":\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_8', {})
+ call term_sendkeys(buf, "\<C-W>p")
+ call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_9', {})
+
+ call term_sendkeys(buf, ":call win_execute(popup_findpreview(), 'call popup_clear()')\<CR>")
+ call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_10', {})
+
call StopVimInTerminal(buf)
call delete('Xtags')
call delete('Xtagfile')
diff --git a/src/version.c b/src/version.c
index 3f4eb806e..e4600ce94 100644
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 142,
+/**/
141,
/**/
140,
diff --git a/src/window.c b/src/window.c
index 0c3c7f690..6672433d5 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4343,8 +4343,15 @@ win_goto(win_T *wp)
win_T *owp = curwin;
#endif
+#ifdef FEAT_PROP_POPUP
if (ERROR_IF_POPUP_WINDOW)
return;
+ if (popup_is_popup(wp))
+ {
+ emsg(_("E366: Not allowed to enter a popup window"));
+ return;
+ }
+#endif
if (text_locked())
{
beep_flush();