summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-07-12 19:24:10 +0200
committerBram Moolenaar <Bram@vim.org>2020-07-12 19:24:10 +0200
commit35910f2d54bd670a0d83b3474b4c23faa94252d3 (patch)
tree3e845f965f862e9f9526fd21f8e1453b5ab75f84
parentb898a029b01866b1dbe07521e153d54917b9527d (diff)
downloadvim-git-35910f2d54bd670a0d83b3474b4c23faa94252d3.tar.gz
patch 8.2.1193: terminal window not redrawn when dragging a popup windowv8.2.1193
Problem: Terminal window not redrawn when dragging a popup window over it. Solution: Redraw terminal window. (fixes #6438)
-rw-r--r--src/popupwin.c33
-rw-r--r--src/testdir/dumps/Test_popupwin_term_01.dump10
-rw-r--r--src/testdir/dumps/Test_popupwin_term_02.dump10
-rw-r--r--src/testdir/test_popupwin.vim34
-rw-r--r--src/version.c2
5 files changed, 76 insertions, 13 deletions
diff --git a/src/popupwin.c b/src/popupwin.c
index 3461313ec..0af6d52de 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -3504,22 +3504,29 @@ may_update_popup_mask(int type)
wp = mouse_find_win(&line_cp, &col_cp, IGNORE_POPUP);
if (wp != NULL)
{
- if (wp != prev_wp)
- {
- vim_memset(plines_cache, 0, sizeof(int) * Rows);
- prev_wp = wp;
- }
-
- if (line_cp >= wp->w_height)
- // In (or below) status line
- wp->w_redr_status = TRUE;
+ // A terminal window needs to be redrawn.
+ if (bt_terminal(wp->w_buffer))
+ redraw_win_later(wp, NOT_VALID);
else
{
- // compute the position in the buffer line from
- // the position in the window
- mouse_comp_pos(wp, &line_cp, &col_cp,
+ if (wp != prev_wp)
+ {
+ vim_memset(plines_cache, 0,
+ sizeof(int) * Rows);
+ prev_wp = wp;
+ }
+
+ if (line_cp >= wp->w_height)
+ // In (or below) status line
+ wp->w_redr_status = TRUE;
+ else
+ {
+ // compute the position in the buffer line
+ // from the position in the window
+ mouse_comp_pos(wp, &line_cp, &col_cp,
&lnum, plines_cache);
- redrawWinline(wp, lnum);
+ redrawWinline(wp, lnum);
+ }
}
// This line is going to be redrawn, no need to
diff --git a/src/testdir/dumps/Test_popupwin_term_01.dump b/src/testdir/dumps/Test_popupwin_term_01.dump
new file mode 100644
index 000000000..edc0b001b
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_term_01.dump
@@ -0,0 +1,10 @@
+|$+0&#ffffff0| @73
+@75
+@34|╔+0#0000001#ffd7ff255|═@3|╗| +0#0000000#ffffff0@34
+@34|║+0#0000001#ffd7ff255|1@3|║| +0#0000000#ffffff0@34
+|!+0#ffffff16#00e0003|/|b|i|n|/|s|h| |[|r|u|n@1|i|n|g|]| @15|║+0#0000001#ffd7ff255|2@3|║| +0#ffffff16#00e0003@34
+> +0#0000000#ffffff0@33|╚+0#0000001#ffd7ff255|═@3|⇲| +0#0000000#ffffff0@34
+|~+0#4040ff13&| @73
+|~| @73
+|[+3#0000000&|N|o| |N|a|m|e|]| @65
+| +0&&@74
diff --git a/src/testdir/dumps/Test_popupwin_term_02.dump b/src/testdir/dumps/Test_popupwin_term_02.dump
new file mode 100644
index 000000000..d5636c983
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_term_02.dump
@@ -0,0 +1,10 @@
+|$+0&#ffffff0| @73
+@75
+@14|╔+0#0000001#ffd7ff255|═@3|╗| +0#0000000#ffffff0@54
+@14|║+0#0000001#ffd7ff255|1@3|║| +0#0000000#ffffff0@54
+|!+0#ffffff16#00e0003|/|b|i|n|/|s|h| |[|r|u|n@1|║+0#0000001#ffd7ff255|2@3|║| +0#ffffff16#00e0003@54
+> +0#0000000#ffffff0@13|╚+0#0000001#ffd7ff255|═@3|⇲| +0#0000000#ffffff0@54
+|~+0#4040ff13&| @73
+|~| @73
+|[+3#0000000&|N|o| |N|a|m|e|]| @65
+|:+0&&|c|a|l@1| |D|r|a|g|i|t|(|)| @60
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index 8631c71e7..140f6825b 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -577,6 +577,40 @@ func Test_popup_drag()
call delete('XtestPopupDrag')
endfunc
+func Test_popup_drag_termwin()
+ CheckUnix
+ CheckScreendump
+ CheckFeature terminal
+
+ " create a popup that covers the terminal window
+ let lines =<< trim END
+ set shell=/bin/sh noruler
+ terminal
+ $wincmd w
+ let winid = popup_create(['1111', '2222'], #{
+ \ drag: 1,
+ \ resize: 1,
+ \ border: [],
+ \ line: 3,
+ \ })
+ func Dragit()
+ call feedkeys("\<F3>\<LeftMouse>\<F4>\<LeftDrag>\<LeftRelease>", "xt")
+ endfunc
+ map <silent> <F3> :call test_setmouse(3, &columns / 2)<CR>
+ map <silent> <F4> :call test_setmouse(3, &columns / 2 - 20)<CR>
+ END
+ call writefile(lines, 'XtestPopupTerm')
+ let buf = RunVimInTerminal('-S XtestPopupTerm', #{rows: 10})
+ call VerifyScreenDump(buf, 'Test_popupwin_term_01', {})
+
+ call term_sendkeys(buf, ":call Dragit()\<CR>")
+ call VerifyScreenDump(buf, 'Test_popupwin_term_02', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('XtestPopupTerm')
+endfunc
+
func Test_popup_close_with_mouse()
CheckScreendump
diff --git a/src/version.c b/src/version.c
index d16523288..96f29fa37 100644
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1193,
+/**/
1192,
/**/
1191,