patch 8.1.1534: modeless selection in popup window selects too much
Problem: Modeless selection in popup window selects too much.
Solution: Restrict the selection to insde of the popup window.
diff --git a/src/testdir/dumps/Test_popupwin_select_01.dump b/src/testdir/dumps/Test_popupwin_select_01.dump
new file mode 100644
index 0000000..779047d
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_select_01.dump
@@ -0,0 +1,10 @@
+>1+0&#ffffff0| @73
+|2| @73
+|3| @7|╔+0#0000001#ffd7ff255|═@17|╗| +0#0000000#ffffff0@45
+|4| @7|║+0#0000001#ffd7ff255|t|h|e| |w+1#0000000#ffffff0|o|r|d| @9|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@45
+|5| @7|║+0#0000001#ffd7ff255|s+1#0000000#ffffff0|o|m|e| |m|o|r|e| @8|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@45
+|6| @7|║+0#0000001#ffd7ff255|s+1#0000000#ffffff0|e|v|e|r|a|l| |w|o|r|d|s| +0#0000001#ffd7ff255|h|e|r|e|║| +0#0000000#ffffff0@45
+|7| @7|╚+0#0000001#ffd7ff255|═@17|╝| +0#0000000#ffffff0@45
+|8| @73
+|9| @73
+|:|c|a|l@1| |S|e|l|e|c|t|1|(|)| @41|1|,|1| @10|T|o|p|
diff --git a/src/testdir/dumps/Test_popupwin_select_02.dump b/src/testdir/dumps/Test_popupwin_select_02.dump
new file mode 100644
index 0000000..550e0db
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_select_02.dump
@@ -0,0 +1,10 @@
+|1+0&#ffffff0>w|o|r|d| @69
+|s|o|m|e| |m|o|r|e| @65
+|s|e|v|e|r|a|l| |w|o|r|d|s| @61
+|2| @73
+|3| @73
+|4| @73
+|5| @73
+|6| @73
+|7| @73
+@57|1|,|2| @10|T|o|p|
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index c084c7c..6e11bba 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -319,6 +319,39 @@
call delete('XtestPopupDrag')
endfunc
+func Test_popup_select()
+ if !CanRunVimInTerminal()
+ throw 'Skipped: cannot make screendumps'
+ endif
+ " create a popup with some text to be selected
+ let lines =<< trim END
+ call setline(1, range(1, 20))
+ let winid = popup_create(['the word', 'some more', 'several words here'], {
+ \ 'drag': 1,
+ \ 'border': [],
+ \ 'line': 3,
+ \ 'col': 10,
+ \ })
+ func Select1()
+ call feedkeys("\<F3>\<LeftMouse>\<F4>\<LeftDrag>\<LeftRelease>", "xt")
+ endfunc
+ map <silent> <F3> :call test_setmouse(4, 15)<CR>
+ map <silent> <F4> :call test_setmouse(6, 23)<CR>
+ END
+ call writefile(lines, 'XtestPopupSelect')
+ let buf = RunVimInTerminal('-S XtestPopupSelect', {'rows': 10})
+ call term_sendkeys(buf, ":call Select1()\<CR>")
+ call VerifyScreenDump(buf, 'Test_popupwin_select_01', {})
+
+ call term_sendkeys(buf, ":call popup_close(winid)\<CR>")
+ call term_sendkeys(buf, "\"*p")
+ call VerifyScreenDump(buf, 'Test_popupwin_select_02', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('XtestPopupSelect')
+endfunc
+
func Test_popup_in_tab()
" default popup is local to tab, not visible when in other tab
let winid = popup_create("text", {})