annotate src/testdir/test_popupwin.vim @ 17442:57b9fca8c7d2 v8.1.1719

patch 8.1.1719: popup too wide when 'showbreak' is set commit https://github.com/vim/vim/commit/331bafd481fddfe542099d8cccd38d240c10c011 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 20 17:46:05 2019 +0200 patch 8.1.1719: popup too wide when 'showbreak' is set Problem: Popup too wide when 'showbreak' is set. Solution: Set window width when computing line length. (closes https://github.com/vim/vim/issues/4701)
author Bram Moolenaar <Bram@vim.org>
date Sat, 20 Jul 2019 18:00:07 +0200
parents 967e2ee9b656
children 8cca2654d459
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,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
357 \ border: [],
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
358 \ 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
359 \ })
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 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
361 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
362 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
363 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
364 map <silent> <F4> :call test_setmouse(&lines - 8, &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 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
366 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
367 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
368 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
369
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
370 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
371 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
372
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
373 " 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
374 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
375 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
376 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
377
17219
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
378 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
379 if !CanRunVimInTerminal()
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
380 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
381 endif
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
382 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
383 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
384 " 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
385 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
386 \ close: 'button',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
387 \ border: [],
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
388 \ line: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
389 \ 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
390 \ })
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
391 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
392 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
393 endfunc
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('notification', #{
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: 'click',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
396 \ line: 3,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
397 \ col: 15,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
398 \ 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
399 \ })
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
400 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
401 \ close: 'button',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
402 \ line: 5,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
403 \ 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
404 \ })
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
405 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
406 \ close: 'button',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
407 \ padding: [],
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
408 \ line: 5,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
409 \ 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
410 \ })
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
411 func CloseWithX()
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
412 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
413 endfunc
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
414 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
415 func CloseWithClick()
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
416 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
417 endfunc
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
418 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
419 END
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
420 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
421 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
422 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
423
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
424 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
425 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
426
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
427 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
428 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
429
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
430 " clean up
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
431 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
432 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
433 endfunction
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
434
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
435 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
436 if !CanRunVimInTerminal()
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
437 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
438 endif
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
439 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
440 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
441 hi PopupColor ctermbg=lightgrey
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
442 let winid = popup_create([
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
443 \ 'some text',
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
444 \ '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
445 \], #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
446 \ line: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
447 \ col: 10,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
448 \ wrap: 0,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
449 \ fixed: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
450 \ zindex: 90,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
451 \ padding: [],
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
452 \ highlight: 'PopupColor',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
453 \ 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
454 call popup_create([
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
455 \ 'xxxxxxxxx',
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
456 \ 'yyyyyyyyy',
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
457 \], #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
458 \ line: 3,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
459 \ col: 18,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
460 \ 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
461 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
462 \ '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
463 \], #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
464 \ line: 7,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
465 \ col: 10,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
466 \ wrap: 0,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
467 \ fixed: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
468 \ close: 'button',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
469 \ zindex: 90,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
470 \ padding: [],
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
471 \ border: [],
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
472 \ 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
473 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
474 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
475 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
476 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
477
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
478 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
479 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
480 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
481 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
482
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
483 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
484 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
485 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
486 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
487
17413
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(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
489 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
490 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
491 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
492
17413
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(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
494 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
495 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
496 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
497
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
498 " clean up
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
499 call StopVimInTerminal(buf)
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
500 call delete('XtestPopupMask')
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
501 endfunc
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
502
17069
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
503 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
504 if !CanRunVimInTerminal()
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
505 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
506 endif
17071
57125309eef3 patch 8.1.1535: popup select test fails on Mac
Bram Moolenaar <Bram@vim.org>
parents: 17069
diff changeset
507 if !has('clipboard')
57125309eef3 patch 8.1.1535: popup select test fails on Mac
Bram Moolenaar <Bram@vim.org>
parents: 17069
diff changeset
508 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
509 endif
17069
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
510 " 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
511 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
512 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
513 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
514 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
515 \ drag: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
516 \ border: [],
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
517 \ line: 3,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
518 \ 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
519 \ })
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
520 func Select1()
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
521 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
522 endfunc
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
523 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
524 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
525 END
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
526 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
527 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
528 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
529 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
530
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
531 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
532 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
533 " 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
534 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
535
17069
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
536 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
537
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
538 " clean up
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
539 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
540 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
541 endfunc
76ae212a9075 patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents: 17055
diff changeset
542
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
543 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
544 " 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
545 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
546 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
547 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
548 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
549 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
550 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
551 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
552 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
553 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
554
d99805d25b42 patch 8.1.1521: when a popup window is closed the buffer remains
Bram Moolenaar <Bram@vim.org>
parents: 17037
diff changeset
555 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
556 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
557 " 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
558 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
559
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
560 " 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
561 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
562 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
563 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
564 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
565 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
566 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
567 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
568 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
569 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
570
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17125
diff changeset
571 " 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
572 tabnew
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
573 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
574 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
575 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
576 quit
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17125
diff changeset
577 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
578 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
579 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
580 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
581
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
582 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
583 " 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
584 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
585 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
586 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
587 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
588
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 " 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
590 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
591 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
592 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
593 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
594
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 " center
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
596 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
597 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
598 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
599 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
600 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
601 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
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 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
604
23645f9a5ce2 patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents: 16898
diff changeset
605 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
606 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
607 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
608 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
609 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
610
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
611 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
612 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
613 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
614 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
615 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
616 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
617 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
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", #{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
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", #{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
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", #{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
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", #{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
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", #{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
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", #{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
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", #{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
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", #{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
636 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
637 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
638 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
639 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
640 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
641
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: "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
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: "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
645 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
646 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
647 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
648 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
649 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
650 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
651 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
652 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
653
16863
2b00163053cd patch 8.1.1433: win_execute() may leave popup window focused
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
654 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
655 split
2b00163053cd patch 8.1.1433: win_execute() may leave popup window focused
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
656 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
657 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
658 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
659 endfunc
da5f5836e90c patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 16863
diff changeset
660
da5f5836e90c patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 16863
diff changeset
661 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
662 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
663 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
664 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
665 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
666 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
667 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
668 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
669 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
670 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
671 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
672 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
673 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
674 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
675 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
676 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
677 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
678 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
679 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
680 endfunc
2b00163053cd patch 8.1.1433: win_execute() may leave popup window focused
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
681
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
682 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
683 if !CanRunVimInTerminal()
16965
ba7727889385 patch 8.1.1483: skipped tests are not properly listed
Bram Moolenaar <Bram@vim.org>
parents: 16908
diff changeset
684 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
685 endif
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
686 let lines =<< trim END
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
687 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
688 let winid = popup_create(
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
689 \ '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
690 \ #{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
691 END
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
692 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
693 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
694 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
695
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
696 " clean up
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
697 call StopVimInTerminal(buf)
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
698 call delete('XtestPopup')
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
699 endfunc
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
700
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
701 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
702 if !CanRunVimInTerminal()
16965
ba7727889385 patch 8.1.1483: skipped tests are not properly listed
Bram Moolenaar <Bram@vim.org>
parents: 16908
diff changeset
703 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
704 endif
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
705 let lines =<< trim END
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
706 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
707 let winid = popup_create(
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
708 \ '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
709 \ #{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
710 END
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
711 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
712 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
713 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
714
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
715 " clean up
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
716 call StopVimInTerminal(buf)
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
717 call delete('XtestPopup')
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
718 endfunc
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
719
17442
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
720 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
721 if !CanRunVimInTerminal()
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
722 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
723 endif
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
724 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
725 set showbreak=>>\
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
726 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
727 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
728 \ '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
729 \ #{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
730 END
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
731 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
732 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
733 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
734
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
735 " clean up
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
736 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
737 call StopVimInTerminal(buf)
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
738 call delete('XtestPopupShowbreak')
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
739 endfunc
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
740
16800
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
741 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
742 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
743 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
744 endif
16800
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
745 topleft vnew
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
746 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
747
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
748 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
749 \ line: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
750 \ col: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
751 \ minwidth: 20,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
752 \ time: 500,
16800
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
753 \})
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
754 redraw
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
755 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
756 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
757
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
758 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
759 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
760 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
761 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
762
16800
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
763 sleep 700m
16802
f5487021fdad patch 8.1.1403: cannot build without the timer feature
Bram Moolenaar <Bram@vim.org>
parents: 16800
diff changeset
764 redraw
16800
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
765 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
766 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
767
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
768 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
769 \ line: &lines,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
770 \ col: 10,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
771 \ minwidth: 20,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
772 \ time: 500,
16800
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
773 \})
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
774 redraw
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
775 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
776 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
777
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
778 sleep 700m
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
779 redraw
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
780 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
781 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
782
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
783 bwipe!
12e3a3afdb6a patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents: 16794
diff changeset
784 endfunc
16809
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
785
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
786 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
787 topleft vnew
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
788 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
789
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
790 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
791 \ line: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
792 \ col: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
793 \ 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
794 \})
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
795 redraw
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
796 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
797 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
798 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
799 " 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
800 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
801
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
802 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
803 redraw
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
804 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
805 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
806 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
807 " 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
808 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
809
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
810 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
811 redraw
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
812 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
813 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
814 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
815
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
816
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
817 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
818 redraw
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
819 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
820 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
821
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
822 " 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
823 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
824
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
825 " 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
826 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
827 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
828
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
829 bwipe!
5ff14f96f1c9 patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
830 endfunc
16817
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
831
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
832 func Test_popup_move()
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
833 topleft vnew
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
834 call setline(1, 'hello')
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
835
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
836 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
837 \ line: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
838 \ col: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
839 \ minwidth: 20,
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 redraw
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
842 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
843 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
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 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
846 redraw
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
847 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
848 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
849 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
850 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
851
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
852 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
853 redraw
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
854 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
855 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
856
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
857 call popup_close(winid)
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
858
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
859 bwipe!
069ee8dc8c8d patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16811
diff changeset
860 endfunc
16829
5cebaecad422 patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16817
diff changeset
861
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
862 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
863 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
864 \ line: 2,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
865 \ col: 3,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
866 \ minwidth: 10,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
867 \ minheight: 11,
16829
5cebaecad422 patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16817
diff changeset
868 \})
5cebaecad422 patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16817
diff changeset
869 redraw
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
870 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
871 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
872 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
873 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
874 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
875 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
876
5cebaecad422 patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16817
diff changeset
877 call popup_close(winid)
5cebaecad422 patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16817
diff changeset
878 endfunc
16837
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
879
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
880 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
881 let tests = [
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
882 \ [['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
883 \ [['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
884 \ [['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
885 \ [['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
886 \ [['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
887 \ ]
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 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
890 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
891 redraw
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
892 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
893 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
894 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
895 endfor
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
896 endfunc
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 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
899 let tests = [
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
900 \ ['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
901 \ ['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
902 \ ['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
903 \ ]
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
904 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
905 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
906 \ #{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
907 redraw
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
908 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
909 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
910 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
911
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
912 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
913 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
914 endfor
18593056d8f1 patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
915 endfunc
16841
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
916
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
917 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
918 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
919 \ line: 2,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
920 \ col: 3,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
921 \ minwidth: 10,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
922 \ minheight: 11,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
923 \ maxwidth: 20,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
924 \ maxheight: 21,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
925 \ zindex: 100,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
926 \ time: 5000,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
927 \ fixed: 1
16841
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
928 \})
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
929 redraw
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
930 let res = popup_getoptions(winid)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
931 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
932 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
933 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
934 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
935 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
936 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
937 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
938 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
939 if has('timers')
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
940 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
941 endif
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
942 call popup_close(winid)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
943
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
944 let winid = popup_create('hello', {})
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
945 redraw
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
946 let res = popup_getoptions(winid)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
947 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
948 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
949 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
950 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
951 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
952 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
953 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
954 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
955 if has('timers')
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.time)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
957 endif
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
958 call popup_close(winid)
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16839
diff changeset
959 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
960 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
961
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
962 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
963 new
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
964 " 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
965 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
966 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
967 " 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
968 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
969 " 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
970 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
971 " 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
972 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
973
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
974 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
975 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
976 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
977 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
978 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
979 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
980
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
981 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
982 bwipe
283037126560 patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
983 endfunc
16853
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
984
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
985 func Test_popup_atcursor()
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
986 topleft vnew
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
987 call setline(1, [
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
988 \ 'xxxxxxxxxxxxxxxxx',
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
989 \ 'xxxxxxxxxxxxxxxxx',
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
990 \ 'xxxxxxxxxxxxxxxxx',
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
991 \])
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
992
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
993 call cursor(2, 2)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
994 redraw
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
995 let winid = popup_atcursor('vim', {})
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
996 redraw
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
997 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
998 call assert_equal('xvimxxxxxxxxxxxxx', line)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
999 call popup_close(winid)
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 call cursor(3, 4)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1002 redraw
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1003 let winid = popup_atcursor('vim', {})
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1004 redraw
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1005 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
1006 call assert_equal('xxxvimxxxxxxxxxxx', line)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1007 call popup_close(winid)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1008
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1009 call cursor(1, 1)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1010 redraw
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1011 let winid = popup_create('vim', #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1012 \ line: 'cursor+2',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1013 \ col: 'cursor+1',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1014 \})
16853
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1015 redraw
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1016 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
1017 call assert_equal('xvimxxxxxxxxxxxxx', line)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1018 call popup_close(winid)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1019
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1020 call cursor(3, 3)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1021 redraw
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1022 let winid = popup_create('vim', #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1023 \ line: 'cursor-2',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1024 \ col: 'cursor-1',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1025 \})
16853
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1026 redraw
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1027 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
1028 call assert_equal('xvimxxxxxxxxxxxxx', line)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1029 call popup_close(winid)
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1030
16857
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1031 " just enough room above
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1032 call cursor(3, 3)
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1033 redraw
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1034 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
1035 redraw
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1036 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
1037 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
1038 call popup_close(winid)
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1039
4de94f6161f2 patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
1040 " 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
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(4, 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
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
1049 " 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
1050 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
1051 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
1052 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
1053 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
1054 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
1055 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
1056 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
1057
16853
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1058 bwipe!
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16849
diff changeset
1059 endfunc
16880
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1060
17292
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1061 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
1062 if !CanRunVimInTerminal()
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1063 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
1064 endif
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1065
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1066 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
1067 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
1068 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
1069 set balloonevalterm
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1070 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
1071 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
1072 func BalloonExpr()
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1073 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
1074 return ''
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1075 endfunc
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1076 func Hover()
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1077 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
1078 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
1079 sleep 100m
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1080 endfunc
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1081 func MoveOntoPopup()
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1082 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
1083 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
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 MoveAway()
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, 13)
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("\<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
1088 endfunc
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1089 END
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1090 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
1091 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
1092 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
1093 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
1094 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
1095 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
1096
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1097 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
1098 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
1099
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1100 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
1101 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
1102
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1103 " clean up
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1104 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
1105 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
1106 endfunc
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1107
16880
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1108 func Test_popup_filter()
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1109 new
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1110 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
1111
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1112 func MyPopupFilter(winid, c)
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1113 if a:c == 'e'
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1114 let g:eaten = 'e'
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1115 return 1
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1116 endif
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1117 if a:c == '0'
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1118 let g:ignored = '0'
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1119 return 0
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1120 endif
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1121 if a:c == 'x'
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1122 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
1123 return 1
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1124 endif
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1125 return 0
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1126 endfunc
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1127
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1128 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
1129 redraw
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1130
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1131 " 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
1132 call feedkeys('e', 'xt')
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1133 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
1134
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1135 " 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
1136 normal $
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1137 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
1138 call feedkeys('0', 'xt')
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1139 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
1140 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
1141
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1142 " x closes the popup
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1143 call feedkeys('x', 'xt')
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1144 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
1145 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
1146
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1147 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
1148 call popup_clear()
16880
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16878
diff changeset
1149 endfunc
16890
5131023c5728 patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16888
diff changeset
1150
17097
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1151 func ShowDialog(key, result)
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1152 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
1153 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
1154 \ 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
1155 \ callback: 'QuitCallback',
17097
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1156 \ })
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1157 redraw
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1158 call feedkeys(a:key, "xt")
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1159 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
1160 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
1161 endfunc
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1162
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1163 func Test_popup_dialog()
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1164 func QuitCallback(id, res)
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1165 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
1166 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
1167 endfunc
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1168
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1169 let winid = ShowDialog("y", 1)
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1170 let winid = ShowDialog("Y", 1)
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1171 let winid = ShowDialog("n", 0)
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1172 let winid = ShowDialog("N", 0)
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1173 let winid = ShowDialog("x", 0)
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1174 let winid = ShowDialog("X", 0)
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1175 let winid = ShowDialog("\<Esc>", 0)
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1176 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
1177
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1178 delfunc QuitCallback
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1179 endfunc
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
1180
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
1181 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
1182 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
1183 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
1184 \ 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
1185 \ })
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1186 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
1187 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
1188 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
1189 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
1190 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
1191
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1192 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
1193 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
1194 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
1195 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
1196 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
1197
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 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
1199 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
1200 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
1201 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
1202 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
1203 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
1204 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
1205 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
1206 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
1207
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 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
1209 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
1210
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 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
1212 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
1213 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
1214 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
1215
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 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
1217 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
1218 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
1219 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
1220 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
1221 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
1222 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
1223 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
1224 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
1225 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
1226 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
1227
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1228 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
1229 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
1230
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 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
1232 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
1233
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
1234 " 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
1235 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
1236 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
1237 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
1238
17438
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1239 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
1240 if !CanRunVimInTerminal()
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1241 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
1242 endif
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1243
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1244 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
1245 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
1246 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
1247 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
1248 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
1249 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
1250 endfunc
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1251 END
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1252 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
1253 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
1254 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
1255
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1256 " clean up
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1257 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
1258 call StopVimInTerminal(buf)
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1259 call delete('XtestPopupNarrowMenu')
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1260 endfunc
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
1261
17119
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1262 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
1263 if !CanRunVimInTerminal()
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1264 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
1265 endif
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1266
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1267 " 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
1268 " 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
1269 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
1270 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
1271 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
1272 END
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1273 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
1274 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
1275 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
1276
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1277 " clean up
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1278 call StopVimInTerminal(buf)
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1279 call delete('XtestPopupTitle')
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1280
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1281 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
1282 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
1283 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
1284 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
1285
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1286 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
1287 endfunc
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
1288
16890
5131023c5728 patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16888
diff changeset
1289 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
1290 func PopupDone(id, result)
5131023c5728 patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16888
diff changeset
1291 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
1292 endfunc
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1293 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
1294 redraw
5131023c5728 patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16888
diff changeset
1295 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
1296 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
1297 endfunc
16892
60c9ac14a2ec patch 8.1.1447: not allowed to create an empty popup
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
1298
60c9ac14a2ec patch 8.1.1447: not allowed to create an empty popup
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
1299 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
1300 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
1301 redraw
60c9ac14a2ec patch 8.1.1447: not allowed to create an empty popup
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
1302 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
1303 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
1304 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
1305
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1306 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
1307 redraw
60c9ac14a2ec patch 8.1.1447: not allowed to create an empty popup
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
1308 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
1309 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
1310 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
1311 endfunc
16894
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1312
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1313 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
1314 if !CanRunVimInTerminal()
16965
ba7727889385 patch 8.1.1483: skipped tests are not properly listed
Bram Moolenaar <Bram@vim.org>
parents: 16908
diff changeset
1315 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
1316 endif
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1317 " +-----------------------------+
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1318 " | | |
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1319 " | | |
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1320 " | | |
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1321 " | line1 |
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1322 " |------------line2------------|
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1323 " | line3 |
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1324 " | line4 |
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1325 " | |
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 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
1329 only
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1330 split
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1331 vsplit
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1332 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
1333 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
1334 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
1335 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
1336 \ line : line,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1337 \ 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
1338 \ })
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1339 END
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1340 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
1341 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
1342 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
1343 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
1344
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1345 " clean up
236c182c6300 patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents: 16892
diff changeset
1346 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
1347 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
1348 endfunc
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1349
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1350 func s:VerifyPosition( p, msg, line, col, width, height )
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1351 call assert_equal( a:line, popup_getpos( a:p ).line, a:msg . ' (l)' )
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1352 call assert_equal( a:col, popup_getpos( a:p ).col, a:msg . ' (c)' )
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1353 call assert_equal( a:width, popup_getpos( a:p ).width, a:msg . ' (w)' )
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1354 call assert_equal( a:height, popup_getpos( a:p ).height, a:msg . ' (h)' )
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1355 endfunc
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1356
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1357 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
1358 " 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
1359 " left.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1360 "
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1361 " 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
1362 " 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
1363
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1364 " 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
1365 " 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
1366 let both_wrap_tests = [
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1367 \ [ 'a', 5, &columns, 5, &columns - 2, 1, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1368 \ [ 'b', 5, &columns + 1, 5, &columns - 2, 1, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1369 \ [ 'c', 5, &columns - 1, 5, &columns - 2, 1, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1370 \ [ 'd', 5, &columns - 2, 5, &columns - 2, 1, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1371 \ [ 'e', 5, &columns - 3, 5, &columns - 3, 1, 1 ],
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 \ [ 'aa', 5, &columns, 5, &columns - 2, 2, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1374 \ [ 'bb', 5, &columns + 1, 5, &columns - 2, 2, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1375 \ [ 'cc', 5, &columns - 1, 5, &columns - 2, 2, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1376 \ [ 'dd', 5, &columns - 2, 5, &columns - 2, 2, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1377 \ [ 'ee', 5, &columns - 3, 5, &columns - 3, 2, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1378 \
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1379 \ [ 'aaa', 5, &columns, 5, &columns - 2, 3, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1380 \ [ 'bbb', 5, &columns + 1, 5, &columns - 2, 3, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1381 \ [ 'ccc', 5, &columns - 1, 5, &columns - 2, 3, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1382 \ [ 'ddd', 5, &columns - 2, 5, &columns - 2, 3, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1383 \ [ 'eee', 5, &columns - 3, 5, &columns - 3, 3, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1384 \ ]
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1385
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1386 " 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
1387 " - 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
1388 " - 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
1389 " - 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
1390 " - text
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1391 " - row
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1392 " - col
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1393 " - expected row
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1394 " - expected col
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1395 " - expected width
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1396 " - expected height
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1397 let tests = [
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1398 \ #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1399 \ comment: 'left-aligned with wrapping',
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1400 \ options: #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1401 \ wrap: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1402 \ pos: 'botleft',
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1403 \ },
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1404 \ tests: both_wrap_tests + [
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1405 \ [ 'aaaa', 5, &columns, 4, &columns - 2, 3, 2 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1406 \ [ 'bbbb', 5, &columns + 1, 4, &columns - 2, 3, 2 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1407 \ [ 'cccc', 5, &columns - 1, 4, &columns - 2, 3, 2 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1408 \ [ 'dddd', 5, &columns - 2, 4, &columns - 2, 3, 2 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1409 \ [ 'eeee', 5, &columns - 3, 5, &columns - 3, 4, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1410 \ ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1411 \ },
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1412 \ #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1413 \ comment: 'left aligned without wrapping',
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1414 \ options: #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1415 \ wrap: 0,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1416 \ pos: 'botleft',
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1417 \ },
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1418 \ tests: both_wrap_tests + [
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1419 \ [ 'aaaa', 5, &columns, 5, &columns - 3, 4, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1420 \ [ 'bbbb', 5, &columns + 1, 5, &columns - 3, 4, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1421 \ [ 'cccc', 5, &columns - 1, 5, &columns - 3, 4, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1422 \ [ 'dddd', 5, &columns - 2, 5, &columns - 3, 4, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1423 \ [ 'eeee', 5, &columns - 3, 5, &columns - 3, 4, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1424 \ ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1425 \ },
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1426 \ #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1427 \ comment: 'left aligned with fixed position',
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1428 \ options: #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1429 \ wrap: 0,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1430 \ fixed: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1431 \ pos: 'botleft',
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1432 \ },
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1433 \ tests: both_wrap_tests + [
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1434 \ [ 'aaaa', 5, &columns, 5, &columns - 2, 3, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1435 \ [ 'bbbb', 5, &columns + 1, 5, &columns - 2, 3, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1436 \ [ 'cccc', 5, &columns - 1, 5, &columns - 2, 3, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1437 \ [ 'dddd', 5, &columns - 2, 5, &columns - 2, 3, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1438 \ [ 'eeee', 5, &columns - 3, 5, &columns - 3, 4, 1 ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1439 \ ],
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1440 \ },
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1441 \ ]
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1442
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1443 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
1444 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
1445 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
1446 let options = #{
17368
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1447 \ line: line,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1448 \ col: col,
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1449 \ }
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1450 call extend( options, test_group.options )
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 let p = popup_create( text, options )
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1453
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1454 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
1455 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
1456 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
1457 endfor
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1458 endfor
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1459
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
1460 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
1461 %bwipe!
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1462 endfunc
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1463
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1464 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
1465 " width of screen
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1466 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
1467
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1468 let p = popup_create( X, #{line: 1, col: 1, wrap: 0})
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1469 call s:VerifyPosition( p, 'full width topleft', 1, 1, &columns, 1 )
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1470
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1471 redraw
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1472 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
1473 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
1474
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1475 call popup_close( p )
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1476 redraw
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1477
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1478 " Same if placed on the right hand side
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1479 let p = popup_create( X, #{line: 1, col: &columns, wrap: 0})
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1480 call s:VerifyPosition( p, 'full width topright', 1, 1, &columns, 1 )
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1481
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1482 redraw
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1483 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
1484 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
1485
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1486 call popup_close( p )
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1487 redraw
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1488
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1489 " 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
1490 let X .= 'x'
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1491
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1492 let p = popup_create( X, #{line: 1, col: 1, wrap: 0})
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1493 call s:VerifyPosition( p, 'full width + 1 topleft', 1, 1, &columns, 1 )
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1494
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1495 redraw
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1496 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
1497 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
1498
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1499 call popup_close( p )
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1500 redraw
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1501
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1502 " Shifted then truncated (the x is not visible)
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1503 let p = popup_create( X, #{line: 1, col: &columns - 3, wrap: 0})
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1504 call s:VerifyPosition( p, 'full width + 1 topright', 1, 1, &columns, 1 )
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1505
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1506 redraw
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1507 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
1508 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
1509
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1510 call popup_close( p )
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1511 redraw
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1512
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1513 " Not shifted, just truncated
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1514 let p = popup_create( X,
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1515 \ #{line: 1, col: 2, wrap: 0, fixed: 1})
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1516 call s:VerifyPosition( p, 'full width + 1 fixed', 1, 2, &columns - 1, 1)
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1517
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1518 redraw
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1519 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
1520 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
1521 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
1522
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1523 call popup_close( p )
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1524 redraw
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16894
diff changeset
1525
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 17022
diff changeset
1526 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
1527 %bwipe!
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1528 endfunc
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1529
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1530 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
1531 new
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1532 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
1533 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
1534
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1535 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
1536 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
1537 redraw
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1538 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
1539 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
1540 " 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
1541 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
1542 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
1543 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
1544
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1545 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
1546 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
1547 redraw
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1548 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
1549 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
1550 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
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("li\<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(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
1561 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
1562 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
1563 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
1564 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
1565 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
1566
16908
df06694b761b patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents: 16904
diff changeset
1567 " 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
1568 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
1569 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
1570 redraw
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)
17292
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17278
diff changeset
1572 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
1573 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
1574 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
1575 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
1576 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
1577 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
1578 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
1579 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
1580
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1581 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
1582 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
1583 redraw
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1584 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
1585 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
1586 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
1587 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
1588 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
1589 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
1590 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
1591
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1592 bwipe!
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16902
diff changeset
1593 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
1594 endfunc
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1595
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1596 func Test_notifications()
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1597 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
1598 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
1599 endif
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1600 if !CanRunVimInTerminal()
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1601 throw 'Skipped: cannot make screendumps'
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1602 endif
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1603
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1604 call writefile([
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1605 \ "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
1606 \ "hi Notification ctermbg=lightblue",
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1607 \ "call popup_notification('first notification', {})",
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1608 \], 'XtestNotifications')
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1609 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
1610 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
1611
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1612 " 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
1613 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
1614 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
1615 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
1616
17180
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1617 " clean up
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1618 call StopVimInTerminal(buf)
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1619 call delete('XtestNotifications')
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1620 endfunc
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1621
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1622 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
1623 if !CanRunVimInTerminal()
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1624 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
1625 endif
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1626
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1627 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
1628 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
1629 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
1630 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
1631 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
1632 \ '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
1633 \ minwidth: 8,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1634 \ maxheight: 4,
17180
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1635 \ })
17198
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1636 func ScrollUp()
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1637 call feedkeys("\<F3>\<ScrollWheelUp>", "xt")
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1638 endfunc
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1639 func ScrollDown()
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1640 call feedkeys("\<F3>\<ScrollWheelDown>", "xt")
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1641 endfunc
17216
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17210
diff changeset
1642 func ClickTop()
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17210
diff changeset
1643 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
1644 endfunc
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17210
diff changeset
1645 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
1646 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
1647 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
1648 endfunc
17198
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1649 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
1650 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
1651 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
1652 END
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
1653 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
1654 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
1655 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
1656
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1657 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
1658 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
1659 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
1660
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1661 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
1662 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
1663 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
1664
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1665 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
1666 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
1667 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
1668
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1669 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
1670 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
1671 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
1672
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1673 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
1674 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
1675
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1676 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
1677 " 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
1678 sleep 100m
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 ScrollDown()\<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_7', {})
4c009ec23c0a patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents: 17182
diff changeset
1681
17216
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17210
diff changeset
1682 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
1683 sleep 100m
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17210
diff changeset
1684 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
1685 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
1686
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17210
diff changeset
1687 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
1688 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
1689
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1690 " clean up
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1691 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
1692 call delete('XtestPopupScroll')
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17043
diff changeset
1693 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
1694
17274
6a7ba68d448e patch 8.1.1636: crash when popup has fitting scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 17253
diff changeset
1695 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
1696 " 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
1697 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
1698 \ '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
1699 \ scrollbar: 1,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1700 \ maxwidth: 10,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1701 \ maxheight: 5,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1702 \ firstline: 2})
17274
6a7ba68d448e patch 8.1.1636: crash when popup has fitting scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 17253
diff changeset
1703 redraw
6a7ba68d448e patch 8.1.1636: crash when popup has fitting scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 17253
diff changeset
1704 call popup_clear()
6a7ba68d448e patch 8.1.1636: crash when popup has fitting scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 17253
diff changeset
1705 endfunc
6a7ba68d448e patch 8.1.1636: crash when popup has fitting scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 17253
diff changeset
1706
17121
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1707 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
1708 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
1709 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
1710 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
1711
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1712 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
1713 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
1714 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
1715 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
1716 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
1717
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 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
1719 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
1720 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
1721
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17101
diff changeset
1722 " 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
1723 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
1724 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
1725
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 " 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
1727 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
1728 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
1729
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 " 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
1731 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
1732 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
1733
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 " 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
1735 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
1736 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
1737
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 " 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
1739 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
1740 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
1741
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 " Dicts
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1743 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
1744 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
1745
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 " 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
1747 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
1748 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
1749 endfunc
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1750
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1751 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
1752 new
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1753
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1754 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
1755 redraw
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1756 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
1757 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
1758
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1759 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
1760 redraw
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1761 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
1762 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
1763
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1764 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
1765 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
1766 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
1767 endfunc
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_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
1769 \ 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
1770 \ callback: 'QuitCallback',
17121
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1771 \ })
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1772 redraw
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1773 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
1774 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
1775 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
1776 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
1777 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
1778
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1779 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
1780 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
1781 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
1782
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1783 bwipe!
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1784 delfunc QuitCallback
808ea76535a9 patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
1785 endfunc
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1786
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1787 " 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
1788 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
1789 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
1790 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
1791 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
1792 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
1793 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
1794
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1795 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
1796 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
1797 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
1798 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
1799 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
1800
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1801 call popup_close(winid)
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17121
diff changeset
1802 endfunc
17151
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1803
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1804 func Test_popupwin_garbage_collect()
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1805 func MyPopupFilter(x, winid, c)
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1806 " NOP
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1807 endfunc
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1808
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
1809 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
1810 call test_garbagecollect_now()
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1811 redraw
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1812 " 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
1813 call feedkeys('j', 'xt')
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1814 call assert_true(v:true)
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1815
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1816 call popup_close(winid)
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1817 delfunc MyPopupFilter
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
1818 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
1819
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
1820 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
1821 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
1822 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
1823 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
1824 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
1825 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
1826 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
1827 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
1828 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
1829 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
1830 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
1831 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
1832 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
1833
e9ebf3f27af6 patch 8.1.1615: crash when passing buffer number to popup_create()
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
1834 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
1835 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
1836 redraw
e9ebf3f27af6 patch 8.1.1615: crash when passing buffer number to popup_create()
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
1837 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
1838 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
1839 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
1840
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
1841 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
1842 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
1843 \ maxwidth: 40,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1844 \ 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
1845 \ })
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
1846 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
1847 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
1848 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
1849 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
1850 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
1851 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
1852 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
1853
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
1854 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
1855 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
1856 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
1857 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
1858 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
1859 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
1860 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
1861 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
1862 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
1863 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
1864 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
1865 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
1866 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
1867 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
1868
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 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
1870 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
1871 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
1872 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
1873 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
1874 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
1875 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
1876 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
1877 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
1878 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
1879 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
1880
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1881 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
1882 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
1883 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
1884 endif
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1885
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1886 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
1887 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
1888 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
1889 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
1890 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
1891 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
1892 \ maxwidth: 10,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1893 \ maxheight: 3,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1894 \ pos : 'topleft',
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1895 \ 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
1896 \ 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
1897 \ 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
1898 \ })
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1899 endfunc
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1900 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
1901 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
1902 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
1903 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
1904 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
1905 END
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1906 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
1907 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
1908 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
1909
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1910 " 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
1911 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
1912 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
1913 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
1914 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
1915 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
1916
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1917 " 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
1918 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
1919 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
1920 endfunc
102ed3a26a5d patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
1921
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
1922 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
1923 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
1924 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
1925 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
1926
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
1927 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
1928 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
1929 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
1930 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
1931 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
1932 \ '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
1933 \ minwidth: 8,
6604ecb7a615 patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents: 17358
diff changeset
1934 \ 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
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 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 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
1938 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
1939
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 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
1941 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
1942
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
1943 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
1944 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
1945
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 " 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
1947 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
1948 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
1949
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 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
1951 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
1952
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 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
1954 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
1955
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 " 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
1957 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
1958 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
1959
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 " 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
1961 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
1962
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 " 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
1964 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
1965 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
1966 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
1967
17429
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1968 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
1969 if !CanRunVimInTerminal()
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1970 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
1971 endif
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1972
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1973 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
1974 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
1975 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
1976 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
1977 return 1
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1978 endif
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1979 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
1980 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
1981 return 1
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1982 endif
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1983 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
1984 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
1985 return 1
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1986 endif
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1987 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
1988 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
1989 return 1
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1990 endif
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1991 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
1992 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
1993 return 1
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1994 endif
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1995 return 0
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1996 endfunction
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1997 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
1998 \ maxheight : 3,
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
1999 \ filter : 'MyFilter'
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2000 \ })
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2001 END
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2002 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
2003 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
2004
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2005 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
2006 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
2007
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2008 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
2009 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
2010
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2011 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
2012 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
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, "0")
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_4', {})
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, "x")
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2018
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2019 " clean up
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2020 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
2021 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
2022 endfunc
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2023
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2024 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
2025 if !CanRunVimInTerminal()
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2026 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
2027 endif
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2028
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2029 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
2030 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
2031 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
2032
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2033 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
2034 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
2035 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
2036
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2037 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
2038 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
2039 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
2040
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2041 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
2042 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
2043 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
2044
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2045 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
2046 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
2047 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
2048
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2049 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
2050 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
2051 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
2052
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 " Pattern 1
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2055 " ---------
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2056 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
2057 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
2058 END
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2059 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
2060 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
2061 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
2062 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
2063 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
2064
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2065 " ---------
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2066 " Pattern 2
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2067 " ---------
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2068 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
2069 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
2070 END
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2071 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
2072 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
2073 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
2074 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
2075 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
2076
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2077 " ---------
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2078 " Pattern 3
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2079 " ---------
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2080 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
2081 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
2082 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
2083 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
2084 return 1
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2085 endif
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2086 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
2087 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
2088 return 1
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2089 endif
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2090 return 0
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2091 endfunction
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2092 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
2093 \ cursorline : 0,
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2094 \ maxheight : 2,
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2095 \ filter : 'MyFilter',
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2096 \ })
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2097 END
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2098 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
2099 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
2100 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
2101 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
2102 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
2103 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
2104 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
2105 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
2106
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2107 " ---------
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2108 " Pattern 4
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2109 " ---------
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2110 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
2111 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
2112 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
2113 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
2114 return 1
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2115 endif
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2116 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
2117 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
2118 return 1
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2119 endif
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2120 return 0
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2121 endfunction
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2122 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
2123 \ cursorline : 1,
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2124 \ maxheight : 2,
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2125 \ filter : 'MyFilter',
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2126 \ })
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2127 END
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2128 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
2129 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
2130 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
2131 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
2132 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
2133 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
2134 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
2135 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
2136
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2137 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
2138 endfunc
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17421
diff changeset
2139
17438
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2140 func Test_previewpopup()
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2141 if !CanRunVimInTerminal()
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2142 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
2143 endif
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2144 call writefile([
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2145 \ "!_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
2146 \ "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
2147 \ "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
2148 \ 'Xtags')
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2149 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
2150 \ + ['theword is here']
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2151 \ + range(22, 27)
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2152 \ + ['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
2153 \ + range(29, 40),
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2154 \ "Xtagfile")
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2155 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
2156 set tags=Xtags
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2157 call setline(1, [
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2158 \ 'one',
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2159 \ 'two',
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2160 \ 'three',
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2161 \ 'four',
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2162 \ 'five',
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2163 \ 'six',
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2164 \ 'seven',
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2165 \ 'find theword somewhere',
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2166 \ 'nine',
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2167 \ 'this is another word'])
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2168 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
2169 END
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2170 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
2171 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
2172
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2173 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
2174 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
2175 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
2176
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2177 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
2178 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
2179
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2180 call StopVimInTerminal(buf)
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2181 call delete('Xtags')
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2182 call delete('Xtagfile')
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2183 call delete('XtestPreviewPopup')
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2184 endfunc
967e2ee9b656 patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
2185
17442
57b9fca8c7d2 patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents: 17438
diff changeset
2186 " vim: shiftwidth=2 sts=2