annotate src/testdir/test_popupwin.vim @ 17580:d5e5d0fc3fa8 v8.1.1787

patch 8.1.1787: cannot resize a popup window commit https://github.com/vim/vim/commit/9bcb70c18a740bf9d97a1420df5964618f218a89 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 1 21:11:05 2019 +0200 patch 8.1.1787: cannot resize a popup window Problem: Cannot resize a popup window. Solution: Allow for resizing by dragging the lower right corncer.
author Bram Moolenaar <Bram@vim.org>
date Thu, 01 Aug 2019 21:15:07 +0200
parents 8cca2654d459
children 506dd2efcbb2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Tests for popup windows
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
17089
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
3 source check.vim
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
4 CheckFeature textprop
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 source screendump.vim
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 func Test_simple_popup()
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 if !CanRunVimInTerminal()
16965
ba7727889385 patch 8.1.1483: skipped tests are not properly listed
Bram Moolenaar <Bram@vim.org>
parents: 16908
diff changeset
10 throw 'Skipped: cannot make screendumps'
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 endif
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
12 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
13 call setline(1, range(1, 100))
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
14 hi PopupColor1 ctermbg=lightblue
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
15 hi PopupColor2 ctermbg=lightcyan
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
16 hi Comment ctermfg=red
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
17 call prop_type_add('comment', #{highlight: 'Comment'})
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
18 let winid = popup_create('hello there', #{line: 3, col: 11, minwidth: 20, highlight: 'PopupColor1'})
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
19 let winid2 = popup_create(['another one', 'another two', 'another three'], #{line: 3, col: 25, minwidth: 20})
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
20 call setwinvar(winid2, '&wincolor', 'PopupColor2')
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
21 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
22 call writefile(lines, 'XtestPopup')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
23 let buf = RunVimInTerminal('-S XtestPopup', #{rows: 10})
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 call VerifyScreenDump(buf, 'Test_popupwin_01', {})
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25
16794
ddfa924df50d patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents: 16778
diff changeset
26 " Add a tabpage
ddfa924df50d patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents: 16778
diff changeset
27 call term_sendkeys(buf, ":tabnew\<CR>")
16817
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
28 call term_sendkeys(buf, ":let popupwin = popup_create(["
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
29 \ .. "#{text: 'other tab'},"
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
30 \ .. "#{text: 'a comment line', props: [#{"
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
31 \ .. "col: 3, length: 7, minwidth: 20, type: 'comment'"
16811
0457d49eb2d9 patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents: 16809
diff changeset
32 \ .. "}]},"
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
33 \ .. "], #{line: 4, col: 9, minwidth: 20})\<CR>")
16794
ddfa924df50d patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents: 16778
diff changeset
34 call VerifyScreenDump(buf, 'Test_popupwin_02', {})
ddfa924df50d patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents: 16778
diff changeset
35
ddfa924df50d patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents: 16778
diff changeset
36 " switch back to first tabpage
ddfa924df50d patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents: 16778
diff changeset
37 call term_sendkeys(buf, "gt")
ddfa924df50d patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents: 16778
diff changeset
38 call VerifyScreenDump(buf, 'Test_popupwin_03', {})
ddfa924df50d patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents: 16778
diff changeset
39
ddfa924df50d patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents: 16778
diff changeset
40 " close that tabpage
ddfa924df50d patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents: 16778
diff changeset
41 call term_sendkeys(buf, ":quit!\<CR>")
ddfa924df50d patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents: 16778
diff changeset
42 call VerifyScreenDump(buf, 'Test_popupwin_04', {})
ddfa924df50d patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents: 16778
diff changeset
43
17037
9297877074a3 patch 8.1.1518: crash when setting 'columns' while a popup is visible
Bram Moolenaar <Bram@vim.org>
parents: 17026
diff changeset
44 " set 'columns' to a small value, size must be recomputed
9297877074a3 patch 8.1.1518: crash when setting 'columns' while a popup is visible
Bram Moolenaar <Bram@vim.org>
parents: 17026
diff changeset
45 call term_sendkeys(buf, ":let cols = &columns\<CR>")
9297877074a3 patch 8.1.1518: crash when setting 'columns' while a popup is visible
Bram Moolenaar <Bram@vim.org>
parents: 17026
diff changeset
46 call term_sendkeys(buf, ":set columns=12\<CR>")
9297877074a3 patch 8.1.1518: crash when setting 'columns' while a popup is visible
Bram Moolenaar <Bram@vim.org>
parents: 17026
diff changeset
47 call VerifyScreenDump(buf, 'Test_popupwin_04a', {})
9297877074a3 patch 8.1.1518: crash when setting 'columns' while a popup is visible
Bram Moolenaar <Bram@vim.org>
parents: 17026
diff changeset
48 call term_sendkeys(buf, ":let &columns = cols\<CR>")
9297877074a3 patch 8.1.1518: crash when setting 'columns' while a popup is visible
Bram Moolenaar <Bram@vim.org>
parents: 17026
diff changeset
49
16839
032d5335987e patch 8.1.1421: drawing "~" line in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16837
diff changeset
50 " resize popup, show empty line at bottom
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
51 call term_sendkeys(buf, ":call popup_move(popupwin, #{minwidth: 15, maxwidth: 25, minheight: 3, maxheight: 5})\<CR>")
16817
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
52 call term_sendkeys(buf, ":redraw\<CR>")
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
53 call VerifyScreenDump(buf, 'Test_popupwin_05', {})
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
54
16839
032d5335987e patch 8.1.1421: drawing "~" line in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16837
diff changeset
55 " show not fitting line at bottom
032d5335987e patch 8.1.1421: drawing "~" line in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16837
diff changeset
56 call term_sendkeys(buf, ":call setbufline(winbufnr(popupwin), 3, 'this line will not fit here')\<CR>")
032d5335987e patch 8.1.1421: drawing "~" line in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16837
diff changeset
57 call term_sendkeys(buf, ":redraw\<CR>")
032d5335987e patch 8.1.1421: drawing "~" line in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16837
diff changeset
58 call VerifyScreenDump(buf, 'Test_popupwin_06', {})
032d5335987e patch 8.1.1421: drawing "~" line in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16837
diff changeset
59
16998
2ec0f953ec3f patch 8.1.1499: ruler not updated after popup window was removed
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
60 " move popup over ruler
2ec0f953ec3f patch 8.1.1499: ruler not updated after popup window was removed
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
61 call term_sendkeys(buf, ":set cmdheight=2\<CR>")
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
62 call term_sendkeys(buf, ":call popup_move(popupwin, #{line: 7, col: 55})\<CR>")
17387
2558f90045e5 patch 8.1.1692: using *{} for literal dict is not backwards compatible
Bram Moolenaar <Bram@vim.org>
parents: 17368
diff changeset
63 call term_sendkeys(buf, ":\<CR>")
16998
2ec0f953ec3f patch 8.1.1499: ruler not updated after popup window was removed
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
64 call VerifyScreenDump(buf, 'Test_popupwin_07', {})
2ec0f953ec3f patch 8.1.1499: ruler not updated after popup window was removed
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
65
2ec0f953ec3f patch 8.1.1499: ruler not updated after popup window was removed
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
66 " clear all popups after moving the cursor a bit, so that ruler is updated
2ec0f953ec3f patch 8.1.1499: ruler not updated after popup window was removed
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
67 call term_sendkeys(buf, "axxx\<Esc>")
2ec0f953ec3f patch 8.1.1499: ruler not updated after popup window was removed
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
68 call term_wait(buf)
2ec0f953ec3f patch 8.1.1499: ruler not updated after popup window was removed
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
69 call term_sendkeys(buf, "0")
2ec0f953ec3f patch 8.1.1499: ruler not updated after popup window was removed
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
70 call term_wait(buf)
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
71 call term_sendkeys(buf, ":call popup_clear()\<CR>")
16998
2ec0f953ec3f patch 8.1.1499: ruler not updated after popup window was removed
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
72 call VerifyScreenDump(buf, 'Test_popupwin_08', {})
2ec0f953ec3f patch 8.1.1499: ruler not updated after popup window was removed
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
73
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 " clean up
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 call StopVimInTerminal(buf)
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 call delete('XtestPopup')
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 endfunc
16800
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
78
16884
59e4148c0c73 patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16880
diff changeset
79 func Test_popup_with_border_and_padding()
59e4148c0c73 patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16880
diff changeset
80 if !CanRunVimInTerminal()
16965
ba7727889385 patch 8.1.1483: skipped tests are not properly listed
Bram Moolenaar <Bram@vim.org>
parents: 16908
diff changeset
81 throw 'Skipped: cannot make screendumps'
16884
59e4148c0c73 patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16880
diff changeset
82 endif
59e4148c0c73 patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16880
diff changeset
83
16886
2bd51fdcc793 patch 8.1.1444: not using double line characters for popup border
Bram Moolenaar <Bram@vim.org>
parents: 16884
diff changeset
84 for iter in range(0, 1)
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
85 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
86 call setline(1, range(1, 100))
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
87 call popup_create('hello border', #{line: 2, col: 3, border: []})
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
88 call popup_create('hello padding', #{line: 2, col: 23, padding: []})
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
89 call popup_create('hello both', #{line: 2, col: 43, border: [], padding: []})
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
90 call popup_create('border TL', #{line: 6, col: 3, border: [1, 0, 0, 4]})
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
91 call popup_create('paddings', #{line: 6, col: 23, padding: [1, 3, 2, 4]})
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
92 call popup_create('wrapped longer text', #{line: 8, col: 55, padding: [0, 3, 0, 3], border: [0, 1, 0, 1]})
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
93 call popup_create('right aligned text', #{line: 11, col: 56, wrap: 0, padding: [0, 3, 0, 3], border: [0, 1, 0, 1]})
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
94 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
95 call insert(lines, iter == 1 ? '' : 'set enc=latin1')
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
96 call writefile(lines, 'XtestPopupBorder')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
97 let buf = RunVimInTerminal('-S XtestPopupBorder', #{rows: 15})
16886
2bd51fdcc793 patch 8.1.1444: not using double line characters for popup border
Bram Moolenaar <Bram@vim.org>
parents: 16884
diff changeset
98 call VerifyScreenDump(buf, 'Test_popupwin_2' .. iter, {})
2bd51fdcc793 patch 8.1.1444: not using double line characters for popup border
Bram Moolenaar <Bram@vim.org>
parents: 16884
diff changeset
99
2bd51fdcc793 patch 8.1.1444: not using double line characters for popup border
Bram Moolenaar <Bram@vim.org>
parents: 16884
diff changeset
100 call StopVimInTerminal(buf)
2bd51fdcc793 patch 8.1.1444: not using double line characters for popup border
Bram Moolenaar <Bram@vim.org>
parents: 16884
diff changeset
101 call delete('XtestPopupBorder')
2bd51fdcc793 patch 8.1.1444: not using double line characters for popup border
Bram Moolenaar <Bram@vim.org>
parents: 16884
diff changeset
102 endfor
16884
59e4148c0c73 patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16880
diff changeset
103
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
104 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
105 call setline(1, range(1, 100))
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
106 hi BlueColor ctermbg=lightblue
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
107 hi TopColor ctermbg=253
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
108 hi RightColor ctermbg=245
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
109 hi BottomColor ctermbg=240
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
110 hi LeftColor ctermbg=248
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
111 call popup_create('hello border', #{line: 2, col: 3, border: [], borderhighlight: ['BlueColor']})
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
112 call popup_create(['hello border', 'and more'], #{line: 2, col: 23, border: [], borderhighlight: ['TopColor', 'RightColor', 'BottomColor', 'LeftColor']})
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
113 call popup_create(['hello border', 'lines only'], #{line: 2, col: 43, border: [], borderhighlight: ['BlueColor'], borderchars: ['x']})
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
114 call popup_create(['hello border', 'with corners'], #{line: 2, col: 60, border: [], borderhighlight: ['BlueColor'], borderchars: ['x', '#']})
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
115 let winid = popup_create(['hello border', 'with numbers'], #{line: 6, col: 3, border: [], borderhighlight: ['BlueColor'], borderchars: ['0', '1', '2', '3', '4', '5', '6', '7']})
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
116 call popup_create(['hello border', 'just blanks'], #{line: 7, col: 23, border: [], borderhighlight: ['BlueColor'], borderchars: [' ']})
17312
484424955bfa patch 8.1.1655: popup window border drawn wrong with multi-byte char
Bram Moolenaar <Bram@vim.org>
parents: 17292
diff changeset
117 func MultiByte()
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
118 call popup_create(['hello'], #{line: 8, col: 43, border: [], borderchars: ['─', '│', '─', '│', '┌', '┐', '┘', '└']})
17312
484424955bfa patch 8.1.1655: popup window border drawn wrong with multi-byte char
Bram Moolenaar <Bram@vim.org>
parents: 17292
diff changeset
119 endfunc
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
120 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
121 call writefile(lines, 'XtestPopupBorder')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
122 let buf = RunVimInTerminal('-S XtestPopupBorder', #{rows: 12})
16888
ec61b6b79865 patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16886
diff changeset
123 call VerifyScreenDump(buf, 'Test_popupwin_22', {})
ec61b6b79865 patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16886
diff changeset
124
17125
b4eb06233448 patch 8.1.1562: popup window not always redrawn after popup_setoptions()
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
125 " check that changing borderchars triggers a redraw
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
126 call term_sendkeys(buf, ":call popup_setoptions(winid, #{borderchars: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']})\<CR>")
17125
b4eb06233448 patch 8.1.1562: popup window not always redrawn after popup_setoptions()
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
127 call VerifyScreenDump(buf, 'Test_popupwin_23', {})
b4eb06233448 patch 8.1.1562: popup window not always redrawn after popup_setoptions()
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
128
17312
484424955bfa patch 8.1.1655: popup window border drawn wrong with multi-byte char
Bram Moolenaar <Bram@vim.org>
parents: 17292
diff changeset
129 " check multi-byte border only with 'ambiwidth' single
484424955bfa patch 8.1.1655: popup window border drawn wrong with multi-byte char
Bram Moolenaar <Bram@vim.org>
parents: 17292
diff changeset
130 if &ambiwidth == 'single'
484424955bfa patch 8.1.1655: popup window border drawn wrong with multi-byte char
Bram Moolenaar <Bram@vim.org>
parents: 17292
diff changeset
131 call term_sendkeys(buf, ":call MultiByte()\<CR>")
484424955bfa patch 8.1.1655: popup window border drawn wrong with multi-byte char
Bram Moolenaar <Bram@vim.org>
parents: 17292
diff changeset
132 call VerifyScreenDump(buf, 'Test_popupwin_24', {})
484424955bfa patch 8.1.1655: popup window border drawn wrong with multi-byte char
Bram Moolenaar <Bram@vim.org>
parents: 17292
diff changeset
133 endif
484424955bfa patch 8.1.1655: popup window border drawn wrong with multi-byte char
Bram Moolenaar <Bram@vim.org>
parents: 17292
diff changeset
134
16888
ec61b6b79865 patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16886
diff changeset
135 call StopVimInTerminal(buf)
ec61b6b79865 patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16886
diff changeset
136 call delete('XtestPopupBorder')
ec61b6b79865 patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16886
diff changeset
137
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
138 let with_border_or_padding = #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
139 \ line: 2,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
140 \ core_line: 3,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
141 \ col: 3,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
142 \ core_col: 4,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
143 \ width: 14,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
144 \ core_width: 12,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
145 \ height: 3,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
146 \ core_height: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
147 \ firstline: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
148 \ scrollbar: 0,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
149 \ visible: 1}
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
150 let winid = popup_create('hello border', #{line: 2, col: 3, border: []})",
16884
59e4148c0c73 patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16880
diff changeset
151 call assert_equal(with_border_or_padding, popup_getpos(winid))
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
152 let options = popup_getoptions(winid)
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
153 call assert_equal([], options.border)
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
154 call assert_false(has_key(options, "padding"))
16884
59e4148c0c73 patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16880
diff changeset
155
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
156 let winid = popup_create('hello padding', #{line: 2, col: 3, padding: []})
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
157 let with_border_or_padding.width = 15
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
158 let with_border_or_padding.core_width = 13
16884
59e4148c0c73 patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16880
diff changeset
159 call assert_equal(with_border_or_padding, popup_getpos(winid))
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
160 let options = popup_getoptions(winid)
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
161 call assert_false(has_key(options, "border"))
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
162 call assert_equal([], options.padding)
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
163
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
164 call popup_setoptions(winid, #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
165 \ padding: [1, 2, 3, 4],
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
166 \ border: [4, 0, 7, 8],
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
167 \ borderhighlight: ['Top', 'Right', 'Bottom', 'Left'],
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
168 \ borderchars: ['1', '^', '2', '>', '3', 'v', '4', '<'],
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
169 \ })
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
170 let options = popup_getoptions(winid)
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
171 call assert_equal([1, 0, 1, 1], options.border)
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
172 call assert_equal([1, 2, 3, 4], options.padding)
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
173 call assert_equal(['Top', 'Right', 'Bottom', 'Left'], options.borderhighlight)
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
174 call assert_equal(['1', '^', '2', '>', '3', 'v', '4', '<'], options.borderchars)
16884
59e4148c0c73 patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16880
diff changeset
175
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
176 let winid = popup_create('hello both', #{line: 3, col: 8, border: [], padding: []})
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
177 call assert_equal(#{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
178 \ line: 3,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
179 \ core_line: 5,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
180 \ col: 8,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
181 \ core_col: 10,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
182 \ width: 14,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
183 \ core_width: 10,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
184 \ height: 5,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
185 \ scrollbar: 0,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
186 \ core_height: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
187 \ firstline: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
188 \ visible: 1}, popup_getpos(winid))
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
189
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
190 call popup_clear()
16884
59e4148c0c73 patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16880
diff changeset
191 endfunc
59e4148c0c73 patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16880
diff changeset
192
16849
629f3d3b6886 patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16843
diff changeset
193 func Test_popup_with_syntax_win_execute()
629f3d3b6886 patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16843
diff changeset
194 if !CanRunVimInTerminal()
16965
ba7727889385 patch 8.1.1483: skipped tests are not properly listed
Bram Moolenaar <Bram@vim.org>
parents: 16908
diff changeset
195 throw 'Skipped: cannot make screendumps'
16849
629f3d3b6886 patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16843
diff changeset
196 endif
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
197 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
198 call setline(1, range(1, 100))
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
199 hi PopupColor ctermbg=lightblue
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
200 let winid = popup_create([
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
201 \ '#include <stdio.h>',
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
202 \ 'int main(void)',
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
203 \ '{',
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
204 \ ' printf(123);',
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
205 \ '}',
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
206 \], #{line: 3, col: 25, highlight: 'PopupColor'})
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
207 call win_execute(winid, 'set syntax=cpp')
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
208 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
209 call writefile(lines, 'XtestPopup')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
210 let buf = RunVimInTerminal('-S XtestPopup', #{rows: 10})
16849
629f3d3b6886 patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16843
diff changeset
211 call VerifyScreenDump(buf, 'Test_popupwin_10', {})
629f3d3b6886 patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16843
diff changeset
212
629f3d3b6886 patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16843
diff changeset
213 " clean up
629f3d3b6886 patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16843
diff changeset
214 call StopVimInTerminal(buf)
629f3d3b6886 patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16843
diff changeset
215 call delete('XtestPopup')
629f3d3b6886 patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16843
diff changeset
216 endfunc
629f3d3b6886 patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16843
diff changeset
217
629f3d3b6886 patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16843
diff changeset
218 func Test_popup_with_syntax_setbufvar()
629f3d3b6886 patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16843
diff changeset
219 if !CanRunVimInTerminal()
16965
ba7727889385 patch 8.1.1483: skipped tests are not properly listed
Bram Moolenaar <Bram@vim.org>
parents: 16908
diff changeset
220 throw 'Skipped: cannot make screendumps'
16849
629f3d3b6886 patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16843
diff changeset
221 endif
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
222 let lines =<< trim END
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
223 call setline(1, range(1, 100))
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
224 hi PopupColor ctermbg=lightgrey
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
225 let winid = popup_create([
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
226 \ '#include <stdio.h>',
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
227 \ 'int main(void)',
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
228 \ '{',
17314
b60402471f69 patch 8.1.1656: popup window width is wrong when using Tabs
Bram Moolenaar <Bram@vim.org>
parents: 17312
diff changeset
229 \ "\tprintf(567);",
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
230 \ '}',
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
231 \], #{line: 3, col: 21, highlight: 'PopupColor'})
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
232 call setbufvar(winbufnr(winid), '&syntax', 'cpp')
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
233 END
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
234 call writefile(lines, 'XtestPopup')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
235 let buf = RunVimInTerminal('-S XtestPopup', #{rows: 10})
16849
629f3d3b6886 patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16843
diff changeset
236 call VerifyScreenDump(buf, 'Test_popupwin_11', {})
629f3d3b6886 patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16843
diff changeset
237
629f3d3b6886 patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16843
diff changeset
238 " clean up
629f3d3b6886 patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16843
diff changeset
239 call StopVimInTerminal(buf)
629f3d3b6886 patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16843
diff changeset
240 call delete('XtestPopup')
629f3d3b6886 patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16843
diff changeset
241 endfunc
629f3d3b6886 patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents: 16843
diff changeset
242
17022
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
243 func Test_popup_with_matches()
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
244 if !CanRunVimInTerminal()
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
245 throw 'Skipped: cannot make screendumps'
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
246 endif
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
247 let lines =<< trim END
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
248 call setline(1, ['111 222 333', '444 555 666'])
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
249 let winid = popup_create([
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
250 \ '111 222 333',
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
251 \ '444 555 666',
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
252 \], #{line: 3, col: 10, border: []})
17022
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
253 set hlsearch
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
254 /666
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
255 call matchadd('ErrorMsg', '111')
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
256 call matchadd('ErrorMsg', '444')
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
257 call win_execute(winid, "call matchadd('ErrorMsg', '111')")
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
258 call win_execute(winid, "call matchadd('ErrorMsg', '555')")
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
259 END
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
260 call writefile(lines, 'XtestPopupMatches')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
261 let buf = RunVimInTerminal('-S XtestPopupMatches', #{rows: 10})
17022
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
262 call VerifyScreenDump(buf, 'Test_popupwin_matches', {})
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
263
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
264 " clean up
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
265 call StopVimInTerminal(buf)
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
266 call delete('XtestPopupMatches')
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
267 endfunc
79c3a52fdb07 patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents: 16998
diff changeset
268
16898
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
269 func Test_popup_all_corners()
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
270 if !CanRunVimInTerminal()
16965
ba7727889385 patch 8.1.1483: skipped tests are not properly listed
Bram Moolenaar <Bram@vim.org>
parents: 16908
diff changeset
271 throw 'Skipped: cannot make screendumps'
16898
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
272 endif
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
273 let lines =<< trim END
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
274 call setline(1, repeat([repeat('-', 60)], 15))
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
275 set so=0
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
276 normal 2G3|r#
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
277 let winid1 = popup_create(['first', 'second'], #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
278 \ line: 'cursor+1',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
279 \ col: 'cursor',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
280 \ pos: 'topleft',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
281 \ border: [],
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
282 \ padding: [],
16898
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
283 \ })
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
284 normal 25|r@
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
285 let winid1 = popup_create(['First', 'SeconD'], #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
286 \ line: 'cursor+1',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
287 \ col: 'cursor',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
288 \ pos: 'topright',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
289 \ border: [],
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
290 \ padding: [],
16898
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
291 \ })
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
292 normal 9G29|r%
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
293 let winid1 = popup_create(['fiRSt', 'seCOnd'], #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
294 \ line: 'cursor-1',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
295 \ col: 'cursor',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
296 \ pos: 'botleft',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
297 \ border: [],
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
298 \ padding: [],
16898
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
299 \ })
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
300 normal 51|r&
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
301 let winid1 = popup_create(['FIrsT', 'SEcoND'], #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
302 \ line: 'cursor-1',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
303 \ col: 'cursor',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
304 \ pos: 'botright',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
305 \ border: [],
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
306 \ padding: [],
16898
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
307 \ })
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
308 END
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
309 call writefile(lines, 'XtestPopupCorners')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
310 let buf = RunVimInTerminal('-S XtestPopupCorners', #{rows: 12})
16898
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
311 call VerifyScreenDump(buf, 'Test_popupwin_corners', {})
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
312
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
313 " clean up
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
314 call StopVimInTerminal(buf)
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
315 call delete('XtestPopupCorners')
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
316 endfunc
16fd1bb2e675 patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
317
17047
6400d1ad5e4b patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents: 17045
diff changeset
318 func Test_popup_firstline()
6400d1ad5e4b patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents: 17045
diff changeset
319 if !CanRunVimInTerminal()
6400d1ad5e4b patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents: 17045
diff changeset
320 throw 'Skipped: cannot make screendumps'
6400d1ad5e4b patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents: 17045
diff changeset
321 endif
6400d1ad5e4b patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents: 17045
diff changeset
322 let lines =<< trim END
6400d1ad5e4b patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents: 17045
diff changeset
323 call setline(1, range(1, 20))
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
324 call popup_create(['1111', '222222', '33333', '44', '5', '666666', '77777', '888', '9999999999999999'], #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
325 \ maxheight: 4,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
326 \ firstline: 3,
17047
6400d1ad5e4b patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents: 17045
diff changeset
327 \ })
6400d1ad5e4b patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents: 17045
diff changeset
328 END
6400d1ad5e4b patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents: 17045
diff changeset
329 call writefile(lines, 'XtestPopupFirstline')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
330 let buf = RunVimInTerminal('-S XtestPopupFirstline', #{rows: 10})
17047
6400d1ad5e4b patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents: 17045
diff changeset
331 call VerifyScreenDump(buf, 'Test_popupwin_firstline', {})
6400d1ad5e4b patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents: 17045
diff changeset
332
6400d1ad5e4b patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents: 17045
diff changeset
333 " clean up
6400d1ad5e4b patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents: 17045
diff changeset
334 call StopVimInTerminal(buf)
6400d1ad5e4b patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents: 17045
diff changeset
335 call delete('XtestPopupFirstline')
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
336
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
337 let winid = popup_create(['1111', '222222', '33333', '44444'], #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
338 \ maxheight: 2,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
339 \ firstline: 3,
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
340 \ })
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
341 call assert_equal(3, popup_getoptions(winid).firstline)
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
342 call popup_setoptions(winid, #{firstline: 1})
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
343 call assert_equal(1, popup_getoptions(winid).firstline)
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
344
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
345 call popup_close(winid)
17047
6400d1ad5e4b patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents: 17045
diff changeset
346 endfunc
6400d1ad5e4b patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents: 17045
diff changeset
347
17055
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
348 func Test_popup_drag()
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
349 if !CanRunVimInTerminal()
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
350 throw 'Skipped: cannot make screendumps'
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
351 endif
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
352 " create a popup that covers the command line
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
353 let lines =<< trim END
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
354 call setline(1, range(1, 20))
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
355 let winid = popup_create(['1111', '222222', '33333'], #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
356 \ drag: 1,
17580
d5e5d0fc3fa8 patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17551
diff changeset
357 \ resize: 1,
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
358 \ border: [],
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
359 \ line: &lines - 4,
17055
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
360 \ })
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
361 func Dragit()
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
362 call feedkeys("\<F3>\<LeftMouse>\<F4>\<LeftDrag>\<LeftRelease>", "xt")
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
363 endfunc
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
364 map <silent> <F3> :call test_setmouse(&lines - 4, &columns / 2)<CR>
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
365 map <silent> <F4> :call test_setmouse(&lines - 8, &columns / 2)<CR>
17580
d5e5d0fc3fa8 patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17551
diff changeset
366 func Resize()
d5e5d0fc3fa8 patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17551
diff changeset
367 call feedkeys("\<F5>\<LeftMouse>\<F6>\<LeftDrag>\<LeftRelease>", "xt")
d5e5d0fc3fa8 patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17551
diff changeset
368 endfunc
d5e5d0fc3fa8 patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17551
diff changeset
369 map <silent> <F5> :call test_setmouse(6, 41)<CR>
d5e5d0fc3fa8 patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17551
diff changeset
370 map <silent> <F6> :call test_setmouse(7, 45)<CR>
17055
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
371 END
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
372 call writefile(lines, 'XtestPopupDrag')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
373 let buf = RunVimInTerminal('-S XtestPopupDrag', #{rows: 10})
17055
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
374 call VerifyScreenDump(buf, 'Test_popupwin_drag_01', {})
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
375
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
376 call term_sendkeys(buf, ":call Dragit()\<CR>")
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
377 call VerifyScreenDump(buf, 'Test_popupwin_drag_02', {})
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
378
17580
d5e5d0fc3fa8 patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17551
diff changeset
379 call term_sendkeys(buf, ":call Resize()\<CR>")
d5e5d0fc3fa8 patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17551
diff changeset
380 call VerifyScreenDump(buf, 'Test_popupwin_drag_03', {})
d5e5d0fc3fa8 patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17551
diff changeset
381
17055
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
382 " clean up
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
383 call StopVimInTerminal(buf)
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
384 call delete('XtestPopupDrag')
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
385 endfunc
f4de7ccdfd8c patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
386
17219
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
387 func Test_popup_close_with_mouse()
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
388 if !CanRunVimInTerminal()
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
389 throw 'Skipped: cannot make screendumps'
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
390 endif
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
391 let lines =<< trim END
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
392 call setline(1, range(1, 20))
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
393 " With border, can click on X
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
394 let winid = popup_create('foobar', #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
395 \ close: 'button',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
396 \ border: [],
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
397 \ line: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
398 \ col: 1,
17219
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
399 \ })
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
400 func CloseMsg(id, result)
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
401 echomsg 'Popup closed with ' .. a:result
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
402 endfunc
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
403 let winid = popup_create('notification', #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
404 \ close: 'click',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
405 \ line: 3,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
406 \ col: 15,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
407 \ callback: 'CloseMsg',
17219
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
408 \ })
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
409 let winid = popup_create('no border here', #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
410 \ close: 'button',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
411 \ line: 5,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
412 \ col: 3,
17219
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
413 \ })
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
414 let winid = popup_create('only padding', #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
415 \ close: 'button',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
416 \ padding: [],
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
417 \ line: 5,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
418 \ col: 23,
17219
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
419 \ })
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
420 func CloseWithX()
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
421 call feedkeys("\<F3>\<LeftMouse>\<LeftRelease>", "xt")
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
422 endfunc
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
423 map <silent> <F3> :call test_setmouse(1, len('foobar') + 2)<CR>
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
424 func CloseWithClick()
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
425 call feedkeys("\<F4>\<LeftMouse>\<LeftRelease>", "xt")
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
426 endfunc
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
427 map <silent> <F4> :call test_setmouse(3, 17)<CR>
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
428 END
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
429 call writefile(lines, 'XtestPopupClose')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
430 let buf = RunVimInTerminal('-S XtestPopupClose', #{rows: 10})
17219
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
431 call VerifyScreenDump(buf, 'Test_popupwin_close_01', {})
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
432
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
433 call term_sendkeys(buf, ":call CloseWithX()\<CR>")
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
434 call VerifyScreenDump(buf, 'Test_popupwin_close_02', {})
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
435
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
436 call term_sendkeys(buf, ":call CloseWithClick()\<CR>")
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
437 call VerifyScreenDump(buf, 'Test_popupwin_close_03', {})
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
438
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
439 " clean up
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
440 call StopVimInTerminal(buf)
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
441 call delete('XtestPopupClose')
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
442 endfunction
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
443
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
444 func Test_popup_with_mask()
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
445 if !CanRunVimInTerminal()
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
446 throw 'Skipped: cannot make screendumps'
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
447 endif
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
448 let lines =<< trim END
17241
3ada3d207b33 patch 8.1.1620: no test for popup window with border and mask
Bram Moolenaar <Bram@vim.org>
parents: 17235
diff changeset
449 call setline(1, repeat([join(range(1, 42), '')], 13))
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
450 hi PopupColor ctermbg=lightgrey
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
451 let winid = popup_create([
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
452 \ 'some text',
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
453 \ 'another line',
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
454 \], #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
455 \ line: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
456 \ col: 10,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
457 \ wrap: 0,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
458 \ fixed: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
459 \ zindex: 90,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
460 \ padding: [],
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
461 \ highlight: 'PopupColor',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
462 \ mask: [[1,1,1,1], [-5,-1,4,4], [7,9,2,3], [2,4,3,3]]})
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
463 call popup_create([
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
464 \ 'xxxxxxxxx',
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
465 \ 'yyyyyyyyy',
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
466 \], #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
467 \ line: 3,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
468 \ col: 18,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
469 \ zindex: 20})
17241
3ada3d207b33 patch 8.1.1620: no test for popup window with border and mask
Bram Moolenaar <Bram@vim.org>
parents: 17235
diff changeset
470 let winidb = popup_create([
3ada3d207b33 patch 8.1.1620: no test for popup window with border and mask
Bram Moolenaar <Bram@vim.org>
parents: 17235
diff changeset
471 \ 'just one line',
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
472 \], #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
473 \ line: 7,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
474 \ col: 10,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
475 \ wrap: 0,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
476 \ fixed: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
477 \ close: 'button',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
478 \ zindex: 90,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
479 \ padding: [],
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
480 \ border: [],
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
481 \ mask: [[1,2,1,1], [-5,-1,4,4], [7,9,2,3], [3,5,5,5],[-7,-4,5,5]]})
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
482 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
483 call writefile(lines, 'XtestPopupMask')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
484 let buf = RunVimInTerminal('-S XtestPopupMask', #{rows: 13})
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
485 call VerifyScreenDump(buf, 'Test_popupwin_mask_1', {})
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
486
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
487 call term_sendkeys(buf, ":call popup_move(winid, #{col: 11, line: 2})\<CR>")
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
488 call term_sendkeys(buf, ":call popup_move(winidb, #{col: 12})\<CR>")
17387
2558f90045e5 patch 8.1.1692: using *{} for literal dict is not backwards compatible
Bram Moolenaar <Bram@vim.org>
parents: 17368
diff changeset
489 call term_sendkeys(buf, ":\<CR>")
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
490 call VerifyScreenDump(buf, 'Test_popupwin_mask_2', {})
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
491
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
492 call term_sendkeys(buf, ":call popup_move(winid, #{col: 65, line: 2})\<CR>")
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
493 call term_sendkeys(buf, ":call popup_move(winidb, #{col: 63})\<CR>")
17387
2558f90045e5 patch 8.1.1692: using *{} for literal dict is not backwards compatible
Bram Moolenaar <Bram@vim.org>
parents: 17368
diff changeset
494 call term_sendkeys(buf, ":\<CR>")
17235
2a97167854fc patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents: 17231
diff changeset
495 call VerifyScreenDump(buf, 'Test_popupwin_mask_3', {})
2a97167854fc patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents: 17231
diff changeset
496
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
497 call term_sendkeys(buf, ":call popup_move(winid, #{pos: 'topright', col: 12, line: 2})\<CR>")
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
498 call term_sendkeys(buf, ":call popup_move(winidb, #{pos: 'topright', col: 12})\<CR>")
17387
2558f90045e5 patch 8.1.1692: using *{} for literal dict is not backwards compatible
Bram Moolenaar <Bram@vim.org>
parents: 17368
diff changeset
499 call term_sendkeys(buf, ":\<CR>")
17235
2a97167854fc patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents: 17231
diff changeset
500 call VerifyScreenDump(buf, 'Test_popupwin_mask_4', {})
2a97167854fc patch 8.1.1617: no test for popup window with mask and position fixed
Bram Moolenaar <Bram@vim.org>
parents: 17231
diff changeset
501
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
502 call term_sendkeys(buf, ":call popup_move(winid, #{pos: 'topright', col: 12, line: 11})\<CR>")
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
503 call term_sendkeys(buf, ":call popup_move(winidb, #{pos: 'topleft', col: 42, line: 11})\<CR>")
17387
2558f90045e5 patch 8.1.1692: using *{} for literal dict is not backwards compatible
Bram Moolenaar <Bram@vim.org>
parents: 17368
diff changeset
504 call term_sendkeys(buf, ":\<CR>")
17332
61f0bf94ef92 patch 8.1.1665: crash when popup window with mask is below the screen
Bram Moolenaar <Bram@vim.org>
parents: 17314
diff changeset
505 call VerifyScreenDump(buf, 'Test_popupwin_mask_5', {})
61f0bf94ef92 patch 8.1.1665: crash when popup window with mask is below the screen
Bram Moolenaar <Bram@vim.org>
parents: 17314
diff changeset
506
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
507 " clean up
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
508 call StopVimInTerminal(buf)
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
509 call delete('XtestPopupMask')
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
510 endfunc
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
511
17069
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
512 func Test_popup_select()
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
513 if !CanRunVimInTerminal()
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
514 throw 'Skipped: cannot make screendumps'
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
515 endif
17071
57125309eef3 patch 8.1.1535: popup select test fails on Mac
Bram Moolenaar <Bram@vim.org>
parents: 17069
diff changeset
516 if !has('clipboard')
57125309eef3 patch 8.1.1535: popup select test fails on Mac
Bram Moolenaar <Bram@vim.org>
parents: 17069
diff changeset
517 throw 'Skipped: clipboard feature missing'
57125309eef3 patch 8.1.1535: popup select test fails on Mac
Bram Moolenaar <Bram@vim.org>
parents: 17069
diff changeset
518 endif
17069
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
519 " create a popup with some text to be selected
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
520 let lines =<< trim END
17073
89753fdfab85 patch 8.1.1536: popup select test still fails on Mac
Bram Moolenaar <Bram@vim.org>
parents: 17071
diff changeset
521 set clipboard=autoselect
17069
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
522 call setline(1, range(1, 20))
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
523 let winid = popup_create(['the word', 'some more', 'several words here'], #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
524 \ drag: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
525 \ border: [],
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
526 \ line: 3,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
527 \ col: 10,
17069
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
528 \ })
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
529 func Select1()
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
530 call feedkeys("\<F3>\<LeftMouse>\<F4>\<LeftDrag>\<LeftRelease>", "xt")
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
531 endfunc
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
532 map <silent> <F3> :call test_setmouse(4, 15)<CR>
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
533 map <silent> <F4> :call test_setmouse(6, 23)<CR>
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
534 END
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
535 call writefile(lines, 'XtestPopupSelect')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
536 let buf = RunVimInTerminal('-S XtestPopupSelect', #{rows: 10})
17069
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
537 call term_sendkeys(buf, ":call Select1()\<CR>")
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
538 call VerifyScreenDump(buf, 'Test_popupwin_select_01', {})
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
539
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
540 call term_sendkeys(buf, ":call popup_close(winid)\<CR>")
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
541 call term_sendkeys(buf, "\"*p")
17338
b0de2e92ed46 patch 8.1.1668: popup window test is a bit flaky on some systems
Bram Moolenaar <Bram@vim.org>
parents: 17334
diff changeset
542 " clean the command line, sometimes it still shows a command
b0de2e92ed46 patch 8.1.1668: popup window test is a bit flaky on some systems
Bram Moolenaar <Bram@vim.org>
parents: 17334
diff changeset
543 call term_sendkeys(buf, ":\<esc>")
b0de2e92ed46 patch 8.1.1668: popup window test is a bit flaky on some systems
Bram Moolenaar <Bram@vim.org>
parents: 17334
diff changeset
544
17069
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
545 call VerifyScreenDump(buf, 'Test_popupwin_select_02', {})
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
546
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
547 " clean up
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
548 call StopVimInTerminal(buf)
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
549 call delete('XtestPopupSelect')
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
550 endfunc
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
551
16902
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
552 func Test_popup_in_tab()
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
553 " default popup is local to tab, not visible when in other tab
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
554 let winid = popup_create("text", {})
17043
d99805d25b42 patch 8.1.1521: when a popup window is closed the buffer remains
Bram Moolenaar <Bram@vim.org>
parents: 17037
diff changeset
555 let bufnr = winbufnr(winid)
16902
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
556 call assert_equal(1, popup_getpos(winid).visible)
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17125
diff changeset
557 call assert_equal(0, popup_getoptions(winid).tabpage)
16902
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
558 tabnew
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
559 call assert_equal(0, popup_getpos(winid).visible)
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17125
diff changeset
560 call assert_equal(1, popup_getoptions(winid).tabpage)
16902
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
561 quit
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
562 call assert_equal(1, popup_getpos(winid).visible)
17043
d99805d25b42 patch 8.1.1521: when a popup window is closed the buffer remains
Bram Moolenaar <Bram@vim.org>
parents: 17037
diff changeset
563
d99805d25b42 patch 8.1.1521: when a popup window is closed the buffer remains
Bram Moolenaar <Bram@vim.org>
parents: 17037
diff changeset
564 call assert_equal(1, bufexists(bufnr))
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
565 call popup_clear()
17043
d99805d25b42 patch 8.1.1521: when a popup window is closed the buffer remains
Bram Moolenaar <Bram@vim.org>
parents: 17037
diff changeset
566 " buffer is gone now
d99805d25b42 patch 8.1.1521: when a popup window is closed the buffer remains
Bram Moolenaar <Bram@vim.org>
parents: 17037
diff changeset
567 call assert_equal(0, bufexists(bufnr))
16902
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
568
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
569 " global popup is visible in any tab
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
570 let winid = popup_create("text", #{tabpage: -1})
16902
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
571 call assert_equal(1, popup_getpos(winid).visible)
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17125
diff changeset
572 call assert_equal(-1, popup_getoptions(winid).tabpage)
16902
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
573 tabnew
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
574 call assert_equal(1, popup_getpos(winid).visible)
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17125
diff changeset
575 call assert_equal(-1, popup_getoptions(winid).tabpage)
16902
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
576 quit
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
577 call assert_equal(1, popup_getpos(winid).visible)
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
578 call popup_clear()
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17125
diff changeset
579
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17125
diff changeset
580 " create popup in other tab
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17125
diff changeset
581 tabnew
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
582 let winid = popup_create("text", #{tabpage: 1})
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17125
diff changeset
583 call assert_equal(0, popup_getpos(winid).visible)
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17125
diff changeset
584 call assert_equal(1, popup_getoptions(winid).tabpage)
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17125
diff changeset
585 quit
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17125
diff changeset
586 call assert_equal(1, popup_getpos(winid).visible)
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17125
diff changeset
587 call assert_equal(0, popup_getoptions(winid).tabpage)
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17125
diff changeset
588 call popup_clear()
16902
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
589 endfunc
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
590
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
591 func Test_popup_valid_arguments()
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
592 " Zero value is like the property wasn't there
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
593 let winid = popup_create("text", #{col: 0})
16902
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
594 let pos = popup_getpos(winid)
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
595 call assert_inrange(&columns / 2 - 1, &columns / 2 + 1, pos.col)
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
596 call popup_clear()
16902
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
597
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
598 " using cursor column has minimum value of 1
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
599 let winid = popup_create("text", #{col: 'cursor-100'})
16902
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
600 let pos = popup_getpos(winid)
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
601 call assert_equal(1, pos.col)
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
602 call popup_clear()
16902
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
603
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
604 " center
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
605 let winid = popup_create("text", #{pos: 'center'})
16902
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
606 let pos = popup_getpos(winid)
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
607 let around = (&columns - pos.width) / 2
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
608 call assert_inrange(around - 1, around + 1, pos.col)
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
609 let around = (&lines - pos.height) / 2
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
610 call assert_inrange(around - 1, around + 1, pos.line)
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
611 call popup_clear()
16902
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
612 endfunc
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
613
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
614 func Test_popup_invalid_arguments()
17225
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
615 call assert_fails('call popup_create(666, {})', 'E86:')
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
616 call popup_clear()
16902
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
617 call assert_fails('call popup_create("text", "none")', 'E715:')
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
618 call popup_clear()
16902
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
619
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
620 call assert_fails('call popup_create("text", #{col: "xxx"})', 'E475:')
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
621 call popup_clear()
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
622 call assert_fails('call popup_create("text", #{col: "cursor8"})', 'E15:')
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
623 call popup_clear()
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
624 call assert_fails('call popup_create("text", #{col: "cursor+x"})', 'E15:')
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
625 call popup_clear()
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
626 call assert_fails('call popup_create("text", #{col: "cursor+8x"})', 'E15:')
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
627 call popup_clear()
16902
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
628
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
629 call assert_fails('call popup_create("text", #{line: "xxx"})', 'E475:')
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
630 call popup_clear()
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
631 call assert_fails('call popup_create("text", #{line: "cursor8"})', 'E15:')
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
632 call popup_clear()
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
633 call assert_fails('call popup_create("text", #{line: "cursor+x"})', 'E15:')
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
634 call popup_clear()
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
635 call assert_fails('call popup_create("text", #{line: "cursor+8x"})', 'E15:')
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
636 call popup_clear()
16902
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
637
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
638 call assert_fails('call popup_create("text", #{pos: "there"})', 'E475:')
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
639 call popup_clear()
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
640 call assert_fails('call popup_create("text", #{padding: "none"})', 'E714:')
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
641 call popup_clear()
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
642 call assert_fails('call popup_create("text", #{border: "none"})', 'E714:')
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
643 call popup_clear()
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
644 call assert_fails('call popup_create("text", #{borderhighlight: "none"})', 'E714:')
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
645 call popup_clear()
17421
73e81cd9e6cb patch 8.1.1709: Coverity warns for possibly using a NULL pointer
Bram Moolenaar <Bram@vim.org>
parents: 17417
diff changeset
646 call assert_fails('call popup_create("text", #{borderhighlight: test_null_list()})', 'E714:')
73e81cd9e6cb patch 8.1.1709: Coverity warns for possibly using a NULL pointer
Bram Moolenaar <Bram@vim.org>
parents: 17417
diff changeset
647 call popup_clear()
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
648 call assert_fails('call popup_create("text", #{borderchars: "none"})', 'E714:')
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
649 call popup_clear()
16902
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
650
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
651 call assert_fails('call popup_create([#{text: "text"}, 666], {})', 'E715:')
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
652 call popup_clear()
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
653 call assert_fails('call popup_create([#{text: "text", props: "none"}], {})', 'E714:')
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
654 call popup_clear()
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
655 call assert_fails('call popup_create([#{text: "text", props: ["none"]}], {})', 'E715:')
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
656 call popup_clear()
17417
aa4532c1d001 patch 8.1.1707: Coverity warns for possibly using a NULL pointer
Bram Moolenaar <Bram@vim.org>
parents: 17413
diff changeset
657 call assert_fails('call popup_create("text", #{mask: ["asdf"]})', 'E475:')
aa4532c1d001 patch 8.1.1707: Coverity warns for possibly using a NULL pointer
Bram Moolenaar <Bram@vim.org>
parents: 17413
diff changeset
658 call popup_clear()
aa4532c1d001 patch 8.1.1707: Coverity warns for possibly using a NULL pointer
Bram Moolenaar <Bram@vim.org>
parents: 17413
diff changeset
659 call assert_fails('call popup_create("text", #{mask: test_null_list()})', 'E475:')
aa4532c1d001 patch 8.1.1707: Coverity warns for possibly using a NULL pointer
Bram Moolenaar <Bram@vim.org>
parents: 17413
diff changeset
660 call popup_clear()
16902
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
661 endfunc
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
662
16863
2b00163053cd patch 8.1.1433: win_execute() may leave popup window focused
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
663 func Test_win_execute_closing_curwin()
2b00163053cd patch 8.1.1433: win_execute() may leave popup window focused
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
664 split
2b00163053cd patch 8.1.1433: win_execute() may leave popup window focused
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
665 let winid = popup_create('some text', {})
16874
da5f5836e90c patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 16863
diff changeset
666 call assert_fails('call win_execute(winid, winnr() .. "close")', 'E994')
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
667 call popup_clear()
16874
da5f5836e90c patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 16863
diff changeset
668 endfunc
da5f5836e90c patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 16863
diff changeset
669
da5f5836e90c patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 16863
diff changeset
670 func Test_win_execute_not_allowed()
da5f5836e90c patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 16863
diff changeset
671 let winid = popup_create('some text', {})
da5f5836e90c patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 16863
diff changeset
672 call assert_fails('call win_execute(winid, "split")', 'E994:')
da5f5836e90c patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 16863
diff changeset
673 call assert_fails('call win_execute(winid, "vsplit")', 'E994:')
da5f5836e90c patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 16863
diff changeset
674 call assert_fails('call win_execute(winid, "close")', 'E994:')
da5f5836e90c patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 16863
diff changeset
675 call assert_fails('call win_execute(winid, "bdelete")', 'E994:')
16878
4096722cd9c1 patch 8.1.1440: win_execute() test fails
Bram Moolenaar <Bram@vim.org>
parents: 16874
diff changeset
676 call assert_fails('call win_execute(winid, "bwipe!")', 'E994:')
16874
da5f5836e90c patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 16863
diff changeset
677 call assert_fails('call win_execute(winid, "tabnew")', 'E994:')
da5f5836e90c patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 16863
diff changeset
678 call assert_fails('call win_execute(winid, "tabnext")', 'E994:')
da5f5836e90c patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 16863
diff changeset
679 call assert_fails('call win_execute(winid, "next")', 'E994:')
da5f5836e90c patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 16863
diff changeset
680 call assert_fails('call win_execute(winid, "rewind")', 'E994:')
da5f5836e90c patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 16863
diff changeset
681 call assert_fails('call win_execute(winid, "buf")', 'E994:')
da5f5836e90c patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 16863
diff changeset
682 call assert_fails('call win_execute(winid, "edit")', 'E994:')
da5f5836e90c patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 16863
diff changeset
683 call assert_fails('call win_execute(winid, "enew")', 'E994:')
da5f5836e90c patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 16863
diff changeset
684 call assert_fails('call win_execute(winid, "wincmd x")', 'E994:')
da5f5836e90c patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 16863
diff changeset
685 call assert_fails('call win_execute(winid, "wincmd w")', 'E994:')
da5f5836e90c patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 16863
diff changeset
686 call assert_fails('call win_execute(winid, "wincmd t")', 'E994:')
da5f5836e90c patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 16863
diff changeset
687 call assert_fails('call win_execute(winid, "wincmd b")', 'E994:')
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
688 call popup_clear()
16863
2b00163053cd patch 8.1.1433: win_execute() may leave popup window focused
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
689 endfunc
2b00163053cd patch 8.1.1433: win_execute() may leave popup window focused
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
690
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
691 func Test_popup_with_wrap()
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
692 if !CanRunVimInTerminal()
16965
ba7727889385 patch 8.1.1483: skipped tests are not properly listed
Bram Moolenaar <Bram@vim.org>
parents: 16908
diff changeset
693 throw 'Skipped: cannot make screendumps'
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
694 endif
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
695 let lines =<< trim END
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
696 call setline(1, range(1, 100))
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
697 let winid = popup_create(
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
698 \ 'a long line that wont fit',
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
699 \ #{line: 3, col: 20, maxwidth: 10, wrap: 1})
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
700 END
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
701 call writefile(lines, 'XtestPopup')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
702 let buf = RunVimInTerminal('-S XtestPopup', #{rows: 10})
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
703 call VerifyScreenDump(buf, 'Test_popupwin_wrap', {})
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
704
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
705 " clean up
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
706 call StopVimInTerminal(buf)
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
707 call delete('XtestPopup')
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
708 endfunc
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
709
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
710 func Test_popup_without_wrap()
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
711 if !CanRunVimInTerminal()
16965
ba7727889385 patch 8.1.1483: skipped tests are not properly listed
Bram Moolenaar <Bram@vim.org>
parents: 16908
diff changeset
712 throw 'Skipped: cannot make screendumps'
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
713 endif
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
714 let lines =<< trim END
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
715 call setline(1, range(1, 100))
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
716 let winid = popup_create(
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
717 \ 'a long line that wont fit',
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
718 \ #{line: 3, col: 20, maxwidth: 10, wrap: 0})
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
719 END
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
720 call writefile(lines, 'XtestPopup')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
721 let buf = RunVimInTerminal('-S XtestPopup', #{rows: 10})
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
722 call VerifyScreenDump(buf, 'Test_popupwin_nowrap', {})
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
723
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
724 " clean up
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
725 call StopVimInTerminal(buf)
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
726 call delete('XtestPopup')
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
727 endfunc
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
728
17442
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
729 func Test_popup_with_showbreak()
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
730 if !CanRunVimInTerminal()
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
731 throw 'Skipped: cannot make screendumps'
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
732 endif
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
733 let lines =<< trim END
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
734 set showbreak=>>\
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
735 call setline(1, range(1, 20))
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
736 let winid = popup_dialog(
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
737 \ 'a long line here',
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
738 \ #{filter: 'popup_filter_yesno'})
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
739 END
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
740 call writefile(lines, 'XtestPopupShowbreak')
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
741 let buf = RunVimInTerminal('-S XtestPopupShowbreak', #{rows: 10})
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
742 call VerifyScreenDump(buf, 'Test_popupwin_showbreak', {})
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
743
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
744 " clean up
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
745 call term_sendkeys(buf, "y")
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
746 call StopVimInTerminal(buf)
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
747 call delete('XtestPopupShowbreak')
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
748 endfunc
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
749
16800
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
750 func Test_popup_time()
16802
f5487021fdad patch 8.1.1403: cannot build without the timer feature
Bram Moolenaar <Bram@vim.org>
parents: 16800
diff changeset
751 if !has('timers')
17089
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
752 throw 'Skipped: timer feature not supported'
16802
f5487021fdad patch 8.1.1403: cannot build without the timer feature
Bram Moolenaar <Bram@vim.org>
parents: 16800
diff changeset
753 endif
16800
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
754 topleft vnew
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
755 call setline(1, 'hello')
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
756
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
757 let winid = popup_create('world', #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
758 \ line: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
759 \ col: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
760 \ minwidth: 20,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
761 \ time: 500,
16800
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
762 \})
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
763 redraw
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
764 let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '')
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
765 call assert_equal('world', line)
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
766
17348
d82b0cfb1e82 patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents: 17338
diff changeset
767 call assert_equal(winid, popup_locate(1, 1))
d82b0cfb1e82 patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents: 17338
diff changeset
768 call assert_equal(winid, popup_locate(1, 20))
d82b0cfb1e82 patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents: 17338
diff changeset
769 call assert_equal(0, popup_locate(1, 21))
d82b0cfb1e82 patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents: 17338
diff changeset
770 call assert_equal(0, popup_locate(2, 1))
d82b0cfb1e82 patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents: 17338
diff changeset
771
16800
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
772 sleep 700m
16802
f5487021fdad patch 8.1.1403: cannot build without the timer feature
Bram Moolenaar <Bram@vim.org>
parents: 16800
diff changeset
773 redraw
16800
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
774 let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '')
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
775 call assert_equal('hello', line)
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
776
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
777 call popup_create('on the command line', #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
778 \ line: &lines,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
779 \ col: 10,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
780 \ minwidth: 20,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
781 \ time: 500,
16800
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
782 \})
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
783 redraw
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
784 let line = join(map(range(1, 30), 'screenstring(&lines, v:val)'), '')
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
785 call assert_match('.*on the command line.*', line)
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
786
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
787 sleep 700m
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
788 redraw
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
789 let line = join(map(range(1, 30), 'screenstring(&lines, v:val)'), '')
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
790 call assert_notmatch('.*on the command line.*', line)
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
791
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
792 bwipe!
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
793 endfunc
16809
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
794
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
795 func Test_popup_hide()
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
796 topleft vnew
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
797 call setline(1, 'hello')
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
798
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
799 let winid = popup_create('world', #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
800 \ line: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
801 \ col: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
802 \ minwidth: 20,
16809
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
803 \})
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
804 redraw
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
805 let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '')
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
806 call assert_equal('world', line)
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
807 call assert_equal(1, popup_getpos(winid).visible)
16859
0154363d3b98 patch 8.1.1431: popup window listed as "Scratch"
Bram Moolenaar <Bram@vim.org>
parents: 16857
diff changeset
808 " buffer is still listed and active
0154363d3b98 patch 8.1.1431: popup window listed as "Scratch"
Bram Moolenaar <Bram@vim.org>
parents: 16857
diff changeset
809 call assert_match(winbufnr(winid) .. 'u a.*\[Popup\]', execute('ls u'))
16809
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
810
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
811 call popup_hide(winid)
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
812 redraw
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
813 let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '')
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
814 call assert_equal('hello', line)
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
815 call assert_equal(0, popup_getpos(winid).visible)
16859
0154363d3b98 patch 8.1.1431: popup window listed as "Scratch"
Bram Moolenaar <Bram@vim.org>
parents: 16857
diff changeset
816 " buffer is still listed but hidden
0154363d3b98 patch 8.1.1431: popup window listed as "Scratch"
Bram Moolenaar <Bram@vim.org>
parents: 16857
diff changeset
817 call assert_match(winbufnr(winid) .. 'u h.*\[Popup\]', execute('ls u'))
16809
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
818
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
819 call popup_show(winid)
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
820 redraw
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
821 let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '')
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
822 call assert_equal('world', line)
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
823 call assert_equal(1, popup_getpos(winid).visible)
16809
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
824
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
825
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
826 call popup_close(winid)
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
827 redraw
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
828 let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '')
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
829 call assert_equal('hello', line)
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
830
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
831 " error is given for existing non-popup window
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
832 call assert_fails('call popup_hide(win_getid())', 'E993:')
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
833
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
834 " no error non-existing window
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
835 call popup_hide(1234234)
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
836 call popup_show(41234234)
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
837
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
838 bwipe!
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
839 endfunc
16817
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
840
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
841 func Test_popup_move()
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
842 topleft vnew
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
843 call setline(1, 'hello')
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
844
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
845 let winid = popup_create('world', #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
846 \ line: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
847 \ col: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
848 \ minwidth: 20,
16817
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
849 \})
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
850 redraw
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
851 let line = join(map(range(1, 6), 'screenstring(1, v:val)'), '')
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
852 call assert_equal('world ', line)
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
853
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
854 call popup_move(winid, #{line: 2, col: 2})
16817
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
855 redraw
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
856 let line = join(map(range(1, 6), 'screenstring(1, v:val)'), '')
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
857 call assert_equal('hello ', line)
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
858 let line = join(map(range(1, 6), 'screenstring(2, v:val)'), '')
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
859 call assert_equal('~world', line)
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
860
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
861 call popup_move(winid, #{line: 1})
16817
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
862 redraw
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
863 let line = join(map(range(1, 6), 'screenstring(1, v:val)'), '')
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
864 call assert_equal('hworld', line)
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
865
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
866 call popup_close(winid)
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
867
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
868 bwipe!
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
869 endfunc
16829
5cebaecad422 patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16817
diff changeset
870
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
871 func Test_popup_getpos()
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
872 let winid = popup_create('hello', #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
873 \ line: 2,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
874 \ col: 3,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
875 \ minwidth: 10,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
876 \ minheight: 11,
16829
5cebaecad422 patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16817
diff changeset
877 \})
5cebaecad422 patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16817
diff changeset
878 redraw
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
879 let res = popup_getpos(winid)
16829
5cebaecad422 patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16817
diff changeset
880 call assert_equal(2, res.line)
5cebaecad422 patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16817
diff changeset
881 call assert_equal(3, res.col)
5cebaecad422 patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16817
diff changeset
882 call assert_equal(10, res.width)
5cebaecad422 patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16817
diff changeset
883 call assert_equal(11, res.height)
16841
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
884 call assert_equal(1, res.visible)
16829
5cebaecad422 patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16817
diff changeset
885
5cebaecad422 patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16817
diff changeset
886 call popup_close(winid)
5cebaecad422 patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16817
diff changeset
887 endfunc
16837
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
888
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
889 func Test_popup_width_longest()
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
890 let tests = [
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
891 \ [['hello', 'this', 'window', 'displays', 'all of its text'], 15],
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
892 \ [['hello', 'this', 'window', 'all of its text', 'displays'], 15],
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
893 \ [['hello', 'this', 'all of its text', 'window', 'displays'], 15],
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
894 \ [['hello', 'all of its text', 'this', 'window', 'displays'], 15],
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
895 \ [['all of its text', 'hello', 'this', 'window', 'displays'], 15],
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
896 \ ]
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
897
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
898 for test in tests
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
899 let winid = popup_create(test[0], #{line: 2, col: 3})
16837
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
900 redraw
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
901 let position = popup_getpos(winid)
16837
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
902 call assert_equal(test[1], position.width)
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
903 call popup_close(winid)
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
904 endfor
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
905 endfunc
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
906
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
907 func Test_popup_wraps()
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
908 let tests = [
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
909 \ ['nowrap', 6, 1],
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
910 \ ['a line that wraps once', 12, 2],
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
911 \ ['a line that wraps two times', 12, 3],
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
912 \ ]
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
913 for test in tests
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
914 let winid = popup_create(test[0],
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
915 \ #{line: 2, col: 3, maxwidth: 12})
16837
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
916 redraw
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
917 let position = popup_getpos(winid)
16837
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
918 call assert_equal(test[1], position.width)
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
919 call assert_equal(test[2], position.height)
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
920
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
921 call popup_close(winid)
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
922 call assert_equal({}, popup_getpos(winid))
16837
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
923 endfor
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
924 endfunc
16841
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
925
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
926 func Test_popup_getoptions()
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
927 let winid = popup_create('hello', #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
928 \ line: 2,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
929 \ col: 3,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
930 \ minwidth: 10,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
931 \ minheight: 11,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
932 \ maxwidth: 20,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
933 \ maxheight: 21,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
934 \ zindex: 100,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
935 \ time: 5000,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
936 \ fixed: 1
16841
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
937 \})
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
938 redraw
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
939 let res = popup_getoptions(winid)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
940 call assert_equal(2, res.line)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
941 call assert_equal(3, res.col)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
942 call assert_equal(10, res.minwidth)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
943 call assert_equal(11, res.minheight)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
944 call assert_equal(20, res.maxwidth)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
945 call assert_equal(21, res.maxheight)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
946 call assert_equal(100, res.zindex)
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
947 call assert_equal(1, res.fixed)
16841
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
948 if has('timers')
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
949 call assert_equal(5000, res.time)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
950 endif
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
951 call popup_close(winid)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
952
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
953 let winid = popup_create('hello', {})
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
954 redraw
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
955 let res = popup_getoptions(winid)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
956 call assert_equal(0, res.line)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
957 call assert_equal(0, res.col)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
958 call assert_equal(0, res.minwidth)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
959 call assert_equal(0, res.minheight)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
960 call assert_equal(0, res.maxwidth)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
961 call assert_equal(0, res.maxheight)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
962 call assert_equal(50, res.zindex)
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
963 call assert_equal(0, res.fixed)
16841
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
964 if has('timers')
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
965 call assert_equal(0, res.time)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
966 endif
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
967 call popup_close(winid)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
968 call assert_equal({}, popup_getoptions(winid))
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
969 endfunc
16843
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
970
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
971 func Test_popup_option_values()
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
972 new
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
973 " window-local
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
974 setlocal number
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
975 setlocal nowrap
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
976 " buffer-local
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
977 setlocal omnifunc=Something
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
978 " global/buffer-local
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
979 setlocal path=/there
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
980 " global/window-local
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
981 setlocal scrolloff=9
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
982
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
983 let winid = popup_create('hello', {})
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
984 call assert_equal(0, getwinvar(winid, '&number'))
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
985 call assert_equal(1, getwinvar(winid, '&wrap'))
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
986 call assert_equal('', getwinvar(winid, '&omnifunc'))
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
987 call assert_equal(&g:path, getwinvar(winid, '&path'))
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
988 call assert_equal(&g:scrolloff, getwinvar(winid, '&scrolloff'))
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
989
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
990 call popup_close(winid)
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
991 bwipe
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
992 endfunc
16853
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
993
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
994 func Test_popup_atcursor()
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
995 topleft vnew
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
996 call setline(1, [
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
997 \ 'xxxxxxxxxxxxxxxxx',
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
998 \ 'xxxxxxxxxxxxxxxxx',
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
999 \ 'xxxxxxxxxxxxxxxxx',
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1000 \])
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1001
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1002 call cursor(2, 2)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1003 redraw
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1004 let winid = popup_atcursor('vim', {})
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1005 redraw
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1006 let line = join(map(range(1, 17), 'screenstring(1, v:val)'), '')
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1007 call assert_equal('xvimxxxxxxxxxxxxx', line)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1008 call popup_close(winid)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1009
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1010 call cursor(3, 4)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1011 redraw
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1012 let winid = popup_atcursor('vim', {})
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1013 redraw
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1014 let line = join(map(range(1, 17), 'screenstring(2, v:val)'), '')
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1015 call assert_equal('xxxvimxxxxxxxxxxx', line)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1016 call popup_close(winid)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1017
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1018 call cursor(1, 1)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1019 redraw
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1020 let winid = popup_create('vim', #{
17551
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1021 \ line: 'cursor+2',
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1022 \ col: 'cursor+1',
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1023 \})
16853
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1024 redraw
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1025 let line = join(map(range(1, 17), 'screenstring(3, v:val)'), '')
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1026 call assert_equal('xvimxxxxxxxxxxxxx', line)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1027 call popup_close(winid)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1028
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1029 call cursor(3, 3)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1030 redraw
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1031 let winid = popup_create('vim', #{
17551
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1032 \ line: 'cursor-2',
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1033 \ col: 'cursor-1',
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1034 \})
16853
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1035 redraw
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1036 let line = join(map(range(1, 17), 'screenstring(1, v:val)'), '')
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1037 call assert_equal('xvimxxxxxxxxxxxxx', line)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1038 call popup_close(winid)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1039
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1040 " just enough room above
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1041 call cursor(3, 3)
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1042 redraw
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1043 let winid = popup_atcursor(['vim', 'is great'], {})
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1044 redraw
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1045 let pos = popup_getpos(winid)
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1046 call assert_equal(1, pos.line)
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1047 call popup_close(winid)
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1048
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1049 " not enough room above, popup goes below the cursor
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1050 call cursor(3, 3)
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1051 redraw
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1052 let winid = popup_atcursor(['vim', 'is', 'great'], {})
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1053 redraw
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1054 let pos = popup_getpos(winid)
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1055 call assert_equal(4, pos.line)
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1056 call popup_close(winid)
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1057
16902
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
1058 " cursor in first line, popup in line 2
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
1059 call cursor(1, 1)
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
1060 redraw
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
1061 let winid = popup_atcursor(['vim', 'is', 'great'], {})
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
1062 redraw
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
1063 let pos = popup_getpos(winid)
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
1064 call assert_equal(2, pos.line)
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
1065 call popup_close(winid)
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
1066
16853
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1067 bwipe!
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1068 endfunc
16880
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1069
17292
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1070 func Test_popup_beval()
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1071 if !CanRunVimInTerminal()
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1072 throw 'Skipped: cannot make screendumps'
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1073 endif
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1074
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1075 let lines =<< trim END
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1076 call setline(1, range(1, 20))
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1077 call setline(5, 'here is some text to hover over')
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1078 set balloonevalterm
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1079 set balloonexpr=BalloonExpr()
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1080 set balloondelay=100
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1081 func BalloonExpr()
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1082 let s:winid = popup_beval([v:beval_text], {})
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1083 return ''
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1084 endfunc
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1085 func Hover()
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1086 call test_setmouse(5, 15)
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1087 call feedkeys("\<MouseMove>\<Ignore>", "xt")
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1088 sleep 100m
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1089 endfunc
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1090 func MoveOntoPopup()
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1091 call test_setmouse(4, 17)
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1092 call feedkeys("\<F4>\<MouseMove>\<Ignore>", "xt")
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1093 endfunc
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1094 func MoveAway()
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1095 call test_setmouse(5, 13)
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1096 call feedkeys("\<F5>\<MouseMove>\<Ignore>", "xt")
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1097 endfunc
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1098 END
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1099 call writefile(lines, 'XtestPopupBeval')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1100 let buf = RunVimInTerminal('-S XtestPopupBeval', #{rows: 10})
17292
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1101 call term_wait(buf, 100)
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1102 call term_sendkeys(buf, 'j')
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1103 call term_sendkeys(buf, ":call Hover()\<CR>")
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1104 call VerifyScreenDump(buf, 'Test_popupwin_beval_1', {})
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1105
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1106 call term_sendkeys(buf, ":call MoveOntoPopup()\<CR>")
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1107 call VerifyScreenDump(buf, 'Test_popupwin_beval_2', {})
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1108
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1109 call term_sendkeys(buf, ":call MoveAway()\<CR>")
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1110 call VerifyScreenDump(buf, 'Test_popupwin_beval_3', {})
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1111
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1112 " clean up
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1113 call StopVimInTerminal(buf)
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1114 call delete('XtestPopupBeval')
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1115 endfunc
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1116
16880
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1117 func Test_popup_filter()
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1118 new
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1119 call setline(1, 'some text')
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1120
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1121 func MyPopupFilter(winid, c)
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1122 if a:c == 'e'
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1123 let g:eaten = 'e'
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1124 return 1
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1125 endif
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1126 if a:c == '0'
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1127 let g:ignored = '0'
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1128 return 0
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1129 endif
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1130 if a:c == 'x'
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1131 call popup_close(a:winid)
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1132 return 1
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1133 endif
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1134 return 0
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1135 endfunc
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1136
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1137 let winid = popup_create('something', #{filter: 'MyPopupFilter'})
16880
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1138 redraw
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1139
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1140 " e is consumed by the filter
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1141 call feedkeys('e', 'xt')
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1142 call assert_equal('e', g:eaten)
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1143
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1144 " 0 is ignored by the filter
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1145 normal $
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1146 call assert_equal(9, getcurpos()[2])
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1147 call feedkeys('0', 'xt')
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1148 call assert_equal('0', g:ignored)
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1149 call assert_equal(1, getcurpos()[2])
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1150
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1151 " x closes the popup
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1152 call feedkeys('x', 'xt')
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1153 call assert_equal('e', g:eaten)
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1154 call assert_equal(-1, winbufnr(winid))
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1155
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1156 delfunc MyPopupFilter
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
1157 call popup_clear()
16880
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1158 endfunc
16890
5131023c5728 patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16888
diff changeset
1159
17097
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1160 func ShowDialog(key, result)
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1161 let s:cb_res = 999
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1162 let winid = popup_dialog('do you want to quit (Yes/no)?', #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1163 \ filter: 'popup_filter_yesno',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1164 \ callback: 'QuitCallback',
17097
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1165 \ })
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1166 redraw
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1167 call feedkeys(a:key, "xt")
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1168 call assert_equal(winid, s:cb_winid)
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1169 call assert_equal(a:result, s:cb_res)
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1170 endfunc
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1171
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1172 func Test_popup_dialog()
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1173 func QuitCallback(id, res)
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1174 let s:cb_winid = a:id
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1175 let s:cb_res = a:res
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1176 endfunc
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1177
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1178 let winid = ShowDialog("y", 1)
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1179 let winid = ShowDialog("Y", 1)
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1180 let winid = ShowDialog("n", 0)
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1181 let winid = ShowDialog("N", 0)
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1182 let winid = ShowDialog("x", 0)
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1183 let winid = ShowDialog("X", 0)
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1184 let winid = ShowDialog("\<Esc>", 0)
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1185 let winid = ShowDialog("\<C-C>", -1)
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1186
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1187 delfunc QuitCallback
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1188 endfunc
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1189
17117
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1190 func ShowMenu(key, result)
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1191 let s:cb_res = 999
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1192 let winid = popup_menu(['one', 'two', 'something else'], #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1193 \ callback: 'QuitCallback',
17117
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1194 \ })
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1195 redraw
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1196 call feedkeys(a:key, "xt")
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1197 call assert_equal(winid, s:cb_winid)
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1198 call assert_equal(a:result, s:cb_res)
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1199 endfunc
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1200
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1201 func Test_popup_menu()
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1202 func QuitCallback(id, res)
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1203 let s:cb_winid = a:id
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1204 let s:cb_res = a:res
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1205 endfunc
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1206
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1207 let winid = ShowMenu(" ", 1)
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1208 let winid = ShowMenu("j \<CR>", 2)
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1209 let winid = ShowMenu("JjK \<CR>", 2)
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1210 let winid = ShowMenu("jjjjjj ", 3)
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1211 let winid = ShowMenu("kkk ", 1)
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1212 let winid = ShowMenu("x", -1)
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1213 let winid = ShowMenu("X", -1)
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1214 let winid = ShowMenu("\<Esc>", -1)
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1215 let winid = ShowMenu("\<C-C>", -1)
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1216
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1217 delfunc QuitCallback
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1218 endfunc
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1219
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1220 func Test_popup_menu_screenshot()
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1221 if !CanRunVimInTerminal()
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1222 throw 'Skipped: cannot make screendumps'
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1223 endif
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1224
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1225 let lines =<< trim END
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1226 call setline(1, range(1, 20))
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1227 hi PopupSelected ctermbg=lightblue
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1228 call popup_menu(['one', 'two', 'another'], #{callback: 'MenuDone', title: ' make a choice from the list '})
17117
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1229 func MenuDone(id, res)
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1230 echomsg "selected " .. a:res
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1231 endfunc
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1232 END
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1233 call writefile(lines, 'XtestPopupMenu')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1234 let buf = RunVimInTerminal('-S XtestPopupMenu', #{rows: 10})
17117
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1235 call VerifyScreenDump(buf, 'Test_popupwin_menu_01', {})
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1236
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1237 call term_sendkeys(buf, "jj")
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1238 call VerifyScreenDump(buf, 'Test_popupwin_menu_02', {})
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1239
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1240 call term_sendkeys(buf, " ")
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1241 call VerifyScreenDump(buf, 'Test_popupwin_menu_03', {})
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1242
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1243 " clean up
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1244 call StopVimInTerminal(buf)
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1245 call delete('XtestPopupMenu')
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1246 endfunc
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1247
17438
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1248 func Test_popup_menu_narrow()
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1249 if !CanRunVimInTerminal()
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1250 throw 'Skipped: cannot make screendumps'
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1251 endif
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1252
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1253 let lines =<< trim END
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1254 call setline(1, range(1, 20))
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1255 hi PopupSelected ctermbg=green
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1256 call popup_menu(['one', 'two', 'three'], #{callback: 'MenuDone'})
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1257 func MenuDone(id, res)
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1258 echomsg "selected " .. a:res
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1259 endfunc
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1260 END
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1261 call writefile(lines, 'XtestPopupNarrowMenu')
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1262 let buf = RunVimInTerminal('-S XtestPopupNarrowMenu', #{rows: 10})
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1263 call VerifyScreenDump(buf, 'Test_popupwin_menu_04', {})
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1264
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1265 " clean up
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1266 call term_sendkeys(buf, "x")
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1267 call StopVimInTerminal(buf)
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1268 call delete('XtestPopupNarrowMenu')
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1269 endfunc
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1270
17119
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1271 func Test_popup_title()
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1272 if !CanRunVimInTerminal()
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1273 throw 'Skipped: cannot make screendumps'
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1274 endif
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1275
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1276 " Create a popup without title or border, a line of padding will be added to
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1277 " put the title on.
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1278 let lines =<< trim END
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1279 call setline(1, range(1, 20))
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1280 call popup_create(['one', 'two', 'another'], #{title: 'Title String'})
17119
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1281 END
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1282 call writefile(lines, 'XtestPopupTitle')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1283 let buf = RunVimInTerminal('-S XtestPopupTitle', #{rows: 10})
17119
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1284 call VerifyScreenDump(buf, 'Test_popupwin_title', {})
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1285
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1286 " clean up
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1287 call StopVimInTerminal(buf)
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1288 call delete('XtestPopupTitle')
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1289
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1290 let winid = popup_create('something', #{title: 'Some Title'})
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1291 call assert_equal('Some Title', popup_getoptions(winid).title)
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1292 call popup_setoptions(winid, #{title: 'Another Title'})
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1293 call assert_equal('Another Title', popup_getoptions(winid).title)
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1294
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1295 call popup_clear()
17119
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1296 endfunc
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1297
16890
5131023c5728 patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16888
diff changeset
1298 func Test_popup_close_callback()
5131023c5728 patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16888
diff changeset
1299 func PopupDone(id, result)
5131023c5728 patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16888
diff changeset
1300 let g:result = a:result
5131023c5728 patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16888
diff changeset
1301 endfunc
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1302 let winid = popup_create('something', #{callback: 'PopupDone'})
16890
5131023c5728 patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16888
diff changeset
1303 redraw
5131023c5728 patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16888
diff changeset
1304 call popup_close(winid, 'done')
5131023c5728 patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16888
diff changeset
1305 call assert_equal('done', g:result)
5131023c5728 patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16888
diff changeset
1306 endfunc
16892
60c9ac14a2ec patch 8.1.1447: not allowed to create an empty popup
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
1307
60c9ac14a2ec patch 8.1.1447: not allowed to create an empty popup
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
1308 func Test_popup_empty()
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1309 let winid = popup_create('', #{padding: [2,2,2,2]})
16892
60c9ac14a2ec patch 8.1.1447: not allowed to create an empty popup
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
1310 redraw
60c9ac14a2ec patch 8.1.1447: not allowed to create an empty popup
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
1311 let pos = popup_getpos(winid)
17107
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1312 call assert_equal(5, pos.width)
16892
60c9ac14a2ec patch 8.1.1447: not allowed to create an empty popup
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
1313 call assert_equal(5, pos.height)
60c9ac14a2ec patch 8.1.1447: not allowed to create an empty popup
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
1314
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1315 let winid = popup_create([], #{border: []})
16892
60c9ac14a2ec patch 8.1.1447: not allowed to create an empty popup
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
1316 redraw
60c9ac14a2ec patch 8.1.1447: not allowed to create an empty popup
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
1317 let pos = popup_getpos(winid)
17107
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1318 call assert_equal(3, pos.width)
16892
60c9ac14a2ec patch 8.1.1447: not allowed to create an empty popup
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
1319 call assert_equal(3, pos.height)
60c9ac14a2ec patch 8.1.1447: not allowed to create an empty popup
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
1320 endfunc
16894
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1321
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1322 func Test_popup_never_behind()
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1323 if !CanRunVimInTerminal()
16965
ba7727889385 patch 8.1.1483: skipped tests are not properly listed
Bram Moolenaar <Bram@vim.org>
parents: 16908
diff changeset
1324 throw 'Skipped: cannot make screendumps'
16894
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1325 endif
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1326 " +-----------------------------+
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1327 " | | |
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1328 " | | |
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1329 " | | |
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1330 " | line1 |
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1331 " |------------line2------------|
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1332 " | line3 |
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1333 " | line4 |
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1334 " | |
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1335 " | |
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1336 " +-----------------------------+
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1337 let lines =<< trim END
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1338 only
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1339 split
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1340 vsplit
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1341 let info_window1 = getwininfo()[0]
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1342 let line = info_window1['height']
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1343 let col = info_window1['width']
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1344 call popup_create(['line1', 'line2', 'line3', 'line4'], #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1345 \ line : line,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1346 \ col : col,
16894
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1347 \ })
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1348 END
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1349 call writefile(lines, 'XtestPopupBehind')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1350 let buf = RunVimInTerminal('-S XtestPopupBehind', #{rows: 10})
16894
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1351 call term_sendkeys(buf, "\<C-W>w")
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1352 call VerifyScreenDump(buf, 'Test_popupwin_behind', {})
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1353
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1354 " clean up
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1355 call StopVimInTerminal(buf)
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1356 call delete('XtestPopupBehind')
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1357 endfunc
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1358
17551
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1359 func s:VerifyPosition(p, msg, line, col, width, height)
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1360 call assert_equal(a:line, popup_getpos(a:p).line, a:msg . ' (l)')
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1361 call assert_equal(a:col, popup_getpos(a:p).col, a:msg . ' (c)')
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1362 call assert_equal(a:width, popup_getpos(a:p).width, a:msg . ' (w)')
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1363 call assert_equal(a:height, popup_getpos(a:p).height, a:msg . ' (h)')
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1364 endfunc
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1365
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1366 func Test_popup_position_adjust()
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1367 " Anything placed past 2 cells from of the right of the screen is moved to the
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1368 " left.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1369 "
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1370 " When wrapping is disabled, we also shift to the left to display on the
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1371 " screen, unless fixed is set.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1372
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1373 " Entries for cases which don't vary based on wrapping.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1374 " Format is per tests described below
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1375 let both_wrap_tests = [
17551
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1376 \ ['a', 5, &columns, 5, &columns - 2, 1, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1377 \ ['b', 5, &columns + 1, 5, &columns - 2, 1, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1378 \ ['c', 5, &columns - 1, 5, &columns - 2, 1, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1379 \ ['d', 5, &columns - 2, 5, &columns - 2, 1, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1380 \ ['e', 5, &columns - 3, 5, &columns - 3, 1, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1381 \
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1382 \ ['aa', 5, &columns, 5, &columns - 2, 2, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1383 \ ['bb', 5, &columns + 1, 5, &columns - 2, 2, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1384 \ ['cc', 5, &columns - 1, 5, &columns - 2, 2, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1385 \ ['dd', 5, &columns - 2, 5, &columns - 2, 2, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1386 \ ['ee', 5, &columns - 3, 5, &columns - 3, 2, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1387 \
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1388 \ ['aaa', 5, &columns, 5, &columns - 2, 3, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1389 \ ['bbb', 5, &columns + 1, 5, &columns - 2, 3, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1390 \ ['ccc', 5, &columns - 1, 5, &columns - 2, 3, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1391 \ ['ddd', 5, &columns - 2, 5, &columns - 2, 3, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1392 \ ['eee', 5, &columns - 3, 5, &columns - 3, 3, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1393 \ ]
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1394
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1395 " these test groups are dicts with:
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1396 " - comment: something to identify the group of tests by
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1397 " - options: dict of options to merge with the row/col in tests
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1398 " - tests: list of cases. Each one is a list with elements:
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1399 " - text
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1400 " - row
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1401 " - col
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1402 " - expected row
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1403 " - expected col
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1404 " - expected width
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1405 " - expected height
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1406 let tests = [
17551
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1407 \ #{
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1408 \ comment: 'left-aligned with wrapping',
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1409 \ options: #{
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1410 \ wrap: 1,
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1411 \ pos: 'botleft',
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1412 \ },
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1413 \ tests: both_wrap_tests + [
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1414 \ ['aaaa', 5, &columns, 4, &columns - 2, 3, 2],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1415 \ ['bbbb', 5, &columns + 1, 4, &columns - 2, 3, 2],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1416 \ ['cccc', 5, &columns - 1, 4, &columns - 2, 3, 2],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1417 \ ['dddd', 5, &columns - 2, 4, &columns - 2, 3, 2],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1418 \ ['eeee', 5, &columns - 3, 5, &columns - 3, 4, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1419 \ ],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1420 \ },
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1421 \ #{
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1422 \ comment: 'left aligned without wrapping',
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1423 \ options: #{
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1424 \ wrap: 0,
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1425 \ pos: 'botleft',
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1426 \ },
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1427 \ tests: both_wrap_tests + [
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1428 \ ['aaaa', 5, &columns, 5, &columns - 3, 4, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1429 \ ['bbbb', 5, &columns + 1, 5, &columns - 3, 4, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1430 \ ['cccc', 5, &columns - 1, 5, &columns - 3, 4, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1431 \ ['dddd', 5, &columns - 2, 5, &columns - 3, 4, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1432 \ ['eeee', 5, &columns - 3, 5, &columns - 3, 4, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1433 \ ],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1434 \ },
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1435 \ #{
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1436 \ comment: 'left aligned with fixed position',
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1437 \ options: #{
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1438 \ wrap: 0,
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1439 \ fixed: 1,
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1440 \ pos: 'botleft',
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1441 \ },
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1442 \ tests: both_wrap_tests + [
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1443 \ ['aaaa', 5, &columns, 5, &columns - 2, 3, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1444 \ ['bbbb', 5, &columns + 1, 5, &columns - 2, 3, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1445 \ ['cccc', 5, &columns - 1, 5, &columns - 2, 3, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1446 \ ['dddd', 5, &columns - 2, 5, &columns - 2, 3, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1447 \ ['eeee', 5, &columns - 3, 5, &columns - 3, 4, 1],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1448 \ ],
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1449 \ },
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1450 \ ]
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1451
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1452 for test_group in tests
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1453 for test in test_group.tests
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1454 let [ text, line, col, e_line, e_col, e_width, e_height ] = test
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1455 let options = #{
17551
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1456 \ line: line,
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1457 \ col: col,
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1458 \ }
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1459 call extend(options, test_group.options)
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1460
17551
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1461 let p = popup_create(text, options)
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1462
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1463 let msg = string(extend(options, #{text: text}))
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1464 call s:VerifyPosition(p, msg, e_line, e_col, e_width, e_height)
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1465 call popup_close(p)
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1466 endfor
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1467 endfor
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1468
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
1469 call popup_clear()
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1470 %bwipe!
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1471 endfunc
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1472
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1473 func Test_adjust_left_past_screen_width()
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1474 " width of screen
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1475 let X = join(map(range(&columns), {->'X'}), '')
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1476
17551
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1477 let p = popup_create(X, #{line: 1, col: 1, wrap: 0})
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1478 call s:VerifyPosition(p, 'full width topleft', 1, 1, &columns, 1)
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1479
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1480 redraw
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1481 let line = join(map(range(1, &columns + 1), 'screenstring(1, v:val)'), '')
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1482 call assert_equal(X, line)
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1483
17551
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1484 call popup_close(p)
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1485 redraw
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1486
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1487 " Same if placed on the right hand side
17551
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1488 let p = popup_create(X, #{line: 1, col: &columns, wrap: 0})
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1489 call s:VerifyPosition(p, 'full width topright', 1, 1, &columns, 1)
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1490
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1491 redraw
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1492 let line = join(map(range(1, &columns + 1), 'screenstring(1, v:val)'), '')
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1493 call assert_equal(X, line)
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1494
17551
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1495 call popup_close(p)
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1496 redraw
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1497
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1498 " Extend so > window width
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1499 let X .= 'x'
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1500
17551
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1501 let p = popup_create(X, #{line: 1, col: 1, wrap: 0})
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1502 call s:VerifyPosition(p, 'full width + 1 topleft', 1, 1, &columns, 1)
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1503
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1504 redraw
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1505 let line = join(map(range(1, &columns + 1), 'screenstring(1, v:val)'), '')
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1506 call assert_equal(X[ : -2 ], line)
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1507
17551
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1508 call popup_close(p)
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1509 redraw
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1510
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1511 " Shifted then truncated (the x is not visible)
17551
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1512 let p = popup_create(X, #{line: 1, col: &columns - 3, wrap: 0})
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1513 call s:VerifyPosition(p, 'full width + 1 topright', 1, 1, &columns, 1)
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1514
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1515 redraw
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1516 let line = join(map(range(1, &columns + 1), 'screenstring(1, v:val)'), '')
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1517 call assert_equal(X[ : -2 ], line)
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1518
17551
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1519 call popup_close(p)
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1520 redraw
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1521
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1522 " Not shifted, just truncated
17551
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1523 let p = popup_create(X,
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1524 \ #{line: 1, col: 2, wrap: 0, fixed: 1})
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1525 call s:VerifyPosition(p, 'full width + 1 fixed', 1, 2, &columns - 1, 1)
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1526
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1527 redraw
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1528 let line = join(map(range(1, &columns + 1), 'screenstring(1, v:val)'), '')
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1529 let e_line = ' ' . X[ 1 : -2 ]
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1530 call assert_equal(e_line, line)
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1531
17551
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1532 call popup_close(p)
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1533 redraw
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1534
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
1535 call popup_clear()
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1536 %bwipe!
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1537 endfunc
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1538
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1539 func Test_popup_moved()
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1540 new
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1541 call test_override('char_avail', 1)
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1542 call setline(1, ['one word to move around', 'a WORD.and->some thing'])
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1543
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1544 exe "normal gg0/word\<CR>"
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1545 let winid = popup_atcursor('text', #{moved: 'any'})
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1546 redraw
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1547 call assert_equal(1, popup_getpos(winid).visible)
17292
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1548 call assert_equal([1, 4, 4], popup_getoptions(winid).moved)
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1549 " trigger the check for last_cursormoved by going into insert mode
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1550 call feedkeys("li\<Esc>", 'xt')
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1551 call assert_equal({}, popup_getpos(winid))
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
1552 call popup_clear()
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1553
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1554 exe "normal gg0/word\<CR>"
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1555 let winid = popup_atcursor('text', #{moved: 'word'})
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1556 redraw
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1557 call assert_equal(1, popup_getpos(winid).visible)
17292
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1558 call assert_equal([1, 4, 7], popup_getoptions(winid).moved)
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1559 call feedkeys("hi\<Esc>", 'xt')
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1560 call assert_equal({}, popup_getpos(winid))
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
1561 call popup_clear()
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1562
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1563 exe "normal gg0/word\<CR>"
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1564 let winid = popup_atcursor('text', #{moved: 'word'})
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1565 redraw
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1566 call assert_equal(1, popup_getpos(winid).visible)
17292
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1567 call assert_equal([1, 4, 7], popup_getoptions(winid).moved)
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1568 call feedkeys("li\<Esc>", 'xt')
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1569 call assert_equal(1, popup_getpos(winid).visible)
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1570 call feedkeys("ei\<Esc>", 'xt')
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1571 call assert_equal(1, popup_getpos(winid).visible)
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1572 call feedkeys("eli\<Esc>", 'xt')
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1573 call assert_equal({}, popup_getpos(winid))
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
1574 call popup_clear()
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1575
16908
df06694b761b patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents: 16904
diff changeset
1576 " WORD is the default
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1577 exe "normal gg0/WORD\<CR>"
16908
df06694b761b patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents: 16904
diff changeset
1578 let winid = popup_atcursor('text', {})
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1579 redraw
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1580 call assert_equal(1, popup_getpos(winid).visible)
17292
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1581 call assert_equal([2, 2, 15], popup_getoptions(winid).moved)
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1582 call feedkeys("eli\<Esc>", 'xt')
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1583 call assert_equal(1, popup_getpos(winid).visible)
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1584 call feedkeys("wi\<Esc>", 'xt')
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1585 call assert_equal(1, popup_getpos(winid).visible)
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1586 call feedkeys("Eli\<Esc>", 'xt')
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1587 call assert_equal({}, popup_getpos(winid))
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
1588 call popup_clear()
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1589
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1590 exe "normal gg0/word\<CR>"
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1591 let winid = popup_atcursor('text', #{moved: [5, 10]})
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1592 redraw
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1593 call assert_equal(1, popup_getpos(winid).visible)
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1594 call feedkeys("eli\<Esc>", 'xt')
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1595 call feedkeys("ei\<Esc>", 'xt')
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1596 call assert_equal(1, popup_getpos(winid).visible)
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1597 call feedkeys("eli\<Esc>", 'xt')
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1598 call assert_equal({}, popup_getpos(winid))
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
1599 call popup_clear()
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1600
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1601 bwipe!
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1602 call test_override('ALL', 0)
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1603 endfunc
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1604
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1605 func Test_notifications()
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1606 if !has('timers')
17089
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
1607 throw 'Skipped: timer feature not supported'
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1608 endif
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1609 if !CanRunVimInTerminal()
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1610 throw 'Skipped: cannot make screendumps'
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1611 endif
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1612
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1613 call writefile([
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1614 \ "call setline(1, range(1, 20))",
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1615 \ "hi Notification ctermbg=lightblue",
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1616 \ "call popup_notification('first notification', {})",
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1617 \], 'XtestNotifications')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1618 let buf = RunVimInTerminal('-S XtestNotifications', #{rows: 10})
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1619 call VerifyScreenDump(buf, 'Test_popupwin_notify_01', {})
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1620
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1621 " second one goes below the first one
17077
2546930657a9 patch 8.1.1538: cannot specify highlighting for notifications
Bram Moolenaar <Bram@vim.org>
parents: 17075
diff changeset
1622 call term_sendkeys(buf, ":hi link PopupNotification Notification\<CR>")
2546930657a9 patch 8.1.1538: cannot specify highlighting for notifications
Bram Moolenaar <Bram@vim.org>
parents: 17075
diff changeset
1623 call term_sendkeys(buf, ":call popup_notification('another important notification', {})\<CR>")
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1624 call VerifyScreenDump(buf, 'Test_popupwin_notify_02', {})
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1625
17180
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1626 " clean up
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1627 call StopVimInTerminal(buf)
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1628 call delete('XtestNotifications')
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1629 endfunc
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1630
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1631 func Test_popup_scrollbar()
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1632 if !CanRunVimInTerminal()
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1633 throw 'Skipped: cannot make screendumps'
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1634 endif
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1635
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1636 let lines =<< trim END
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1637 call setline(1, range(1, 20))
17204
1a6ccc91ed46 patch 8.1.1601: missing changes to popup window test file
Bram Moolenaar <Bram@vim.org>
parents: 17198
diff changeset
1638 hi ScrollThumb ctermbg=blue
1a6ccc91ed46 patch 8.1.1601: missing changes to popup window test file
Bram Moolenaar <Bram@vim.org>
parents: 17198
diff changeset
1639 hi ScrollBar ctermbg=red
17180
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1640 let winid = popup_create(['one', 'two', 'three', 'four', 'five',
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1641 \ 'six', 'seven', 'eight', 'nine'], #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1642 \ minwidth: 8,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1643 \ maxheight: 4,
17180
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1644 \ })
17198
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1645 func ScrollUp()
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1646 call feedkeys("\<F3>\<ScrollWheelUp>", "xt")
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1647 endfunc
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1648 func ScrollDown()
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1649 call feedkeys("\<F3>\<ScrollWheelDown>", "xt")
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1650 endfunc
17216
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17210
diff changeset
1651 func ClickTop()
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17210
diff changeset
1652 call feedkeys("\<F4>\<LeftMouse>", "xt")
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17210
diff changeset
1653 endfunc
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17210
diff changeset
1654 func ClickBot()
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1655 call popup_setoptions(g:winid, #{border: [], close: 'button'})
17216
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17210
diff changeset
1656 call feedkeys("\<F5>\<LeftMouse>", "xt")
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17210
diff changeset
1657 endfunc
17198
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1658 map <silent> <F3> :call test_setmouse(5, 36)<CR>
17216
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17210
diff changeset
1659 map <silent> <F4> :call test_setmouse(4, 42)<CR>
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17210
diff changeset
1660 map <silent> <F5> :call test_setmouse(7, 42)<CR>
17180
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1661 END
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1662 call writefile(lines, 'XtestPopupScroll')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1663 let buf = RunVimInTerminal('-S XtestPopupScroll', #{rows: 10})
17180
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1664 call VerifyScreenDump(buf, 'Test_popupwin_scroll_1', {})
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1665
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1666 call term_sendkeys(buf, ":call popup_setoptions(winid, #{firstline: 2})\<CR>")
17387
2558f90045e5 patch 8.1.1692: using *{} for literal dict is not backwards compatible
Bram Moolenaar <Bram@vim.org>
parents: 17368
diff changeset
1667 call term_sendkeys(buf, ":\<CR>")
17180
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1668 call VerifyScreenDump(buf, 'Test_popupwin_scroll_2', {})
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1669
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1670 call term_sendkeys(buf, ":call popup_setoptions(winid, #{firstline: 6})\<CR>")
17387
2558f90045e5 patch 8.1.1692: using *{} for literal dict is not backwards compatible
Bram Moolenaar <Bram@vim.org>
parents: 17368
diff changeset
1671 call term_sendkeys(buf, ":\<CR>")
17180
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1672 call VerifyScreenDump(buf, 'Test_popupwin_scroll_3', {})
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1673
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1674 call term_sendkeys(buf, ":call popup_setoptions(winid, #{firstline: 9})\<CR>")
17387
2558f90045e5 patch 8.1.1692: using *{} for literal dict is not backwards compatible
Bram Moolenaar <Bram@vim.org>
parents: 17368
diff changeset
1675 call term_sendkeys(buf, ":\<CR>")
17180
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1676 call VerifyScreenDump(buf, 'Test_popupwin_scroll_4', {})
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1677
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1678 call term_sendkeys(buf, ":call popup_setoptions(winid, #{scrollbarhighlight: 'ScrollBar', thumbhighlight: 'ScrollThumb'})\<CR>")
17198
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1679 call term_sendkeys(buf, ":call ScrollUp()\<CR>")
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1680 call VerifyScreenDump(buf, 'Test_popupwin_scroll_5', {})
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1681
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1682 call term_sendkeys(buf, ":call ScrollDown()\<CR>")
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1683 call VerifyScreenDump(buf, 'Test_popupwin_scroll_6', {})
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1684
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1685 call term_sendkeys(buf, ":call ScrollDown()\<CR>")
17210
175941dcc96b patch 8.1.1604: popup window scroll test is flaky
Bram Moolenaar <Bram@vim.org>
parents: 17204
diff changeset
1686 " wait a bit, otherwise it fails sometimes (double click recognized?)
175941dcc96b patch 8.1.1604: popup window scroll test is flaky
Bram Moolenaar <Bram@vim.org>
parents: 17204
diff changeset
1687 sleep 100m
17198
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1688 call term_sendkeys(buf, ":call ScrollDown()\<CR>")
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1689 call VerifyScreenDump(buf, 'Test_popupwin_scroll_7', {})
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1690
17216
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17210
diff changeset
1691 call term_sendkeys(buf, ":call ClickTop()\<CR>")
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17210
diff changeset
1692 sleep 100m
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17210
diff changeset
1693 call term_sendkeys(buf, ":call ClickTop()\<CR>")
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17210
diff changeset
1694 call VerifyScreenDump(buf, 'Test_popupwin_scroll_8', {})
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17210
diff changeset
1695
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17210
diff changeset
1696 call term_sendkeys(buf, ":call ClickBot()\<CR>")
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17210
diff changeset
1697 call VerifyScreenDump(buf, 'Test_popupwin_scroll_9', {})
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17210
diff changeset
1698
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1699 " clean up
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1700 call StopVimInTerminal(buf)
17180
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1701 call delete('XtestPopupScroll')
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1702 endfunc
17107
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1703
17274
6a7ba68d448e patch 8.1.1636: crash when popup has fitting scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 17253
diff changeset
1704 func Test_popup_fitting_scrollbar()
6a7ba68d448e patch 8.1.1636: crash when popup has fitting scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 17253
diff changeset
1705 " this was causing a crash, divide by zero
6a7ba68d448e patch 8.1.1636: crash when popup has fitting scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 17253
diff changeset
1706 let winid = popup_create([
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1707 \ 'one', 'two', 'longer line that wraps', 'four', 'five'], #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1708 \ scrollbar: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1709 \ maxwidth: 10,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1710 \ maxheight: 5,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1711 \ firstline: 2})
17274
6a7ba68d448e patch 8.1.1636: crash when popup has fitting scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 17253
diff changeset
1712 redraw
6a7ba68d448e patch 8.1.1636: crash when popup has fitting scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 17253
diff changeset
1713 call popup_clear()
6a7ba68d448e patch 8.1.1636: crash when popup has fitting scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 17253
diff changeset
1714 endfunc
6a7ba68d448e patch 8.1.1636: crash when popup has fitting scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 17253
diff changeset
1715
17121
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1716 func Test_popup_settext()
17107
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1717 if !CanRunVimInTerminal()
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1718 throw 'Skipped: cannot make screendumps'
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1719 endif
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1720
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1721 let lines =<< trim END
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1722 let opts = #{wrap: 0}
17107
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1723 let p = popup_create('test', opts)
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1724 call popup_settext(p, 'this is a text')
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1725 END
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1726
17551
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
1727 call writefile(lines, 'XtestPopupSetText')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1728 let buf = RunVimInTerminal('-S XtestPopupSetText', #{rows: 10})
17107
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1729 call VerifyScreenDump(buf, 'Test_popup_settext_01', {})
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1730
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1731 " Setting to empty string clears it
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1732 call term_sendkeys(buf, ":call popup_settext(p, '')\<CR>")
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1733 call VerifyScreenDump(buf, 'Test_popup_settext_02', {})
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1734
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1735 " Setting a list
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1736 call term_sendkeys(buf, ":call popup_settext(p, ['a','b','c'])\<CR>")
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1737 call VerifyScreenDump(buf, 'Test_popup_settext_03', {})
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1738
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1739 " Shrinking with a list
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1740 call term_sendkeys(buf, ":call popup_settext(p, ['a'])\<CR>")
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1741 call VerifyScreenDump(buf, 'Test_popup_settext_04', {})
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1742
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1743 " Growing with a list
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1744 call term_sendkeys(buf, ":call popup_settext(p, ['a','b','c'])\<CR>")
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1745 call VerifyScreenDump(buf, 'Test_popup_settext_03', {})
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1746
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1747 " Empty list clears
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1748 call term_sendkeys(buf, ":call popup_settext(p, [])\<CR>")
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1749 call VerifyScreenDump(buf, 'Test_popup_settext_05', {})
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1750
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1751 " Dicts
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1752 call term_sendkeys(buf, ":call popup_settext(p, [#{text: 'aaaa'}, #{text: 'bbbb'}, #{text: 'cccc'}])\<CR>")
17107
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1753 call VerifyScreenDump(buf, 'Test_popup_settext_06', {})
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1754
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1755 " clean up
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1756 call StopVimInTerminal(buf)
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1757 call delete('XtestPopupSetText')
17121
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1758 endfunc
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1759
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1760 func Test_popup_hidden()
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1761 new
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1762
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1763 let winid = popup_atcursor('text', #{hidden: 1})
17121
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1764 redraw
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1765 call assert_equal(0, popup_getpos(winid).visible)
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1766 call popup_close(winid)
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1767
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1768 let winid = popup_create('text', #{hidden: 1})
17121
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1769 redraw
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1770 call assert_equal(0, popup_getpos(winid).visible)
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1771 call popup_close(winid)
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1772
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1773 func QuitCallback(id, res)
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1774 let s:cb_winid = a:id
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1775 let s:cb_res = a:res
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1776 endfunc
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1777 let winid = popup_dialog('make a choice', #{hidden: 1,
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1778 \ filter: 'popup_filter_yesno',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1779 \ callback: 'QuitCallback',
17121
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1780 \ })
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1781 redraw
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1782 call assert_equal(0, popup_getpos(winid).visible)
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1783 call assert_equal(function('popup_filter_yesno'), popup_getoptions(winid).filter)
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1784 call assert_equal(function('QuitCallback'), popup_getoptions(winid).callback)
17121
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1785 exe "normal anot used by filter\<Esc>"
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1786 call assert_equal('not used by filter', getline(1))
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1787
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1788 call popup_show(winid)
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1789 call feedkeys('y', "xt")
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1790 call assert_equal(1, s:cb_res)
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1791
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1792 bwipe!
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1793 delfunc QuitCallback
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1794 endfunc
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1795
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1796 " Test options not checked elsewhere
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1797 func Test_set_get_options()
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1798 let winid = popup_create('some text', #{highlight: 'Beautiful'})
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1799 let options = popup_getoptions(winid)
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1800 call assert_equal(1, options.wrap)
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1801 call assert_equal(0, options.drag)
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1802 call assert_equal('Beautiful', options.highlight)
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1803
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1804 call popup_setoptions(winid, #{wrap: 0, drag: 1, highlight: 'Another'})
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1805 let options = popup_getoptions(winid)
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1806 call assert_equal(0, options.wrap)
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1807 call assert_equal(1, options.drag)
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1808 call assert_equal('Another', options.highlight)
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1809
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1810 call popup_close(winid)
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1811 endfunc
17151
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1812
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1813 func Test_popupwin_garbage_collect()
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1814 func MyPopupFilter(x, winid, c)
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1815 " NOP
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1816 endfunc
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1817
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1818 let winid = popup_create('something', #{filter: function('MyPopupFilter', [{}])})
17151
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1819 call test_garbagecollect_now()
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1820 redraw
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1821 " Must not crach caused by invalid memory access
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1822 call feedkeys('j', 'xt')
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1823 call assert_true(v:true)
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1824
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1825 call popup_close(winid)
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1826 delfunc MyPopupFilter
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1827 endfunc
17225
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
1828
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
1829 func Test_popupwin_with_buffer()
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
1830 call writefile(['some text', 'in a buffer'], 'XsomeFile')
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
1831 let buf = bufadd('XsomeFile')
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
1832 call assert_equal(0, bufloaded(buf))
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
1833 let winid = popup_create(buf, {})
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
1834 call assert_notequal(0, winid)
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
1835 let pos = popup_getpos(winid)
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
1836 call assert_equal(2, pos.height)
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
1837 call assert_equal(1, bufloaded(buf))
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
1838 call popup_close(winid)
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
1839 call assert_equal({}, popup_getpos(winid))
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
1840 call assert_equal(1, bufloaded(buf))
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
1841 exe 'bwipe! ' .. buf
17231
e9ebf3f27af6 patch 8.1.1615: crash when passing buffer number to popup_create()
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
1842
e9ebf3f27af6 patch 8.1.1615: crash when passing buffer number to popup_create()
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
1843 edit test_popupwin.vim
e9ebf3f27af6 patch 8.1.1615: crash when passing buffer number to popup_create()
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
1844 let winid = popup_create(bufnr(''), {})
e9ebf3f27af6 patch 8.1.1615: crash when passing buffer number to popup_create()
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
1845 redraw
e9ebf3f27af6 patch 8.1.1615: crash when passing buffer number to popup_create()
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
1846 call popup_close(winid)
17278
b6de6181e5ab patch 8.1.1638: running tests leaves some files behind
Bram Moolenaar <Bram@vim.org>
parents: 17274
diff changeset
1847 call delete('XsomeFile')
17225
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
1848 endfunc
17245
13a2d3364b3f patch 8.1.1622: wrong width if displaying a lot of lines in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17241
diff changeset
1849
13a2d3364b3f patch 8.1.1622: wrong width if displaying a lot of lines in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17241
diff changeset
1850 func Test_popupwin_width()
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1851 let winid = popup_create(repeat(['short', 'long long long line', 'medium width'], 50), #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1852 \ maxwidth: 40,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1853 \ maxheight: 10,
17245
13a2d3364b3f patch 8.1.1622: wrong width if displaying a lot of lines in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17241
diff changeset
1854 \ })
13a2d3364b3f patch 8.1.1622: wrong width if displaying a lot of lines in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17241
diff changeset
1855 for top in range(1, 20)
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1856 call popup_setoptions(winid, #{firstline: top})
17245
13a2d3364b3f patch 8.1.1622: wrong width if displaying a lot of lines in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17241
diff changeset
1857 redraw
13a2d3364b3f patch 8.1.1622: wrong width if displaying a lot of lines in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17241
diff changeset
1858 call assert_equal(19, popup_getpos(winid).width)
13a2d3364b3f patch 8.1.1622: wrong width if displaying a lot of lines in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17241
diff changeset
1859 endfor
13a2d3364b3f patch 8.1.1622: wrong width if displaying a lot of lines in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17241
diff changeset
1860 call popup_clear()
13a2d3364b3f patch 8.1.1622: wrong width if displaying a lot of lines in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17241
diff changeset
1861 endfunc
17253
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1862
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1863 func Test_popupwin_buf_close()
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1864 let buf = bufadd('Xtestbuf')
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1865 call bufload(buf)
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1866 call setbufline(buf, 1, ['just', 'some', 'lines'])
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1867 let winid = popup_create(buf, {})
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1868 redraw
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1869 call assert_equal(3, popup_getpos(winid).height)
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1870 let bufinfo = getbufinfo(buf)[0]
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1871 call assert_equal(1, bufinfo.changed)
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1872 call assert_equal(0, bufinfo.hidden)
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1873 call assert_equal(0, bufinfo.listed)
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1874 call assert_equal(1, bufinfo.loaded)
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1875 call assert_equal([], bufinfo.windows)
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1876 call assert_equal([winid], bufinfo.popups)
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1877
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1878 call popup_close(winid)
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1879 call assert_equal({}, popup_getpos(winid))
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1880 let bufinfo = getbufinfo(buf)[0]
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1881 call assert_equal(1, bufinfo.changed)
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1882 call assert_equal(1, bufinfo.hidden)
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1883 call assert_equal(0, bufinfo.listed)
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1884 call assert_equal(1, bufinfo.loaded)
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1885 call assert_equal([], bufinfo.windows)
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1886 call assert_equal([], bufinfo.popups)
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1887 exe 'bwipe! ' .. buf
26e0352613ec patch 8.1.1626: no test for closing a popup window with a modified buffer
Bram Moolenaar <Bram@vim.org>
parents: 17245
diff changeset
1888 endfunc
17354
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1889
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1890 func Test_popup_menu_with_maxwidth()
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1891 if !CanRunVimInTerminal()
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1892 throw 'Skipped: cannot make screendumps'
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1893 endif
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1894
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1895 let lines =<< trim END
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1896 call setline(1, range(1, 10))
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1897 hi ScrollThumb ctermbg=blue
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1898 hi ScrollBar ctermbg=red
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1899 func PopupMenu(lines, line, col, scrollbar = 0)
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1900 return popup_menu(a:lines, #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1901 \ maxwidth: 10,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1902 \ maxheight: 3,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1903 \ pos : 'topleft',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1904 \ col : a:col,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1905 \ line : a:line,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1906 \ scrollbar : a:scrollbar,
17354
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1907 \ })
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1908 endfunc
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1909 call PopupMenu(['x'], 1, 1)
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1910 call PopupMenu(['123456789|'], 1, 16)
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1911 call PopupMenu(['123456789|' .. ' '], 7, 1)
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1912 call PopupMenu([repeat('123456789|', 100)], 7, 16)
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1913 call PopupMenu(repeat(['123456789|' .. ' '], 5), 1, 33, 1)
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1914 END
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1915 call writefile(lines, 'XtestPopupMenuMaxWidth')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1916 let buf = RunVimInTerminal('-S XtestPopupMenuMaxWidth', #{rows: 13})
17354
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1917 call VerifyScreenDump(buf, 'Test_popupwin_menu_maxwidth_1', {})
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1918
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1919 " close the menu popupwin.
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1920 call term_sendkeys(buf, " ")
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1921 call term_sendkeys(buf, " ")
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1922 call term_sendkeys(buf, " ")
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1923 call term_sendkeys(buf, " ")
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1924 call term_sendkeys(buf, " ")
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1925
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1926 " clean up
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1927 call StopVimInTerminal(buf)
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1928 call delete('XtestPopupMenuMaxWidth')
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1929 endfunc
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1930
17358
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1931 func Test_popup_menu_with_scrollbar()
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1932 if !CanRunVimInTerminal()
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1933 throw 'Skipped: cannot make screendumps'
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1934 endif
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1935
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1936 let lines =<< trim END
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1937 call setline(1, range(1, 20))
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1938 hi ScrollThumb ctermbg=blue
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1939 hi ScrollBar ctermbg=red
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1940 call popup_menu(['one', 'two', 'three', 'four', 'five',
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1941 \ 'six', 'seven', 'eight', 'nine'], #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1942 \ minwidth: 8,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1943 \ maxheight: 3,
17358
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1944 \ })
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1945 END
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1946 call writefile(lines, 'XtestPopupMenuScroll')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1947 let buf = RunVimInTerminal('-S XtestPopupMenuScroll', #{rows: 10})
17358
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1948
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1949 call term_sendkeys(buf, "j")
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1950 call VerifyScreenDump(buf, 'Test_popupwin_menu_scroll_1', {})
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1951
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1952 call term_sendkeys(buf, "jjj")
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1953 call VerifyScreenDump(buf, 'Test_popupwin_menu_scroll_2', {})
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1954
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1955 " if the cursor is the bottom line, it stays at the bottom line.
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1956 call term_sendkeys(buf, repeat("j", 20))
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1957 call VerifyScreenDump(buf, 'Test_popupwin_menu_scroll_3', {})
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1958
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1959 call term_sendkeys(buf, "kk")
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1960 call VerifyScreenDump(buf, 'Test_popupwin_menu_scroll_4', {})
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1961
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1962 call term_sendkeys(buf, "k")
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1963 call VerifyScreenDump(buf, 'Test_popupwin_menu_scroll_5', {})
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1964
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1965 " if the cursor is in the top line, it stays in the top line.
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1966 call term_sendkeys(buf, repeat("k", 20))
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1967 call VerifyScreenDump(buf, 'Test_popupwin_menu_scroll_6', {})
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1968
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1969 " close the menu popupwin.
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1970 call term_sendkeys(buf, " ")
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1971
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1972 " clean up
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1973 call StopVimInTerminal(buf)
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1974 call delete('XtestPopupMenuScroll')
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1975 endfunc
d1ea88736ebd patch 8.1.1678: using popup_menu() does not scroll to show the selected line
Bram Moolenaar <Bram@vim.org>
parents: 17354
diff changeset
1976
17429
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1977 func Test_popup_menu_filter()
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1978 if !CanRunVimInTerminal()
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1979 throw 'Skipped: cannot make screendumps'
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1980 endif
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1981
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1982 let lines =<< trim END
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1983 function! MyFilter(winid, key) abort
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1984 if a:key == "0"
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1985 call win_execute(a:winid, "call setpos('.', [0, 1, 1, 0])")
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1986 return 1
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1987 endif
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1988 if a:key == "G"
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1989 call win_execute(a:winid, "call setpos('.', [0, line('$'), 1, 0])")
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1990 return 1
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1991 endif
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1992 if a:key == "j"
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1993 call win_execute(a:winid, "call setpos('.', [0, line('.') + 1, 1, 0])")
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1994 return 1
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1995 endif
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1996 if a:key == "k"
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1997 call win_execute(a:winid, "call setpos('.', [0, line('.') - 1, 1, 0])")
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1998 return 1
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1999 endif
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2000 if a:key == 'x'
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2001 call popup_close(a:winid)
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2002 return 1
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2003 endif
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2004 return 0
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2005 endfunction
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2006 call popup_menu(['111', '222', '333', '444', '555', '666', '777', '888', '999'], #{
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2007 \ maxheight : 3,
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2008 \ filter : 'MyFilter'
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2009 \ })
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2010 END
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2011 call writefile(lines, 'XtestPopupMenuFilter')
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2012 let buf = RunVimInTerminal('-S XtestPopupMenuFilter', #{rows: 10})
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2013
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2014 call term_sendkeys(buf, "j")
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2015 call VerifyScreenDump(buf, 'Test_popupwin_menu_filter_1', {})
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2016
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2017 call term_sendkeys(buf, "k")
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2018 call VerifyScreenDump(buf, 'Test_popupwin_menu_filter_2', {})
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2019
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2020 call term_sendkeys(buf, "G")
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2021 call VerifyScreenDump(buf, 'Test_popupwin_menu_filter_3', {})
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2022
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2023 call term_sendkeys(buf, "0")
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2024 call VerifyScreenDump(buf, 'Test_popupwin_menu_filter_4', {})
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2025
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2026 call term_sendkeys(buf, "x")
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2027
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2028 " clean up
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2029 call StopVimInTerminal(buf)
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2030 call delete('XtestPopupMenuFilter')
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2031 endfunc
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2032
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2033 func Test_popup_cursorline()
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2034 if !CanRunVimInTerminal()
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2035 throw 'Skipped: cannot make screendumps'
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2036 endif
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2037
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2038 let winid = popup_create('some text', {})
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2039 call assert_equal(0, popup_getoptions(winid).cursorline)
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2040 call popup_close(winid)
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2041
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2042 let winid = popup_create('some text', #{ cursorline: 1, })
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2043 call assert_equal(1, popup_getoptions(winid).cursorline)
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2044 call popup_close(winid)
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2045
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2046 let winid = popup_create('some text', #{ cursorline: 0, })
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2047 call assert_equal(0, popup_getoptions(winid).cursorline)
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2048 call popup_close(winid)
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2049
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2050 let winid = popup_menu('some text', {})
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2051 call assert_equal(1, popup_getoptions(winid).cursorline)
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2052 call popup_close(winid)
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2053
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2054 let winid = popup_menu('some text', #{ cursorline: 1, })
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2055 call assert_equal(1, popup_getoptions(winid).cursorline)
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2056 call popup_close(winid)
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2057
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2058 let winid = popup_menu('some text', #{ cursorline: 0, })
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2059 call assert_equal(0, popup_getoptions(winid).cursorline)
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2060 call popup_close(winid)
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2061
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2062 " ---------
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2063 " Pattern 1
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2064 " ---------
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2065 let lines =<< trim END
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2066 call popup_create(['111', '222', '333'], #{ cursorline : 0 })
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2067 END
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2068 call writefile(lines, 'XtestPopupCursorLine')
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2069 let buf = RunVimInTerminal('-S XtestPopupCursorLine', #{rows: 10})
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2070 call VerifyScreenDump(buf, 'Test_popupwin_cursorline_1', {})
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2071 call term_sendkeys(buf, ":call popup_clear()\<cr>")
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2072 call StopVimInTerminal(buf)
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2073
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2074 " ---------
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2075 " Pattern 2
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2076 " ---------
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2077 let lines =<< trim END
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2078 call popup_create(['111', '222', '333'], #{ cursorline : 1 })
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2079 END
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2080 call writefile(lines, 'XtestPopupCursorLine')
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2081 let buf = RunVimInTerminal('-S XtestPopupCursorLine', #{rows: 10})
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2082 call VerifyScreenDump(buf, 'Test_popupwin_cursorline_2', {})
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2083 call term_sendkeys(buf, ":call popup_clear()\<cr>")
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2084 call StopVimInTerminal(buf)
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2085
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2086 " ---------
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2087 " Pattern 3
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2088 " ---------
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2089 let lines =<< trim END
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2090 function! MyFilter(winid, key) abort
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2091 if a:key == "j"
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2092 call win_execute(a:winid, "call setpos('.', [0, line('.') + 1, 1, 0]) | redraw")
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2093 return 1
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2094 endif
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2095 if a:key == 'x'
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2096 call popup_close(a:winid)
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2097 return 1
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2098 endif
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2099 return 0
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2100 endfunction
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2101 call popup_menu(['111', '222', '333'], #{
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2102 \ cursorline : 0,
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2103 \ maxheight : 2,
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2104 \ filter : 'MyFilter',
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2105 \ })
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2106 END
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2107 call writefile(lines, 'XtestPopupCursorLine')
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2108 let buf = RunVimInTerminal('-S XtestPopupCursorLine', #{rows: 10})
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2109 call VerifyScreenDump(buf, 'Test_popupwin_cursorline_3', {})
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2110 call term_sendkeys(buf, "j")
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2111 call term_sendkeys(buf, "j")
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2112 call VerifyScreenDump(buf, 'Test_popupwin_cursorline_4', {})
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2113 call term_sendkeys(buf, "x")
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2114 call StopVimInTerminal(buf)
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2115
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2116 " ---------
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2117 " Pattern 4
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2118 " ---------
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2119 let lines =<< trim END
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2120 function! MyFilter(winid, key) abort
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2121 if a:key == "j"
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2122 call win_execute(a:winid, "call setpos('.', [0, line('.') + 1, 1, 0]) | redraw")
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2123 return 1
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2124 endif
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2125 if a:key == 'x'
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2126 call popup_close(a:winid)
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2127 return 1
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2128 endif
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2129 return 0
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2130 endfunction
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2131 call popup_menu(['111', '222', '333'], #{
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2132 \ cursorline : 1,
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2133 \ maxheight : 2,
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2134 \ filter : 'MyFilter',
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2135 \ })
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2136 END
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2137 call writefile(lines, 'XtestPopupCursorLine')
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2138 let buf = RunVimInTerminal('-S XtestPopupCursorLine', #{rows: 10})
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2139 call VerifyScreenDump(buf, 'Test_popupwin_cursorline_5', {})
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2140 call term_sendkeys(buf, "j")
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2141 call term_sendkeys(buf, "j")
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2142 call VerifyScreenDump(buf, 'Test_popupwin_cursorline_6', {})
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2143 call term_sendkeys(buf, "x")
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2144 call StopVimInTerminal(buf)
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2145
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2146 call delete('XtestPopupCursorLine')
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2147 endfunc
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2148
17438
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2149 func Test_previewpopup()
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2150 if !CanRunVimInTerminal()
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2151 throw 'Skipped: cannot make screendumps'
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2152 endif
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2153 call writefile([
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2154 \ "!_TAG_FILE_ENCODING\tutf-8\t//",
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2155 \ "another\tXtagfile\t/^this is another",
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2156 \ "theword\tXtagfile\t/^theword"],
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2157 \ 'Xtags')
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2158 call writefile(range(1,20)
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2159 \ + ['theword is here']
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2160 \ + range(22, 27)
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2161 \ + ['this is another place']
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2162 \ + range(29, 40),
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2163 \ "Xtagfile")
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2164 let lines =<< trim END
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2165 set tags=Xtags
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2166 call setline(1, [
17551
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
2167 \ 'one',
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
2168 \ 'two',
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
2169 \ 'three',
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
2170 \ 'four',
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
2171 \ 'five',
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
2172 \ 'six',
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
2173 \ 'seven',
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
2174 \ 'find theword somewhere',
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
2175 \ 'nine',
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
2176 \ 'this is another word',
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
2177 \ 'very long line where the word is also another'])
17438
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2178 set previewpopup=height:4,width:40
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2179 END
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2180 call writefile(lines, 'XtestPreviewPopup')
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2181 let buf = RunVimInTerminal('-S XtestPreviewPopup', #{rows: 14})
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2182
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2183 call term_sendkeys(buf, "/theword\<CR>\<C-W>}")
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2184 call term_sendkeys(buf, ":\<CR>")
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2185 call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_1', {})
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2186
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2187 call term_sendkeys(buf, "/another\<CR>\<C-W>}")
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2188 call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_2', {})
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2189
17551
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
2190 call term_sendkeys(buf, ":call popup_move(popup_getpreview(), #{col: 15})\<CR>")
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
2191 call term_sendkeys(buf, ":\<CR>")
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
2192 call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_3', {})
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
2193
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
2194 call term_sendkeys(buf, "/another\<CR>\<C-W>}")
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
2195 call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_4', {})
8cca2654d459 patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents: 17442
diff changeset
2196
17438
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2197 call StopVimInTerminal(buf)
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2198 call delete('Xtags')
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2199 call delete('Xtagfile')
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2200 call delete('XtestPreviewPopup')
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2201 endfunc
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2202
17442
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
2203 " vim: shiftwidth=2 sts=2