Mercurial > vim
annotate src/testdir/test_popupwin.vim @ 31849:dbec60b8c253 v9.0.1257
patch 9.0.1257: code style is not check in test scripts
Commit: https://github.com/vim/vim/commit/94722c510745a0cfd494c51625a514b92dd2bfb2
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 28 19:19:03 2023 +0000
patch 9.0.1257: code style is not check in test scripts
Problem: Code style is not check in test scripts.
Solution: Add basic code style check for test files.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 28 Jan 2023 20:30:04 +0100 |
parents | bda1452d81bc |
children | 84bda983ee01 |
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 |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18751
diff
changeset
|
4 CheckFeature popupwin |
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 |
31245
fbc4d3b0302d
patch 9.0.0956: terminal tests fail when using key with modifier
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
7 source term_util.vim |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 func Test_simple_popup() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
10 CheckScreendump |
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
11 |
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 |
18586
78e43be18f6b
patch 8.1.2287: using EndOfBuffer highlight in popup does not look good
Bram Moolenaar <Bram@vim.org>
parents:
18558
diff
changeset
|
16 hi EndOfBuffer ctermbg=lightgrey |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
17 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
|
18 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
|
19 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
|
20 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
|
21 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
|
22 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
23 call writefile(lines, 'XtestPopup', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
24 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
|
25 call VerifyScreenDump(buf, 'Test_popupwin_01', {}) |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 |
16794
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
27 " Add a tabpage |
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
28 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
|
29 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
|
30 \ .. "#{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
|
31 \ .. "#{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
|
32 \ .. "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
|
33 \ .. "}]}," |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
34 \ .. "], #{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
|
35 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
|
36 |
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
37 " 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
|
38 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
|
39 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
|
40 |
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
41 " close that tabpage |
ddfa924df50d
patch 8.1.1399: popup windows not adjusted when switching tabs
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
42 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
|
43 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
|
44 |
17037
9297877074a3
patch 8.1.1518: crash when setting 'columns' while a popup is visible
Bram Moolenaar <Bram@vim.org>
parents:
17026
diff
changeset
|
45 " 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
|
46 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
|
47 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
|
48 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
|
49 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
|
50 |
16839
032d5335987e
patch 8.1.1421: drawing "~" line in popup window
Bram Moolenaar <Bram@vim.org>
parents:
16837
diff
changeset
|
51 " 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
|
52 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
|
53 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
|
54 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
|
55 |
16839
032d5335987e
patch 8.1.1421: drawing "~" line in popup window
Bram Moolenaar <Bram@vim.org>
parents:
16837
diff
changeset
|
56 " 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
|
57 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
|
58 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
|
59 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
|
60 |
16998
2ec0f953ec3f
patch 8.1.1499: ruler not updated after popup window was removed
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
61 " 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
|
62 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
|
63 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
|
64 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
|
65 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
|
66 |
2ec0f953ec3f
patch 8.1.1499: ruler not updated after popup window was removed
Bram Moolenaar <Bram@vim.org>
parents:
16965
diff
changeset
|
67 " 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
|
68 call term_sendkeys(buf, "axxx\<Esc>") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19732
diff
changeset
|
69 call TermWait(buf) |
16998
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_sendkeys(buf, "0") |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19732
diff
changeset
|
71 call TermWait(buf) |
17026
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
17022
diff
changeset
|
72 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
|
73 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
|
74 |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
75 " clean up |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
76 call StopVimInTerminal(buf) |
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() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
80 CheckScreendump |
16884
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
81 |
16886
2bd51fdcc793
patch 8.1.1444: not using double line characters for popup border
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
82 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
|
83 let lines =<< trim END |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
84 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
|
85 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
|
86 call popup_create('hello padding', #{line: 2, col: 23, padding: []}) |
17628
6146b10714de
patch 8.1.1811: popup window color cannot be set to "Normal"
Bram Moolenaar <Bram@vim.org>
parents:
17626
diff
changeset
|
87 call popup_create('hello both', #{line: 2, col: 43, border: [], padding: [], highlight: 'Normal'}) |
17413
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('border TL', #{line: 6, col: 3, border: [1, 0, 0, 4]}) |
19241
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
89 call popup_create('paddings', #{line: 6, col: 23, padding: range(1, 4)}) |
17413
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('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
|
91 call popup_create('right aligned text', #{line: 11, col: 56, wrap: 0, padding: [0, 3, 0, 3], border: [0, 1, 0, 1]}) |
19071
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
92 call popup_create('X', #{line: 2, col: 73}) |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
93 call popup_create('X', #{line: 3, col: 74}) |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
94 call popup_create('X', #{line: 4, col: 75}) |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
95 call popup_create('X', #{line: 5, col: 76}) |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
96 END |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
97 call insert(lines, iter == 1 ? '' : 'set enc=latin1') |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
98 call writefile(lines, 'XtestPopupBorder', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
99 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
|
100 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
|
101 |
2bd51fdcc793
patch 8.1.1444: not using double line characters for popup border
Bram Moolenaar <Bram@vim.org>
parents:
16884
diff
changeset
|
102 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
|
103 endfor |
16884
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
104 |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
105 let lines =<< trim END |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
106 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
|
107 hi BlueColor ctermbg=lightblue |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
108 hi TopColor ctermbg=253 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
109 hi RightColor ctermbg=245 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
110 hi BottomColor ctermbg=240 |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
111 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
|
112 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
|
113 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
|
114 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
|
115 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
|
116 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
|
117 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
|
118 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
|
119 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
|
120 endfunc |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
121 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
122 call writefile(lines, 'XtestPopupBorder', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
123 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
|
124 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
|
125 |
17125
b4eb06233448
patch 8.1.1562: popup window not always redrawn after popup_setoptions()
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
126 " 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
|
127 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
|
128 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
|
129 |
17312
484424955bfa
patch 8.1.1655: popup window border drawn wrong with multi-byte char
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
130 " 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
|
131 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
|
132 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
|
133 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
|
134 endif |
484424955bfa
patch 8.1.1655: popup window border drawn wrong with multi-byte char
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
135 |
16888
ec61b6b79865
patch 8.1.1445: popup window border highlight not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16886
diff
changeset
|
136 call StopVimInTerminal(buf) |
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, |
18512
e855058e0c23
patch 8.1.2250: CTRL-U and CTRL-D don't work in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18494
diff
changeset
|
148 \ lastline: 1, |
17368
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
149 \ scrollbar: 0, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
150 \ 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
|
151 let winid = popup_create('hello border', #{line: 2, col: 3, border: []})", |
17972
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17946
diff
changeset
|
152 call assert_equal(with_border_or_padding, winid->popup_getpos()) |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
153 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
|
154 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
|
155 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
|
156 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
157 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
|
158 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
|
159 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
|
160 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
|
161 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
|
162 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
|
163 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
|
164 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
165 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
|
166 \ 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
|
167 \ 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
|
168 \ 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
|
169 \ 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
|
170 \ }) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
171 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
|
172 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
|
173 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
|
174 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
|
175 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
|
176 |
18398
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
177 " Check that popup_setoptions() takes the output of popup_getoptions() |
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
178 call popup_setoptions(winid, options) |
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
179 call assert_equal(options, popup_getoptions(winid)) |
21c25bee9df8
patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents:
18396
diff
changeset
|
180 |
19241
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
181 " Check that range() doesn't crash |
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
182 call popup_setoptions(winid, #{ |
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
183 \ padding: range(1, 4), |
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
184 \ border: range(5, 8), |
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
185 \ borderhighlight: range(4), |
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
186 \ borderchars: range(8), |
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
187 \ }) |
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
188 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
189 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
|
190 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
|
191 \ line: 3, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
192 \ 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
|
193 \ col: 8, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
194 \ 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
|
195 \ width: 14, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
196 \ 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
|
197 \ height: 5, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
198 \ scrollbar: 0, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
199 \ 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
|
200 \ firstline: 1, |
18512
e855058e0c23
patch 8.1.2250: CTRL-U and CTRL-D don't work in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18494
diff
changeset
|
201 \ lastline: 1, |
17368
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
202 \ 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
|
203 |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
204 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
|
205 endfunc |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
206 |
16849
629f3d3b6886
patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents:
16843
diff
changeset
|
207 func Test_popup_with_syntax_win_execute() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
208 CheckScreendump |
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
209 |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
210 let lines =<< trim END |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
211 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
|
212 hi PopupColor ctermbg=lightblue |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
213 let winid = popup_create([ |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
214 \ '#include <stdio.h>', |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
215 \ 'int main(void)', |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
216 \ '{', |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
217 \ ' printf(123);', |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
218 \ '}', |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
219 \], #{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
|
220 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
|
221 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
222 call writefile(lines, 'XtestPopup', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
223 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
|
224 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
|
225 |
629f3d3b6886
patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents:
16843
diff
changeset
|
226 " clean up |
629f3d3b6886
patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents:
16843
diff
changeset
|
227 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
|
228 endfunc |
629f3d3b6886
patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents:
16843
diff
changeset
|
229 |
629f3d3b6886
patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents:
16843
diff
changeset
|
230 func Test_popup_with_syntax_setbufvar() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
231 CheckScreendump |
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
232 |
16857
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
233 let lines =<< trim END |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
234 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
|
235 hi PopupColor ctermbg=lightgrey |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
236 let winid = popup_create([ |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
237 \ '#include <stdio.h>', |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
238 \ 'int main(void)', |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
239 \ '{', |
17314
b60402471f69
patch 8.1.1656: popup window width is wrong when using Tabs
Bram Moolenaar <Bram@vim.org>
parents:
17312
diff
changeset
|
240 \ "\tprintf(567);", |
16857
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
241 \ '}', |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
242 \], #{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
|
243 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
|
244 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
245 call writefile(lines, 'XtestPopup', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
246 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
|
247 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
|
248 |
629f3d3b6886
patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents:
16843
diff
changeset
|
249 " clean up |
629f3d3b6886
patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents:
16843
diff
changeset
|
250 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
|
251 endfunc |
629f3d3b6886
patch 8.1.1426: no test for syntax highlight in popup window
Bram Moolenaar <Bram@vim.org>
parents:
16843
diff
changeset
|
252 |
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 func Test_popup_with_matches() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
254 CheckScreendump |
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
255 |
17022
79c3a52fdb07
patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents:
16998
diff
changeset
|
256 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
|
257 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
|
258 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
|
259 \ '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
|
260 \ '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
|
261 \], #{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
|
262 set hlsearch |
18494
04a40c1514c4
patch 8.1.2241: match highlight does not combine with 'wincolor'
Bram Moolenaar <Bram@vim.org>
parents:
18492
diff
changeset
|
263 hi VeryBlue ctermfg=blue guifg=blue |
17022
79c3a52fdb07
patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents:
16998
diff
changeset
|
264 /666 |
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 matchadd('ErrorMsg', '111') |
18494
04a40c1514c4
patch 8.1.2241: match highlight does not combine with 'wincolor'
Bram Moolenaar <Bram@vim.org>
parents:
18492
diff
changeset
|
266 call matchadd('VeryBlue', '444') |
17022
79c3a52fdb07
patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents:
16998
diff
changeset
|
267 call win_execute(winid, "call matchadd('ErrorMsg', '111')") |
18494
04a40c1514c4
patch 8.1.2241: match highlight does not combine with 'wincolor'
Bram Moolenaar <Bram@vim.org>
parents:
18492
diff
changeset
|
268 call win_execute(winid, "call matchadd('VeryBlue', '555')") |
17022
79c3a52fdb07
patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents:
16998
diff
changeset
|
269 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
270 call writefile(lines, 'XtestPopupMatches', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
271 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
|
272 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
|
273 |
79c3a52fdb07
patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents:
16998
diff
changeset
|
274 " 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
|
275 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
|
276 endfunc |
79c3a52fdb07
patch 8.1.1511: matches in a popup window are not displayed properly
Bram Moolenaar <Bram@vim.org>
parents:
16998
diff
changeset
|
277 |
16898
16fd1bb2e675
patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents:
16896
diff
changeset
|
278 func Test_popup_all_corners() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
279 CheckScreendump |
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
280 |
16898
16fd1bb2e675
patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents:
16896
diff
changeset
|
281 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
|
282 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
|
283 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
|
284 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
|
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: 'topleft', |
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 \ }) |
18432
ee8db42dacf6
patch 8.1.2210: using negative offset for popup_create() does not work
Bram Moolenaar <Bram@vim.org>
parents:
18398
diff
changeset
|
292 normal 24|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: 'topright', |
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 \ }) |
18432
ee8db42dacf6
patch 8.1.2210: using negative offset for popup_create() does not work
Bram Moolenaar <Bram@vim.org>
parents:
18398
diff
changeset
|
300 normal 9G27|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: 'botleft', |
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 \ }) |
18432
ee8db42dacf6
patch 8.1.2210: using negative offset for popup_create() does not work
Bram Moolenaar <Bram@vim.org>
parents:
18398
diff
changeset
|
308 normal 48|r& |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
309 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
|
310 \ 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
|
311 \ col: 'cursor', |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
312 \ pos: 'botright', |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
313 \ border: [], |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
314 \ 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
|
315 \ }) |
18432
ee8db42dacf6
patch 8.1.2210: using negative offset for popup_create() does not work
Bram Moolenaar <Bram@vim.org>
parents:
18398
diff
changeset
|
316 normal 1G51|r* |
ee8db42dacf6
patch 8.1.2210: using negative offset for popup_create() does not work
Bram Moolenaar <Bram@vim.org>
parents:
18398
diff
changeset
|
317 let winid1 = popup_create(['one', 'two'], #{ |
ee8db42dacf6
patch 8.1.2210: using negative offset for popup_create() does not work
Bram Moolenaar <Bram@vim.org>
parents:
18398
diff
changeset
|
318 \ line: 'cursor-1', |
ee8db42dacf6
patch 8.1.2210: using negative offset for popup_create() does not work
Bram Moolenaar <Bram@vim.org>
parents:
18398
diff
changeset
|
319 \ col: 'cursor', |
ee8db42dacf6
patch 8.1.2210: using negative offset for popup_create() does not work
Bram Moolenaar <Bram@vim.org>
parents:
18398
diff
changeset
|
320 \ pos: 'botleft', |
ee8db42dacf6
patch 8.1.2210: using negative offset for popup_create() does not work
Bram Moolenaar <Bram@vim.org>
parents:
18398
diff
changeset
|
321 \ border: [], |
ee8db42dacf6
patch 8.1.2210: using negative offset for popup_create() does not work
Bram Moolenaar <Bram@vim.org>
parents:
18398
diff
changeset
|
322 \ padding: [], |
ee8db42dacf6
patch 8.1.2210: using negative offset for popup_create() does not work
Bram Moolenaar <Bram@vim.org>
parents:
18398
diff
changeset
|
323 \ }) |
16898
16fd1bb2e675
patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents:
16896
diff
changeset
|
324 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
325 call writefile(lines, 'XtestPopupCorners', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
326 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
|
327 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
|
328 |
16fd1bb2e675
patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents:
16896
diff
changeset
|
329 " 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
|
330 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
|
331 endfunc |
16fd1bb2e675
patch 8.1.1450: popup window positioning wrong when using padding or borders
Bram Moolenaar <Bram@vim.org>
parents:
16896
diff
changeset
|
332 |
18542
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
333 func Test_popup_nospace() |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
334 CheckScreendump |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
335 |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
336 let lines =<< trim END |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
337 call setline(1, repeat([repeat('-', 60)], 15)) |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
338 set so=0 |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
339 |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
340 " cursor in a line in top half, using "botleft" with popup that |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
341 " does fit |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
342 normal 5G2|r@ |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
343 let winid1 = popup_create(['one', 'two'], #{ |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
344 \ line: 'cursor-1', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
345 \ col: 'cursor', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
346 \ pos: 'botleft', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
347 \ border: [], |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
348 \ }) |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
349 " cursor in a line in top half, using "botleft" with popup that |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
350 " doesn't fit: gets truncated |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
351 normal 5G9|r# |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
352 let winid1 = popup_create(['one', 'two', 'tee'], #{ |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
353 \ line: 'cursor-1', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
354 \ col: 'cursor', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
355 \ pos: 'botleft', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
356 \ posinvert: 0, |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
357 \ border: [], |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
358 \ }) |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
359 " cursor in a line in top half, using "botleft" with popup that |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
360 " doesn't fit and 'posinvert' set: flips to below. |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
361 normal 5G16|r% |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
362 let winid1 = popup_create(['one', 'two', 'tee'], #{ |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
363 \ line: 'cursor-1', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
364 \ col: 'cursor', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
365 \ pos: 'botleft', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
366 \ border: [], |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
367 \ }) |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
368 " cursor in a line in bottom half, using "botleft" with popup that |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
369 " doesn't fit: does not flip. |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
370 normal 8G23|r* |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
371 let winid1 = popup_create(['aaa', 'bbb', 'ccc', 'ddd', 'eee', 'fff'], #{ |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
372 \ line: 'cursor-1', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
373 \ col: 'cursor', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
374 \ pos: 'botleft', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
375 \ border: [], |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
376 \ }) |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
377 |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
378 " cursor in a line in bottom half, using "topleft" with popup that |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
379 " does fit |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
380 normal 8G30|r@ |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
381 let winid1 = popup_create(['one', 'two'], #{ |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
382 \ line: 'cursor+1', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
383 \ col: 'cursor', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
384 \ pos: 'topleft', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
385 \ border: [], |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
386 \ }) |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
387 " cursor in a line in top half, using "topleft" with popup that |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
388 " doesn't fit: truncated |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
389 normal 8G37|r# |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
390 let winid1 = popup_create(['one', 'two', 'tee'], #{ |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
391 \ line: 'cursor+1', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
392 \ col: 'cursor', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
393 \ pos: 'topleft', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
394 \ posinvert: 0, |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
395 \ border: [], |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
396 \ }) |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
397 " cursor in a line in top half, using "topleft" with popup that |
18588
7dfdc319f4ff
patch 8.1.2288: not using all space when popup with "topleft" flips to above
Bram Moolenaar <Bram@vim.org>
parents:
18586
diff
changeset
|
398 " doesn't fit and "posinvert" set: flips to above. |
18542
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
399 normal 8G44|r% |
18588
7dfdc319f4ff
patch 8.1.2288: not using all space when popup with "topleft" flips to above
Bram Moolenaar <Bram@vim.org>
parents:
18586
diff
changeset
|
400 let winid1 = popup_create(['one', 'two', 'tee', 'fou', 'fiv'], #{ |
18542
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
401 \ line: 'cursor+1', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
402 \ col: 'cursor', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
403 \ pos: 'topleft', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
404 \ border: [], |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
405 \ }) |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
406 " cursor in a line in top half, using "topleft" with popup that |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
407 " doesn't fit: does not flip. |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
408 normal 5G51|r* |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
409 let winid1 = popup_create(['aaa', 'bbb', 'ccc', 'ddd', 'eee', 'fff'], #{ |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
410 \ line: 'cursor+1', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
411 \ col: 'cursor', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
412 \ pos: 'topleft', |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
413 \ border: [], |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
414 \ }) |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
415 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
416 call writefile(lines, 'XtestPopupNospace', 'D') |
18542
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
417 let buf = RunVimInTerminal('-S XtestPopupNospace', #{rows: 12}) |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
418 call VerifyScreenDump(buf, 'Test_popupwin_nospace', {}) |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
419 |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
420 " clean up |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
421 call StopVimInTerminal(buf) |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
422 endfunc |
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
423 |
20386
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20375
diff
changeset
|
424 func Test_popup_firstline_dump() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
425 CheckScreendump |
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
426 |
17047
6400d1ad5e4b
patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
17045
diff
changeset
|
427 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
|
428 call setline(1, range(1, 20)) |
17905
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
429 let winid = 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
|
430 \ maxheight: 4, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
431 \ 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
|
432 \ }) |
6400d1ad5e4b
patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
17045
diff
changeset
|
433 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
434 call writefile(lines, 'XtestPopupFirstline', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
435 let buf = RunVimInTerminal('-S XtestPopupFirstline', #{rows: 10}) |
17905
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
436 call VerifyScreenDump(buf, 'Test_popupwin_firstline_1', {}) |
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
437 |
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
438 call term_sendkeys(buf, ":call popup_setoptions(winid, #{firstline: -1})\<CR>") |
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
439 call term_sendkeys(buf, ":\<CR>") |
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
440 call VerifyScreenDump(buf, 'Test_popupwin_firstline_2', {}) |
17047
6400d1ad5e4b
patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
17045
diff
changeset
|
441 |
6400d1ad5e4b
patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
17045
diff
changeset
|
442 " 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
|
443 call StopVimInTerminal(buf) |
20386
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20375
diff
changeset
|
444 endfunc |
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20375
diff
changeset
|
445 |
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20375
diff
changeset
|
446 func Test_popup_firstline() |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
447 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
|
448 \ maxheight: 2, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
449 \ firstline: 3, |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
450 \ }) |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
451 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
|
452 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
|
453 call assert_equal(1, popup_getoptions(winid).firstline) |
17972
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17946
diff
changeset
|
454 eval winid->popup_close() |
17897
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
455 |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
456 let winid = popup_create(['xxx']->repeat(50), #{ |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
457 \ maxheight: 3, |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
458 \ firstline: 11, |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
459 \ }) |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
460 redraw |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
461 call assert_equal(11, popup_getoptions(winid).firstline) |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
462 call assert_equal(11, popup_getpos(winid).firstline) |
17942
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17934
diff
changeset
|
463 " check line() works with popup window |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17934
diff
changeset
|
464 call assert_equal(11, line('.', winid)) |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17934
diff
changeset
|
465 call assert_equal(50, line('$', winid)) |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17934
diff
changeset
|
466 call assert_equal(0, line('$', 123456)) |
17897
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
467 |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
468 " Normal command changes what is displayed but not "firstline" |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
469 call win_execute(winid, "normal! \<c-y>") |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
470 call assert_equal(11, popup_getoptions(winid).firstline) |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
471 call assert_equal(10, popup_getpos(winid).firstline) |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
472 |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
473 " Making some property change applies "firstline" again |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
474 call popup_setoptions(winid, #{line: 4}) |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
475 call assert_equal(11, popup_getoptions(winid).firstline) |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
476 call assert_equal(11, popup_getpos(winid).firstline) |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
477 |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
478 " Remove "firstline" property and scroll |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
479 call popup_setoptions(winid, #{firstline: 0}) |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
480 call win_execute(winid, "normal! \<c-y>") |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
481 call assert_equal(0, popup_getoptions(winid).firstline) |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
482 call assert_equal(10, popup_getpos(winid).firstline) |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
483 |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
484 " Making some property change has no side effect |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
485 call popup_setoptions(winid, #{line: 3}) |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
486 call assert_equal(0, popup_getoptions(winid).firstline) |
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
487 call assert_equal(10, popup_getpos(winid).firstline) |
20386
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20375
diff
changeset
|
488 call popup_close(winid) |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
489 |
18512
e855058e0c23
patch 8.1.2250: CTRL-U and CTRL-D don't work in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18494
diff
changeset
|
490 " CTRL-D scrolls down half a page |
e855058e0c23
patch 8.1.2250: CTRL-U and CTRL-D don't work in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18494
diff
changeset
|
491 let winid = popup_create(['xxx']->repeat(50), #{ |
e855058e0c23
patch 8.1.2250: CTRL-U and CTRL-D don't work in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18494
diff
changeset
|
492 \ maxheight: 8, |
e855058e0c23
patch 8.1.2250: CTRL-U and CTRL-D don't work in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18494
diff
changeset
|
493 \ }) |
e855058e0c23
patch 8.1.2250: CTRL-U and CTRL-D don't work in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18494
diff
changeset
|
494 redraw |
e855058e0c23
patch 8.1.2250: CTRL-U and CTRL-D don't work in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18494
diff
changeset
|
495 call assert_equal(1, popup_getpos(winid).firstline) |
e855058e0c23
patch 8.1.2250: CTRL-U and CTRL-D don't work in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18494
diff
changeset
|
496 call win_execute(winid, "normal! \<C-D>") |
e855058e0c23
patch 8.1.2250: CTRL-U and CTRL-D don't work in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18494
diff
changeset
|
497 call assert_equal(5, popup_getpos(winid).firstline) |
e855058e0c23
patch 8.1.2250: CTRL-U and CTRL-D don't work in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18494
diff
changeset
|
498 call win_execute(winid, "normal! \<C-D>") |
e855058e0c23
patch 8.1.2250: CTRL-U and CTRL-D don't work in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18494
diff
changeset
|
499 call assert_equal(9, popup_getpos(winid).firstline) |
e855058e0c23
patch 8.1.2250: CTRL-U and CTRL-D don't work in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18494
diff
changeset
|
500 call win_execute(winid, "normal! \<C-U>") |
e855058e0c23
patch 8.1.2250: CTRL-U and CTRL-D don't work in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18494
diff
changeset
|
501 call assert_equal(5, popup_getpos(winid).firstline) |
e855058e0c23
patch 8.1.2250: CTRL-U and CTRL-D don't work in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18494
diff
changeset
|
502 |
e855058e0c23
patch 8.1.2250: CTRL-U and CTRL-D don't work in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18494
diff
changeset
|
503 call win_execute(winid, "normal! \<C-F>") |
e855058e0c23
patch 8.1.2250: CTRL-U and CTRL-D don't work in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18494
diff
changeset
|
504 call assert_equal(11, popup_getpos(winid).firstline) |
e855058e0c23
patch 8.1.2250: CTRL-U and CTRL-D don't work in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18494
diff
changeset
|
505 call win_execute(winid, "normal! \<C-B>") |
e855058e0c23
patch 8.1.2250: CTRL-U and CTRL-D don't work in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18494
diff
changeset
|
506 call assert_equal(5, popup_getpos(winid).firstline) |
e855058e0c23
patch 8.1.2250: CTRL-U and CTRL-D don't work in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18494
diff
changeset
|
507 |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
508 call popup_close(winid) |
28550
f59db757e4ef
patch 8.2.4799: popup does not use correct topline
Bram Moolenaar <Bram@vim.org>
parents:
28319
diff
changeset
|
509 |
f59db757e4ef
patch 8.2.4799: popup does not use correct topline
Bram Moolenaar <Bram@vim.org>
parents:
28319
diff
changeset
|
510 " Popup with less elements than the maximum height and negative firstline: |
f59db757e4ef
patch 8.2.4799: popup does not use correct topline
Bram Moolenaar <Bram@vim.org>
parents:
28319
diff
changeset
|
511 " check that the popup height is correctly computed. |
f59db757e4ef
patch 8.2.4799: popup does not use correct topline
Bram Moolenaar <Bram@vim.org>
parents:
28319
diff
changeset
|
512 let winid = popup_create(['xxx']->repeat(4), #{ |
f59db757e4ef
patch 8.2.4799: popup does not use correct topline
Bram Moolenaar <Bram@vim.org>
parents:
28319
diff
changeset
|
513 \ firstline: -1, |
f59db757e4ef
patch 8.2.4799: popup does not use correct topline
Bram Moolenaar <Bram@vim.org>
parents:
28319
diff
changeset
|
514 \ maxheight: 6, |
f59db757e4ef
patch 8.2.4799: popup does not use correct topline
Bram Moolenaar <Bram@vim.org>
parents:
28319
diff
changeset
|
515 \ }) |
f59db757e4ef
patch 8.2.4799: popup does not use correct topline
Bram Moolenaar <Bram@vim.org>
parents:
28319
diff
changeset
|
516 |
f59db757e4ef
patch 8.2.4799: popup does not use correct topline
Bram Moolenaar <Bram@vim.org>
parents:
28319
diff
changeset
|
517 let pos = popup_getpos(winid) |
f59db757e4ef
patch 8.2.4799: popup does not use correct topline
Bram Moolenaar <Bram@vim.org>
parents:
28319
diff
changeset
|
518 call assert_equal(3, pos.width) |
f59db757e4ef
patch 8.2.4799: popup does not use correct topline
Bram Moolenaar <Bram@vim.org>
parents:
28319
diff
changeset
|
519 call assert_equal(4, pos.height) |
f59db757e4ef
patch 8.2.4799: popup does not use correct topline
Bram Moolenaar <Bram@vim.org>
parents:
28319
diff
changeset
|
520 |
f59db757e4ef
patch 8.2.4799: popup does not use correct topline
Bram Moolenaar <Bram@vim.org>
parents:
28319
diff
changeset
|
521 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
|
522 endfunc |
6400d1ad5e4b
patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
17045
diff
changeset
|
523 |
22357
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
524 func Test_popup_firstline_cursorline() |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
525 let winid = popup_create(['1111', '222222', '33333', '44444'], #{ |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
526 \ maxheight: 2, |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
527 \ firstline: 3, |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
528 \ cursorline: 1, |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
529 \ }) |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
530 call assert_equal(3, popup_getoptions(winid).firstline) |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
531 call assert_equal(3, getwininfo(winid)[0].topline) |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
532 call assert_equal(3, getcurpos(winid)[1]) |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
533 |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
534 call popup_close(winid) |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
535 endfunc |
0e231e8e70f8
patch 8.2.1727: a popup created with "cursorline" will ignore "firstline"
Bram Moolenaar <Bram@vim.org>
parents:
22174
diff
changeset
|
536 |
17926
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
537 func Test_popup_noscrolloff() |
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
538 set scrolloff=5 |
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
539 let winid = popup_create(['xxx']->repeat(50), #{ |
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
540 \ maxheight: 5, |
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
541 \ firstline: 11, |
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
542 \ }) |
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
543 redraw |
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
544 call assert_equal(11, popup_getoptions(winid).firstline) |
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
545 call assert_equal(11, popup_getpos(winid).firstline) |
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
546 |
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
547 call popup_setoptions(winid, #{firstline: 0}) |
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
548 call win_execute(winid, "normal! \<c-y>") |
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
549 call assert_equal(0, popup_getoptions(winid).firstline) |
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
550 call assert_equal(10, popup_getpos(winid).firstline) |
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
551 |
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
552 call popup_close(winid) |
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
553 endfunc |
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
554 |
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
|
555 func Test_popup_drag() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
556 CheckScreendump |
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
557 |
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
|
558 " 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
|
559 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
|
560 call setline(1, range(1, 20)) |
17841
9513821d9d8f
patch 8.1.1917: non-current window is not redrawn when moving popup
Bram Moolenaar <Bram@vim.org>
parents:
17825
diff
changeset
|
561 split |
9513821d9d8f
patch 8.1.1917: non-current window is not redrawn when moving popup
Bram Moolenaar <Bram@vim.org>
parents:
17825
diff
changeset
|
562 vsplit |
9513821d9d8f
patch 8.1.1917: non-current window is not redrawn when moving popup
Bram Moolenaar <Bram@vim.org>
parents:
17825
diff
changeset
|
563 $wincmd w |
9513821d9d8f
patch 8.1.1917: non-current window is not redrawn when moving popup
Bram Moolenaar <Bram@vim.org>
parents:
17825
diff
changeset
|
564 vsplit |
9513821d9d8f
patch 8.1.1917: non-current window is not redrawn when moving popup
Bram Moolenaar <Bram@vim.org>
parents:
17825
diff
changeset
|
565 1wincmd w |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
566 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
|
567 \ drag: 1, |
17580
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17551
diff
changeset
|
568 \ resize: 1, |
17368
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
569 \ border: [], |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
570 \ 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
|
571 \ }) |
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
|
572 func Dragit() |
26332
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
573 map <silent> <F3> :call test_setmouse(&lines - 4, &columns / 2)<CR> |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
574 map <silent> <F4> :call test_setmouse(&lines - 8, &columns / 2 - 20)<CR> |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
575 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
|
576 endfunc |
17580
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17551
diff
changeset
|
577 func Resize() |
26332
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
578 map <silent> <F5> :call test_setmouse(6, 21)<CR> |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
579 map <silent> <F6> :call test_setmouse(7, 25)<CR> |
17580
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17551
diff
changeset
|
580 call feedkeys("\<F5>\<LeftMouse>\<F6>\<LeftDrag>\<LeftRelease>", "xt") |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17551
diff
changeset
|
581 endfunc |
26300
0374f55a16be
patch 8.2.3681: cannot drag popup window after click on a status line
Bram Moolenaar <Bram@vim.org>
parents:
26165
diff
changeset
|
582 func ClickAndDrag() |
26332
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
583 map <silent> <F3> :call test_setmouse(5, 2)<CR> |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
584 map <silent> <F4> :call test_setmouse(3, 14)<CR> |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
585 map <silent> <F5> :call test_setmouse(3, 18)<CR> |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
586 call feedkeys("\<F3>\<LeftMouse>\<LeftRelease>", "xt") |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
587 call feedkeys("\<F4>\<LeftMouse>\<F5>\<LeftDrag>\<LeftRelease>", "xt") |
26300
0374f55a16be
patch 8.2.3681: cannot drag popup window after click on a status line
Bram Moolenaar <Bram@vim.org>
parents:
26165
diff
changeset
|
588 endfunc |
26332
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
589 func DragAllStart() |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
590 call popup_clear() |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
591 call popup_create('hello', #{line: 3, col: 5, dragall: 1}) |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
592 endfunc |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
593 func DragAllDrag() |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
594 map <silent> <F3> :call test_setmouse(3, 5)<CR> |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
595 map <silent> <F4> :call test_setmouse(5, 36)<CR> |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
596 call feedkeys("\<F3>\<LeftMouse>\<F4>\<LeftDrag>\<LeftRelease>", "xt") |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
597 endfunc |
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
|
598 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
599 call writefile(lines, 'XtestPopupDrag', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
600 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
|
601 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
|
602 |
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
|
603 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
|
604 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
|
605 |
17580
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17551
diff
changeset
|
606 call term_sendkeys(buf, ":call Resize()\<CR>") |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17551
diff
changeset
|
607 call VerifyScreenDump(buf, 'Test_popupwin_drag_03', {}) |
d5e5d0fc3fa8
patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17551
diff
changeset
|
608 |
26300
0374f55a16be
patch 8.2.3681: cannot drag popup window after click on a status line
Bram Moolenaar <Bram@vim.org>
parents:
26165
diff
changeset
|
609 " dragging works after click on a status line |
0374f55a16be
patch 8.2.3681: cannot drag popup window after click on a status line
Bram Moolenaar <Bram@vim.org>
parents:
26165
diff
changeset
|
610 call term_sendkeys(buf, ":call ClickAndDrag()\<CR>") |
0374f55a16be
patch 8.2.3681: cannot drag popup window after click on a status line
Bram Moolenaar <Bram@vim.org>
parents:
26165
diff
changeset
|
611 call VerifyScreenDump(buf, 'Test_popupwin_drag_04', {}) |
0374f55a16be
patch 8.2.3681: cannot drag popup window after click on a status line
Bram Moolenaar <Bram@vim.org>
parents:
26165
diff
changeset
|
612 |
26332
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
613 " dragging without border |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
614 call term_sendkeys(buf, ":call DragAllStart()\<CR>") |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
615 call VerifyScreenDump(buf, 'Test_popupwin_drag_05', {}) |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
616 call term_sendkeys(buf, ":call DragAllDrag()\<CR>") |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
617 call VerifyScreenDump(buf, 'Test_popupwin_drag_06', {}) |
8b7f01b39d79
patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
26300
diff
changeset
|
618 |
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
|
619 " 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
|
620 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
|
621 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
|
622 |
28279
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
623 func Test_popup_drag_minwidth() |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
624 CheckScreendump |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
625 |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
626 " create a popup that does not fit |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
627 let lines =<< trim END |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
628 call range(40) |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
629 \ ->map({_,i -> string(i)}) |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
630 \ ->popup_create({ |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
631 \ 'drag': 1, |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
632 \ 'wrap': 0, |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
633 \ 'border': [], |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
634 \ 'scrollbar': 1, |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
635 \ 'minwidth': 100, |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
636 \ 'filter': {w, k -> k ==# 'q' ? len([popup_close(w)]) : 0}, |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
637 \ }) |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
638 func DragitDown() |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
639 map <silent> <F3> :call test_setmouse(1, 10)<CR> |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
640 map <silent> <F4> :call test_setmouse(5, 40)<CR> |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
641 call feedkeys("\<F3>\<LeftMouse>\<F4>\<LeftDrag>\<LeftRelease>", "xt") |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
642 endfunc |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
643 func DragitUp() |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
644 map <silent> <F3> :call test_setmouse(5, 40)<CR> |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
645 map <silent> <F4> :call test_setmouse(4, 40)<CR> |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
646 map <silent> <F5> :call test_setmouse(3, 40)<CR> |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
647 call feedkeys("\<F3>\<LeftMouse>\<F4>\<LeftDrag>\<F5>\<LeftDrag>\<LeftRelease>", "xt") |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
648 endfunc |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
649 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
650 call writefile(lines, 'XtestPopupDrag', 'D') |
28279
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
651 let buf = RunVimInTerminal('-S XtestPopupDrag', #{rows: 10}) |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
652 call VerifyScreenDump(buf, 'Test_popupwin_drag_minwidth_1', {}) |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
653 |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
654 call term_sendkeys(buf, ":call DragitDown()\<CR>") |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
655 call VerifyScreenDump(buf, 'Test_popupwin_drag_minwidth_2', {}) |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
656 |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
657 call term_sendkeys(buf, ":call DragitUp()\<CR>") |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
658 call VerifyScreenDump(buf, 'Test_popupwin_drag_minwidth_3', {}) |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
659 |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
660 call term_sendkeys(buf, 'q') |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
661 |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
662 " clean up |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
663 call StopVimInTerminal(buf) |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
664 endfunc |
8ef5c996df31
patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly
Bram Moolenaar <Bram@vim.org>
parents:
27464
diff
changeset
|
665 |
21285
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
666 func Test_popup_drag_termwin() |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
667 CheckUnix |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
668 CheckScreendump |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
669 CheckFeature terminal |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
670 |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
671 " create a popup that covers the terminal window |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
672 let lines =<< trim END |
21339
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
673 set foldmethod=marker |
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
674 call setline(1, range(100)) |
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
675 for nr in range(7) |
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
676 call setline(nr * 12 + 1, "fold {{{") |
21552
cbc570e66d11
patch 8.2.1326: Vim9: skipping over white space after list
Bram Moolenaar <Bram@vim.org>
parents:
21514
diff
changeset
|
677 call setline(nr * 12 + 11, "end }}}") |
21339
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
678 endfor |
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
679 %foldclose |
21285
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
680 set shell=/bin/sh noruler |
22967
47a5349168ea
patch 8.2.2030: some tests fail on Mac
Bram Moolenaar <Bram@vim.org>
parents:
22884
diff
changeset
|
681 unlet $PROMPT_COMMAND |
21287
3fd32bf5fff0
patch 8.2.1194: test failure because shell prompt differs
Bram Moolenaar <Bram@vim.org>
parents:
21285
diff
changeset
|
682 let $PS1 = 'vim> ' |
21339
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
683 terminal ++rows=4 |
21285
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
684 $wincmd w |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
685 let winid = popup_create(['1111', '2222'], #{ |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
686 \ drag: 1, |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
687 \ resize: 1, |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
688 \ border: [], |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
689 \ line: 3, |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
690 \ }) |
21339
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
691 func DragitLeft() |
21285
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
692 call feedkeys("\<F3>\<LeftMouse>\<F4>\<LeftDrag>\<LeftRelease>", "xt") |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
693 endfunc |
21339
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
694 func DragitDown() |
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
695 call feedkeys("\<F4>\<LeftMouse>\<F5>\<LeftDrag>\<LeftRelease>", "xt") |
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
696 endfunc |
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
697 func DragitDownLeft() |
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
698 call feedkeys("\<F5>\<LeftMouse>\<F6>\<LeftDrag>\<LeftRelease>", "xt") |
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
699 endfunc |
21285
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
700 map <silent> <F3> :call test_setmouse(3, &columns / 2)<CR> |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
701 map <silent> <F4> :call test_setmouse(3, &columns / 2 - 20)<CR> |
21339
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
702 map <silent> <F5> :call test_setmouse(12, &columns / 2)<CR> |
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
703 map <silent> <F6> :call test_setmouse(12, &columns / 2 - 20)<CR> |
21285
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
704 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
705 call writefile(lines, 'XtestPopupTerm', 'D') |
21339
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
706 let buf = RunVimInTerminal('-S XtestPopupTerm', #{rows: 16}) |
21285
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
707 call VerifyScreenDump(buf, 'Test_popupwin_term_01', {}) |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
708 |
21339
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
709 call term_sendkeys(buf, ":call DragitLeft()\<CR>") |
21285
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
710 call VerifyScreenDump(buf, 'Test_popupwin_term_02', {}) |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
711 |
21339
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
712 call term_sendkeys(buf, ":call DragitDown()\<CR>") |
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
713 call VerifyScreenDump(buf, 'Test_popupwin_term_03', {}) |
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
714 |
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
715 call term_sendkeys(buf, ":call DragitDownLeft()\<CR>") |
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
716 call VerifyScreenDump(buf, 'Test_popupwin_term_04', {}) |
608f674c6035
patch 8.2.1220: memory access error when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21287
diff
changeset
|
717 |
21285
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
718 " clean up |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
719 call StopVimInTerminal(buf) |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
720 endfunc |
35a7cab0bdfd
patch 8.2.1193: terminal window not redrawn when dragging a popup window
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
721 |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
722 func Test_popup_close_with_mouse() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
723 CheckScreendump |
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
724 |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
725 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
|
726 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
|
727 " 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
|
728 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
|
729 \ close: 'button', |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
730 \ border: [], |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
731 \ line: 1, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
732 \ 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
|
733 \ }) |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
734 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
|
735 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
|
736 endfunc |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
737 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
|
738 \ close: 'click', |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
739 \ line: 3, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
740 \ col: 15, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
741 \ 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
|
742 \ }) |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
743 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
|
744 \ close: 'button', |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
745 \ line: 5, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
746 \ 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
|
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('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
|
749 \ close: 'button', |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
750 \ padding: [], |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
751 \ line: 5, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
752 \ 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
|
753 \ }) |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
754 func CloseWithX() |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
755 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
|
756 endfunc |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
757 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
|
758 func CloseWithClick() |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
759 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
|
760 endfunc |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
761 map <silent> <F4> :call test_setmouse(3, 17)<CR> |
17847
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
762 func CreateWithMenuFilter() |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
763 let winid = popup_create('barfoo', #{ |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
764 \ close: 'button', |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
765 \ filter: 'popup_filter_menu', |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
766 \ border: [], |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
767 \ line: 1, |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
768 \ col: 40, |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
769 \ }) |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
770 endfunc |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
771 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
772 call writefile(lines, 'XtestPopupClose', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
773 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
|
774 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
|
775 |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
776 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
|
777 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
|
778 |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
779 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
|
780 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
|
781 |
17847
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
782 call term_sendkeys(buf, ":call CreateWithMenuFilter()\<CR>") |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
783 call VerifyScreenDump(buf, 'Test_popupwin_close_04', {}) |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
784 |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
785 " We have to send the actual mouse code, feedkeys() would be caught the |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
786 " filter. |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
787 call term_sendkeys(buf, "\<Esc>[<0;47;1M") |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
788 call VerifyScreenDump(buf, 'Test_popupwin_close_05', {}) |
bdddd215bf09
patch 8.1.1920: cannot always close a popup when filter consumes all events
Bram Moolenaar <Bram@vim.org>
parents:
17845
diff
changeset
|
789 |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
790 " clean up |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
791 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
|
792 endfunction |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
793 |
18339
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
794 func Test_popup_menu_wrap() |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
795 CheckScreendump |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
796 |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
797 let lines =<< trim END |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
798 call setline(1, range(1, 20)) |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
799 call popup_create([ |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
800 \ 'one', |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
801 \ 'asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfas', |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
802 \ 'three', |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
803 \ 'four', |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
804 \ ], #{ |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
805 \ pos: "botleft", |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
806 \ border: [], |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
807 \ padding: [0,1,0,1], |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
808 \ maxheight: 3, |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
809 \ cursorline: 1, |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
810 \ filter: 'popup_filter_menu', |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
811 \ }) |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
812 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
813 call writefile(lines, 'XtestPopupWrap', 'D') |
18339
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
814 let buf = RunVimInTerminal('-S XtestPopupWrap', #{rows: 10}) |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
815 call VerifyScreenDump(buf, 'Test_popupwin_wrap_1', {}) |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
816 |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
817 call term_sendkeys(buf, "jj") |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
818 call VerifyScreenDump(buf, 'Test_popupwin_wrap_2', {}) |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
819 |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
820 " clean up |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
821 call term_sendkeys(buf, "\<Esc>") |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
822 call StopVimInTerminal(buf) |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
823 endfunction |
a776385eac9f
patch 8.1.2164: stuck when using "j" in a popupwin with popup_filter_menu
Bram Moolenaar <Bram@vim.org>
parents:
18231
diff
changeset
|
824 |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
825 func Test_popup_with_mask() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
826 CheckScreendump |
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
827 |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
828 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
|
829 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
|
830 hi PopupColor ctermbg=lightgrey |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
831 let winid = popup_create([ |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
832 \ 'some text', |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
833 \ '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
|
834 \], #{ |
17368
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
835 \ line: 1, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
836 \ col: 10, |
18542
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
837 \ posinvert: 0, |
17368
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
838 \ wrap: 0, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
839 \ fixed: 1, |
21729
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
840 \ scrollbar: v:false, |
17368
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
841 \ zindex: 90, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
842 \ padding: [], |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
843 \ highlight: 'PopupColor', |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
844 \ 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
|
845 call popup_create([ |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
846 \ 'xxxxxxxxx', |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
847 \ 'yyyyyyyyy', |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
848 \], #{ |
17368
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
849 \ line: 3, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
850 \ col: 18, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
851 \ 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
|
852 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
|
853 \ '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
|
854 \], #{ |
17368
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
855 \ line: 7, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
856 \ col: 10, |
18542
244b336b94ce
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Bram Moolenaar <Bram@vim.org>
parents:
18512
diff
changeset
|
857 \ posinvert: 0, |
17368
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
858 \ wrap: 0, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
859 \ fixed: 1, |
21729
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
860 \ scrollbar: v:false, |
17368
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
861 \ close: 'button', |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
862 \ zindex: 90, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
863 \ padding: [], |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
864 \ border: [], |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
865 \ 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
|
866 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
867 call writefile(lines, 'XtestPopupMask', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
868 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
|
869 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
|
870 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
871 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
|
872 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
|
873 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
|
874 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
|
875 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
876 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
|
877 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
|
878 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
|
879 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
|
880 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
881 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
|
882 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
|
883 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
|
884 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
|
885 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
886 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
|
887 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
|
888 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
|
889 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
|
890 |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
891 " clean up |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
892 call StopVimInTerminal(buf) |
23400
5cc8108914e2
patch 8.2.2243: crash when popup mask contains zeroes
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
893 |
5cc8108914e2
patch 8.2.2243: crash when popup mask contains zeroes
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
894 " this was causing a crash |
5cc8108914e2
patch 8.2.2243: crash when popup mask contains zeroes
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
895 call popup_create('test', #{mask: [[0, 0, 0, 0]]}) |
5cc8108914e2
patch 8.2.2243: crash when popup mask contains zeroes
Bram Moolenaar <Bram@vim.org>
parents:
23229
diff
changeset
|
896 call popup_clear() |
23936
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
897 |
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
898 " this was causing an internal error |
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
899 enew |
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
900 set nowrap |
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
901 call repeat('x', &columns)->setline(1) |
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
902 call prop_type_add('textprop', {}) |
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
903 call prop_add(1, 1, #{length: &columns, type: 'textprop'}) |
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
904 vsplit |
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
905 let opts = popup_create('', #{textprop: 'textprop'}) |
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
906 \ ->popup_getoptions() |
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
907 \ ->extend(#{mask: [[1, 1, 1, 1]]}) |
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
908 call popup_create('', opts) |
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
909 redraw |
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
910 |
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
911 close! |
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
912 bwipe! |
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
913 call prop_type_delete('textprop') |
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
914 call popup_clear() |
a0e02766e06d
patch 8.2.2510: internal error when popup with mask is zero height or width
Bram Moolenaar <Bram@vim.org>
parents:
23897
diff
changeset
|
915 set wrap& |
17172
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
916 endfunc |
6990c1160ea5
patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents:
17151
diff
changeset
|
917 |
17069
76ae212a9075
patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents:
17055
diff
changeset
|
918 func Test_popup_select() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
919 CheckScreendump |
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
920 CheckFeature clipboard_working |
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
921 |
17069
76ae212a9075
patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents:
17055
diff
changeset
|
922 " 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
|
923 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
|
924 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
|
925 call setline(1, range(1, 20)) |
17754
65b89c9eb946
patch 8.1.1874: modeless selection in popup window overlaps scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17718
diff
changeset
|
926 let winid = popup_create(['the word', 'some more', 'several words here', 'invisible', '5', '6', '7'], #{ |
17368
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
927 \ drag: 1, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
928 \ border: [], |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
929 \ line: 3, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
930 \ col: 10, |
17754
65b89c9eb946
patch 8.1.1874: modeless selection in popup window overlaps scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17718
diff
changeset
|
931 \ maxheight: 3, |
17069
76ae212a9075
patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents:
17055
diff
changeset
|
932 \ }) |
76ae212a9075
patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents:
17055
diff
changeset
|
933 func Select1() |
76ae212a9075
patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents:
17055
diff
changeset
|
934 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
|
935 endfunc |
76ae212a9075
patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents:
17055
diff
changeset
|
936 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
|
937 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
|
938 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
939 call writefile(lines, 'XtestPopupSelect', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
940 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
|
941 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
|
942 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
|
943 |
76ae212a9075
patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents:
17055
diff
changeset
|
944 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
|
945 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
|
946 " 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
|
947 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
|
948 |
17069
76ae212a9075
patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents:
17055
diff
changeset
|
949 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
|
950 |
76ae212a9075
patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents:
17055
diff
changeset
|
951 " clean up |
76ae212a9075
patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents:
17055
diff
changeset
|
952 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
|
953 endfunc |
76ae212a9075
patch 8.1.1534: modeless selection in popup window selects too much
Bram Moolenaar <Bram@vim.org>
parents:
17055
diff
changeset
|
954 |
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
|
955 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
|
956 " 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
|
957 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
|
958 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
|
959 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
|
960 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
|
961 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
|
962 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
|
963 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
|
964 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
|
965 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
|
966 |
d99805d25b42
patch 8.1.1521: when a popup window is closed the buffer remains
Bram Moolenaar <Bram@vim.org>
parents:
17037
diff
changeset
|
967 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
|
968 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
|
969 " 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
|
970 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
|
971 |
23645f9a5ce2
patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents:
16898
diff
changeset
|
972 " 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
|
973 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
|
974 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
|
975 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
|
976 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
|
977 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
|
978 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
|
979 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
|
980 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
|
981 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
|
982 |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
983 " 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
|
984 tabnew |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
985 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
|
986 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
|
987 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
|
988 quit |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17125
diff
changeset
|
989 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
|
990 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
|
991 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
|
992 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
|
993 |
23645f9a5ce2
patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents:
16898
diff
changeset
|
994 func Test_popup_valid_arguments() |
20386
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20375
diff
changeset
|
995 call assert_equal(0, len(popup_list())) |
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20375
diff
changeset
|
996 |
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
|
997 " 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
|
998 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
|
999 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
|
1000 call assert_inrange(&columns / 2 - 1, &columns / 2 + 1, pos.col) |
20386
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20375
diff
changeset
|
1001 call assert_equal([winid], popup_list()) |
17026
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
17022
diff
changeset
|
1002 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
|
1003 |
23645f9a5ce2
patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents:
16898
diff
changeset
|
1004 " 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
|
1005 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
|
1006 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
|
1007 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
|
1008 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
|
1009 |
23645f9a5ce2
patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents:
16898
diff
changeset
|
1010 " center |
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("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
|
1012 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
|
1013 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
|
1014 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
|
1015 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
|
1016 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
|
1017 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
|
1018 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
|
1019 |
23645f9a5ce2
patch 8.1.1452: line and col property of popup windows not properly checked
Bram Moolenaar <Bram@vim.org>
parents:
16898
diff
changeset
|
1020 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
|
1021 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
|
1022 call popup_clear() |
29994
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29046
diff
changeset
|
1023 call assert_fails('call popup_create("text", "none")', 'E1206:') |
17026
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
17022
diff
changeset
|
1024 call popup_clear() |
20120
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
1025 call assert_fails('call popup_create(test_null_string(), {})', 'E450:') |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
1026 call assert_fails('call popup_create(test_null_list(), {})', 'E450:') |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
1027 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
|
1028 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
1029 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
|
1030 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
|
1031 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
|
1032 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
|
1033 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
|
1034 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
|
1035 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
|
1036 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
|
1037 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
1038 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
|
1039 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
|
1040 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
|
1041 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
|
1042 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
|
1043 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
|
1044 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
|
1045 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
|
1046 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
1047 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
|
1048 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
|
1049 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
|
1050 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
|
1051 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
|
1052 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
|
1053 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
|
1054 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
|
1055 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
|
1056 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
|
1057 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
|
1058 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
|
1059 |
29034
f3c014fe5c16
patch 8.2.5039: confusing error if first argument of popup_create() is wrong
Bram Moolenaar <Bram@vim.org>
parents:
29032
diff
changeset
|
1060 call assert_fails('call popup_create([#{text: "text"}, 666], {})', 'E1284: Argument 1, list item 2: Dictionary required') |
17026
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
17022
diff
changeset
|
1061 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
|
1062 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
|
1063 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
|
1064 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
|
1065 call popup_clear() |
19241
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
1066 call assert_fails('call popup_create([#{text: "text", props: range(3)}], {})', 'E715:') |
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
1067 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
|
1068 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
|
1069 call popup_clear() |
19241
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
1070 call assert_fails('call popup_create("text", #{mask: range(5)})', 'E475:') |
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
1071 call popup_clear() |
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
1072 call popup_create("text", #{mask: [range(4)]}) |
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
1073 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
|
1074 call assert_fails('call popup_create("text", #{mask: test_null_list()})', 'E475:') |
17604
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
1075 call assert_fails('call popup_create("text", #{mapping: []})', 'E745:') |
17417
aa4532c1d001
patch 8.1.1707: Coverity warns for possibly using a NULL pointer
Bram Moolenaar <Bram@vim.org>
parents:
17413
diff
changeset
|
1076 call popup_clear() |
20120
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
1077 call assert_fails('call popup_create("text", #{tabpage : 4})', 'E997:') |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
1078 call popup_clear() |
29034
f3c014fe5c16
patch 8.2.5039: confusing error if first argument of popup_create() is wrong
Bram Moolenaar <Bram@vim.org>
parents:
29032
diff
changeset
|
1079 |
f3c014fe5c16
patch 8.2.5039: confusing error if first argument of popup_create() is wrong
Bram Moolenaar <Bram@vim.org>
parents:
29032
diff
changeset
|
1080 call assert_fails('call popup_create(range(10), {})', 'E1024:') |
f3c014fe5c16
patch 8.2.5039: confusing error if first argument of popup_create() is wrong
Bram Moolenaar <Bram@vim.org>
parents:
29032
diff
changeset
|
1081 call popup_clear() |
f3c014fe5c16
patch 8.2.5039: confusing error if first argument of popup_create() is wrong
Bram Moolenaar <Bram@vim.org>
parents:
29032
diff
changeset
|
1082 call assert_fails('call popup_create([1, 2], {})', 'E1284: Argument 1, list item 1: Dictionary required') |
f3c014fe5c16
patch 8.2.5039: confusing error if first argument of popup_create() is wrong
Bram Moolenaar <Bram@vim.org>
parents:
29032
diff
changeset
|
1083 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
|
1084 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
|
1085 |
16863
2b00163053cd
patch 8.1.1433: win_execute() may leave popup window focused
Bram Moolenaar <Bram@vim.org>
parents:
16859
diff
changeset
|
1086 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
|
1087 split |
2b00163053cd
patch 8.1.1433: win_execute() may leave popup window focused
Bram Moolenaar <Bram@vim.org>
parents:
16859
diff
changeset
|
1088 let winid = popup_create('some text', {}) |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
22063
diff
changeset
|
1089 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
|
1090 call popup_clear() |
18868
5fbb167591fc
patch 8.1.2420: crash when calling popup_close() in win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
18864
diff
changeset
|
1091 |
5fbb167591fc
patch 8.1.2420: crash when calling popup_close() in win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
18864
diff
changeset
|
1092 let winid = popup_create('some text', {}) |
22087
ff21e2962490
patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents:
22063
diff
changeset
|
1093 call assert_fails('call win_execute(winid, printf("normal! :\<C-u>call popup_close(%d)\<CR>", winid))', 'E994:') |
18868
5fbb167591fc
patch 8.1.2420: crash when calling popup_close() in win_execute()
Bram Moolenaar <Bram@vim.org>
parents:
18864
diff
changeset
|
1094 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
|
1095 endfunc |
da5f5836e90c
patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
16863
diff
changeset
|
1096 |
da5f5836e90c
patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
16863
diff
changeset
|
1097 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
|
1098 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
|
1099 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
|
1100 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
|
1101 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
|
1102 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
|
1103 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
|
1104 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
|
1105 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
|
1106 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
|
1107 call assert_fails('call win_execute(winid, "rewind")', 'E994:') |
19621
0d677257e35d
patch 8.2.0367: can use :pedit in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19605
diff
changeset
|
1108 call assert_fails('call win_execute(winid, "pedit filename")', 'E994:') |
16874
da5f5836e90c
patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
16863
diff
changeset
|
1109 call assert_fails('call win_execute(winid, "buf")', 'E994:') |
19135
17722555af22
patch 8.2.0127: some buffer commands work in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19117
diff
changeset
|
1110 call assert_fails('call win_execute(winid, "bnext")', 'E994:') |
17722555af22
patch 8.2.0127: some buffer commands work in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19117
diff
changeset
|
1111 call assert_fails('call win_execute(winid, "bprev")', 'E994:') |
17722555af22
patch 8.2.0127: some buffer commands work in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19117
diff
changeset
|
1112 call assert_fails('call win_execute(winid, "bfirst")', 'E994:') |
17722555af22
patch 8.2.0127: some buffer commands work in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19117
diff
changeset
|
1113 call assert_fails('call win_execute(winid, "blast")', 'E994:') |
16874
da5f5836e90c
patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
16863
diff
changeset
|
1114 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
|
1115 call assert_fails('call win_execute(winid, "enew")', 'E994:') |
21020
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20974
diff
changeset
|
1116 call assert_fails('call win_execute(winid, "help")', 'E994:') |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20974
diff
changeset
|
1117 call assert_fails('call win_execute(winid, "1only")', 'E994:') |
16874
da5f5836e90c
patch 8.1.1438: some commands cause trouble in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
16863
diff
changeset
|
1118 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
|
1119 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
|
1120 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
|
1121 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
|
1122 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
|
1123 endfunc |
2b00163053cd
patch 8.1.1433: win_execute() may leave popup window focused
Bram Moolenaar <Bram@vim.org>
parents:
16859
diff
changeset
|
1124 |
16857
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1125 func Test_popup_with_wrap() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
1126 CheckScreendump |
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
1127 |
16857
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1128 let lines =<< trim END |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1129 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
|
1130 let winid = popup_create( |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1131 \ '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
|
1132 \ #{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
|
1133 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
1134 call writefile(lines, 'XtestPopup', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
1135 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
|
1136 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
|
1137 |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1138 " clean up |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1139 call StopVimInTerminal(buf) |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1140 endfunc |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1141 |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1142 func Test_popup_without_wrap() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
1143 CheckScreendump |
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
1144 |
16857
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1145 let lines =<< trim END |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1146 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
|
1147 let winid = popup_create( |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1148 \ '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
|
1149 \ #{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
|
1150 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
1151 call writefile(lines, 'XtestPopup', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
1152 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
|
1153 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
|
1154 |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1155 " clean up |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1156 call StopVimInTerminal(buf) |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1157 endfunc |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1158 |
17442
57b9fca8c7d2
patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents:
17438
diff
changeset
|
1159 func Test_popup_with_showbreak() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
1160 CheckScreendump |
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
1161 |
17442
57b9fca8c7d2
patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents:
17438
diff
changeset
|
1162 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
|
1163 set showbreak=>>\ |
57b9fca8c7d2
patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents:
17438
diff
changeset
|
1164 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
|
1165 let winid = popup_dialog( |
18088
687d08fee911
patch 8.1.2039: character from 'showbreak' does not use 'wincolor'
Bram Moolenaar <Bram@vim.org>
parents:
18070
diff
changeset
|
1166 \ 'a long line here that wraps', |
687d08fee911
patch 8.1.2039: character from 'showbreak' does not use 'wincolor'
Bram Moolenaar <Bram@vim.org>
parents:
18070
diff
changeset
|
1167 \ #{filter: 'popup_filter_yesno', |
687d08fee911
patch 8.1.2039: character from 'showbreak' does not use 'wincolor'
Bram Moolenaar <Bram@vim.org>
parents:
18070
diff
changeset
|
1168 \ maxwidth: 12}) |
17442
57b9fca8c7d2
patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents:
17438
diff
changeset
|
1169 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
1170 call writefile(lines, 'XtestPopupShowbreak', 'D') |
17442
57b9fca8c7d2
patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents:
17438
diff
changeset
|
1171 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
|
1172 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
|
1173 |
57b9fca8c7d2
patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents:
17438
diff
changeset
|
1174 " clean up |
57b9fca8c7d2
patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents:
17438
diff
changeset
|
1175 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
|
1176 call StopVimInTerminal(buf) |
57b9fca8c7d2
patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents:
17438
diff
changeset
|
1177 endfunc |
57b9fca8c7d2
patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents:
17438
diff
changeset
|
1178 |
16800
12e3a3afdb6a
patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents:
16794
diff
changeset
|
1179 func Test_popup_time() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
1180 CheckFeature timers |
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
1181 |
16800
12e3a3afdb6a
patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents:
16794
diff
changeset
|
1182 topleft vnew |
12e3a3afdb6a
patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents:
16794
diff
changeset
|
1183 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
|
1184 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
1185 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
|
1186 \ line: 1, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
1187 \ col: 1, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
1188 \ minwidth: 20, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
1189 \ time: 500, |
16800
12e3a3afdb6a
patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents:
16794
diff
changeset
|
1190 \}) |
12e3a3afdb6a
patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents:
16794
diff
changeset
|
1191 redraw |
12e3a3afdb6a
patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents:
16794
diff
changeset
|
1192 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
|
1193 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
|
1194 |
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
|
1195 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
|
1196 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
|
1197 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
|
1198 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
|
1199 |
31311
bda1452d81bc
patch 9.0.0989: popupwin test is more flaky on MacOS
Bram Moolenaar <Bram@vim.org>
parents:
31245
diff
changeset
|
1200 " Mac is usually a bit slow |
bda1452d81bc
patch 9.0.0989: popupwin test is more flaky on MacOS
Bram Moolenaar <Bram@vim.org>
parents:
31245
diff
changeset
|
1201 let delay = has('mac') ? '900m' : '700m' |
bda1452d81bc
patch 9.0.0989: popupwin test is more flaky on MacOS
Bram Moolenaar <Bram@vim.org>
parents:
31245
diff
changeset
|
1202 exe 'sleep ' .. delay |
16802
f5487021fdad
patch 8.1.1403: cannot build without the timer feature
Bram Moolenaar <Bram@vim.org>
parents:
16800
diff
changeset
|
1203 redraw |
31311
bda1452d81bc
patch 9.0.0989: popupwin test is more flaky on MacOS
Bram Moolenaar <Bram@vim.org>
parents:
31245
diff
changeset
|
1204 |
17994
0dcc2ee838dd
patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17972
diff
changeset
|
1205 let line = join(map(range(1, 5), '1->screenstring(v:val)'), '') |
16800
12e3a3afdb6a
patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents:
16794
diff
changeset
|
1206 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
|
1207 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
1208 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
|
1209 \ line: &lines, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
1210 \ col: 10, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
1211 \ minwidth: 20, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
1212 \ time: 500, |
16800
12e3a3afdb6a
patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents:
16794
diff
changeset
|
1213 \}) |
12e3a3afdb6a
patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents:
16794
diff
changeset
|
1214 redraw |
12e3a3afdb6a
patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents:
16794
diff
changeset
|
1215 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
|
1216 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
|
1217 |
31311
bda1452d81bc
patch 9.0.0989: popupwin test is more flaky on MacOS
Bram Moolenaar <Bram@vim.org>
parents:
31245
diff
changeset
|
1218 exe 'sleep ' .. delay |
16800
12e3a3afdb6a
patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents:
16794
diff
changeset
|
1219 redraw |
12e3a3afdb6a
patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents:
16794
diff
changeset
|
1220 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
|
1221 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
|
1222 |
12e3a3afdb6a
patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents:
16794
diff
changeset
|
1223 bwipe! |
12e3a3afdb6a
patch 8.1.1402: "timer" option of popup windows not supported
Bram Moolenaar <Bram@vim.org>
parents:
16794
diff
changeset
|
1224 endfunc |
16809
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
1225 |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
1226 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
|
1227 topleft vnew |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
1228 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
|
1229 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
1230 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
|
1231 \ line: 1, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
1232 \ col: 1, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
1233 \ 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
|
1234 \}) |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
1235 redraw |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
1236 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
|
1237 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
|
1238 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
|
1239 " 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
|
1240 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
|
1241 |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
1242 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
|
1243 redraw |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
1244 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
|
1245 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
|
1246 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
|
1247 " buffer is still listed but hidden |
19117
8db080710015
patch 8.2.0118: crash when cycling to buffers involving popup window
Bram Moolenaar <Bram@vim.org>
parents:
19071
diff
changeset
|
1248 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
|
1249 |
17972
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17946
diff
changeset
|
1250 eval winid->popup_show() |
16809
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
1251 redraw |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
1252 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
|
1253 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
|
1254 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
|
1255 |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
1256 |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
1257 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
|
1258 redraw |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
1259 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
|
1260 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
|
1261 |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
1262 " 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
|
1263 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
|
1264 |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
1265 " no error non-existing window |
17972
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17946
diff
changeset
|
1266 eval 1234234->popup_hide() |
16809
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
1267 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
|
1268 |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
1269 bwipe! |
5ff14f96f1c9
patch 8.1.1406: popup_hide() and popup_show() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16806
diff
changeset
|
1270 endfunc |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16811
diff
changeset
|
1271 |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16811
diff
changeset
|
1272 func Test_popup_move() |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16811
diff
changeset
|
1273 topleft vnew |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16811
diff
changeset
|
1274 call setline(1, 'hello') |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16811
diff
changeset
|
1275 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
1276 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
|
1277 \ line: 1, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
1278 \ col: 1, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
1279 \ minwidth: 20, |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16811
diff
changeset
|
1280 \}) |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16811
diff
changeset
|
1281 redraw |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16811
diff
changeset
|
1282 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
|
1283 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
|
1284 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
1285 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
|
1286 redraw |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16811
diff
changeset
|
1287 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
|
1288 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
|
1289 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
|
1290 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
|
1291 |
17972
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17946
diff
changeset
|
1292 eval winid->popup_move(#{line: 1}) |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16811
diff
changeset
|
1293 redraw |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16811
diff
changeset
|
1294 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
|
1295 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
|
1296 |
29994
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29046
diff
changeset
|
1297 call assert_fails('call popup_move(winid, [])', 'E1206:') |
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29046
diff
changeset
|
1298 call assert_fails('call popup_move(winid, test_null_dict())', 'E1297:') |
20120
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
1299 |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16811
diff
changeset
|
1300 call popup_close(winid) |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16811
diff
changeset
|
1301 |
20120
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
1302 call assert_equal(0, popup_move(-1, {})) |
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
1303 |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16811
diff
changeset
|
1304 bwipe! |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16811
diff
changeset
|
1305 endfunc |
16829
5cebaecad422
patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
1306 |
16857
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1307 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
|
1308 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
|
1309 \ line: 2, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
1310 \ col: 3, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
1311 \ minwidth: 10, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
1312 \ minheight: 11, |
16829
5cebaecad422
patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
1313 \}) |
5cebaecad422
patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
1314 redraw |
16857
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1315 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
|
1316 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
|
1317 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
|
1318 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
|
1319 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
|
1320 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
|
1321 |
5cebaecad422
patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
1322 call popup_close(winid) |
5cebaecad422
patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
1323 endfunc |
16837
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
1324 |
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
1325 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
|
1326 let tests = [ |
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
1327 \ [['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
|
1328 \ [['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
|
1329 \ [['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
|
1330 \ [['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
|
1331 \ [['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
|
1332 \ ] |
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
1333 |
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
1334 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
|
1335 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
|
1336 redraw |
16857
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1337 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
|
1338 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
|
1339 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
|
1340 endfor |
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
1341 endfunc |
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
1342 |
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
1343 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
|
1344 let tests = [ |
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
1345 \ ['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
|
1346 \ ['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
|
1347 \ ['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
|
1348 \ ] |
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
1349 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
|
1350 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
|
1351 \ #{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
|
1352 redraw |
16857
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1353 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
|
1354 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
|
1355 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
|
1356 |
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
1357 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
|
1358 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
|
1359 endfor |
18593056d8f1
patch 8.1.1420: popup window size only uses first line length
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
1360 endfunc |
16841
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
1361 |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
1362 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
|
1363 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
|
1364 \ line: 2, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
1365 \ col: 3, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
1366 \ minwidth: 10, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
1367 \ minheight: 11, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
1368 \ maxwidth: 20, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
1369 \ maxheight: 21, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
1370 \ zindex: 100, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
1371 \ time: 5000, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
1372 \ fixed: 1 |
16841
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
1373 \}) |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
1374 redraw |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
1375 let res = popup_getoptions(winid) |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
1376 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
|
1377 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
|
1378 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
|
1379 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
|
1380 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
|
1381 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
|
1382 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
|
1383 call assert_equal(1, res.fixed) |
17626
2ae30dac20d6
patch 8.1.1810: popup_getoptions() is missing an entry for "mapping"
Bram Moolenaar <Bram@vim.org>
parents:
17604
diff
changeset
|
1384 call assert_equal(1, res.mapping) |
16841
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
1385 if has('timers') |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
1386 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
|
1387 endif |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
1388 call popup_close(winid) |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
1389 |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
1390 let winid = popup_create('hello', {}) |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
1391 redraw |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
1392 let res = popup_getoptions(winid) |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
1393 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
|
1394 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
|
1395 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
|
1396 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
|
1397 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
|
1398 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
|
1399 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
|
1400 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
|
1401 if has('timers') |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
1402 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
|
1403 endif |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
1404 call popup_close(winid) |
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16839
diff
changeset
|
1405 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
|
1406 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
|
1407 |
283037126560
patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents:
16841
diff
changeset
|
1408 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
|
1409 new |
283037126560
patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents:
16841
diff
changeset
|
1410 " 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
|
1411 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
|
1412 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
|
1413 " 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
|
1414 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
|
1415 " 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
|
1416 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
|
1417 " global/window-local |
17926
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
1418 setlocal statusline=2 |
16843
283037126560
patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents:
16841
diff
changeset
|
1419 |
283037126560
patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents:
16841
diff
changeset
|
1420 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
|
1421 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
|
1422 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
|
1423 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
|
1424 call assert_equal(&g:path, getwinvar(winid, '&path')) |
17926
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
1425 call assert_equal(&g:statusline, getwinvar(winid, '&statusline')) |
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
1426 |
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
1427 " 'scrolloff' is reset to zero |
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
1428 call assert_equal(5, &scrolloff) |
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
1429 call assert_equal(0, getwinvar(winid, '&scrolloff')) |
16843
283037126560
patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents:
16841
diff
changeset
|
1430 |
283037126560
patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents:
16841
diff
changeset
|
1431 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
|
1432 bwipe |
283037126560
patch 8.1.1423: popup windows use options from current window and buffer
Bram Moolenaar <Bram@vim.org>
parents:
16841
diff
changeset
|
1433 endfunc |
16853
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1434 |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1435 func Test_popup_atcursor() |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1436 topleft vnew |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1437 call setline(1, [ |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1438 \ 'xxxxxxxxxxxxxxxxx', |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1439 \ 'xxxxxxxxxxxxxxxxx', |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1440 \ 'xxxxxxxxxxxxxxxxx', |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1441 \]) |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1442 |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1443 call cursor(2, 2) |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1444 redraw |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1445 let winid = popup_atcursor('vim', {}) |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1446 redraw |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1447 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
|
1448 call assert_equal('xvimxxxxxxxxxxxxx', line) |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1449 call popup_close(winid) |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1450 |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1451 call cursor(3, 4) |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1452 redraw |
17972
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17946
diff
changeset
|
1453 let winid = 'vim'->popup_atcursor({}) |
16853
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1454 redraw |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1455 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
|
1456 call assert_equal('xxxvimxxxxxxxxxxx', line) |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1457 call popup_close(winid) |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1458 |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1459 call cursor(1, 1) |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1460 redraw |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
1461 let winid = popup_create('vim', #{ |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
1462 \ line: 'cursor+2', |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
1463 \ col: 'cursor+1', |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
1464 \}) |
16853
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1465 redraw |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1466 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
|
1467 call assert_equal('xvimxxxxxxxxxxxxx', line) |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1468 call popup_close(winid) |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1469 |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1470 call cursor(3, 3) |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1471 redraw |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
1472 let winid = popup_create('vim', #{ |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
1473 \ line: 'cursor-2', |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
1474 \ col: 'cursor-1', |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
1475 \}) |
16853
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1476 redraw |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1477 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
|
1478 call assert_equal('xvimxxxxxxxxxxxxx', line) |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1479 call popup_close(winid) |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1480 |
16857
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1481 " just enough room above |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1482 call cursor(3, 3) |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1483 redraw |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1484 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
|
1485 redraw |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1486 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
|
1487 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
|
1488 call popup_close(winid) |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1489 |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1490 " 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
|
1491 call cursor(3, 3) |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1492 redraw |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1493 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
|
1494 redraw |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1495 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
|
1496 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
|
1497 call popup_close(winid) |
4de94f6161f2
patch 8.1.1430: popup window option "wrap" not supported
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
1498 |
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
|
1499 " 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
|
1500 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
|
1501 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
|
1502 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
|
1503 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
|
1504 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
|
1505 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
|
1506 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
|
1507 |
16853
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1508 bwipe! |
e6bcccccbf7b
patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16849
diff
changeset
|
1509 endfunc |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1510 |
18558
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1511 func Test_popup_atcursor_pos() |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1512 CheckScreendump |
25114
989d7930ce65
patch 8.2.3094: Test_popup_atcursor_pos() fails without the conceal feature
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
1513 CheckFeature conceal |
18558
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1514 |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1515 let lines =<< trim END |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1516 call setline(1, repeat([repeat('-', 60)], 15)) |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1517 set so=0 |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1518 |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1519 normal 9G3|r# |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1520 let winid1 = popup_atcursor(['first', 'second'], #{ |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1521 \ moved: [0, 0, 0], |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1522 \ }) |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1523 normal 9G21|r& |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1524 let winid1 = popup_atcursor(['FIrsT', 'SEcoND'], #{ |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1525 \ pos: 'botright', |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1526 \ moved: [0, 0, 0], |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1527 \ }) |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1528 normal 3G27|r% |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1529 let winid1 = popup_atcursor(['fiRSt', 'seCOnd'], #{ |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1530 \ pos: 'topleft', |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1531 \ moved: [0, 0, 0], |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1532 \ }) |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1533 normal 3G45|r@ |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1534 let winid1 = popup_atcursor(['First', 'SeconD'], #{ |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1535 \ pos: 'topright', |
19241
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
1536 \ moved: range(3), |
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
1537 \ mousemoved: range(3), |
18558
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1538 \ }) |
25074
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1539 |
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1540 normal 9G27|Rconcealed X |
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1541 syn match Hidden /concealed/ conceal |
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1542 set conceallevel=2 concealcursor=n |
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1543 redraw |
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1544 normal 0fX |
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24998
diff
changeset
|
1545 call popup_atcursor('mark', {}) |
18558
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1546 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
1547 call writefile(lines, 'XtestPopupAtcursorPos', 'D') |
18558
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1548 let buf = RunVimInTerminal('-S XtestPopupAtcursorPos', #{rows: 12}) |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1549 call VerifyScreenDump(buf, 'Test_popupwin_atcursor_pos', {}) |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1550 |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1551 " clean up |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1552 call StopVimInTerminal(buf) |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1553 endfunc |
e5ef5d820b5b
patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents:
18544
diff
changeset
|
1554 |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17278
diff
changeset
|
1555 func Test_popup_beval() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
1556 CheckScreendump |
18137
5a5e9eed6029
patch 8.1.2063: some tests fail when +balloon_eval_term is missing
Bram Moolenaar <Bram@vim.org>
parents:
18110
diff
changeset
|
1557 CheckFeature balloon_eval_term |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17278
diff
changeset
|
1558 |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17278
diff
changeset
|
1559 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
|
1560 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
|
1561 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
|
1562 set balloonevalterm |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17278
diff
changeset
|
1563 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
|
1564 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
|
1565 func BalloonExpr() |
17972
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17946
diff
changeset
|
1566 let s:winid = [v:beval_text]->popup_beval({}) |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17278
diff
changeset
|
1567 return '' |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17278
diff
changeset
|
1568 endfunc |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17278
diff
changeset
|
1569 func Hover() |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17278
diff
changeset
|
1570 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
|
1571 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
|
1572 sleep 100m |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17278
diff
changeset
|
1573 endfunc |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17278
diff
changeset
|
1574 func MoveOntoPopup() |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17278
diff
changeset
|
1575 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
|
1576 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
|
1577 endfunc |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17278
diff
changeset
|
1578 func MoveAway() |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17278
diff
changeset
|
1579 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
|
1580 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
|
1581 endfunc |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17278
diff
changeset
|
1582 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
1583 call writefile(lines, 'XtestPopupBeval', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
1584 let buf = RunVimInTerminal('-S XtestPopupBeval', #{rows: 10}) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19732
diff
changeset
|
1585 call TermWait(buf, 50) |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17278
diff
changeset
|
1586 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
|
1587 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
|
1588 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
|
1589 |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17278
diff
changeset
|
1590 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
|
1591 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
|
1592 |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17278
diff
changeset
|
1593 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
|
1594 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
|
1595 |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17278
diff
changeset
|
1596 " clean up |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17278
diff
changeset
|
1597 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
|
1598 endfunc |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17278
diff
changeset
|
1599 |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1600 func Test_popup_filter() |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1601 new |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1602 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
|
1603 |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1604 func MyPopupFilter(winid, c) |
19544
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19368
diff
changeset
|
1605 if a:c == 'e' || a:c == "\<F9>" |
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19368
diff
changeset
|
1606 let g:eaten = a:c |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1607 return 1 |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1608 endif |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1609 if a:c == '0' |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1610 let g:ignored = '0' |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1611 return 0 |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1612 endif |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1613 if a:c == 'x' |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1614 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
|
1615 return 1 |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1616 endif |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1617 return 0 |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1618 endfunc |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1619 |
17972
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17946
diff
changeset
|
1620 let winid = 'something'->popup_create(#{filter: 'MyPopupFilter'}) |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1621 redraw |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1622 |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1623 " e is consumed by the filter |
25122
c1e79652ab27
patch 8.2.3098: popup window test is flaky on MS-Windows with GUI
Bram Moolenaar <Bram@vim.org>
parents:
25114
diff
changeset
|
1624 let g:eaten = '' |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1625 call feedkeys('e', 'xt') |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1626 call assert_equal('e', g:eaten) |
19544
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19368
diff
changeset
|
1627 call feedkeys("\<F9>", 'xt') |
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19368
diff
changeset
|
1628 call assert_equal("\<F9>", g:eaten) |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1629 |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1630 " 0 is ignored by the filter |
25122
c1e79652ab27
patch 8.2.3098: popup window test is flaky on MS-Windows with GUI
Bram Moolenaar <Bram@vim.org>
parents:
25114
diff
changeset
|
1631 let g:ignored = '' |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1632 normal $ |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1633 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
|
1634 call feedkeys('0', 'xt') |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1635 call assert_equal('0', g:ignored) |
25122
c1e79652ab27
patch 8.2.3098: popup window test is flaky on MS-Windows with GUI
Bram Moolenaar <Bram@vim.org>
parents:
25114
diff
changeset
|
1636 |
c1e79652ab27
patch 8.2.3098: popup window test is flaky on MS-Windows with GUI
Bram Moolenaar <Bram@vim.org>
parents:
25114
diff
changeset
|
1637 if has('win32') && has('gui_running') |
c1e79652ab27
patch 8.2.3098: popup window test is flaky on MS-Windows with GUI
Bram Moolenaar <Bram@vim.org>
parents:
25114
diff
changeset
|
1638 echo "FIXME: this check is very flaky on MS-Windows GUI, the cursor doesn't move" |
c1e79652ab27
patch 8.2.3098: popup window test is flaky on MS-Windows with GUI
Bram Moolenaar <Bram@vim.org>
parents:
25114
diff
changeset
|
1639 else |
c1e79652ab27
patch 8.2.3098: popup window test is flaky on MS-Windows with GUI
Bram Moolenaar <Bram@vim.org>
parents:
25114
diff
changeset
|
1640 call assert_equal(1, getcurpos()[2]) |
c1e79652ab27
patch 8.2.3098: popup window test is flaky on MS-Windows with GUI
Bram Moolenaar <Bram@vim.org>
parents:
25114
diff
changeset
|
1641 endif |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1642 |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1643 " x closes the popup |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1644 call feedkeys('x', 'xt') |
19544
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19368
diff
changeset
|
1645 call assert_equal("\<F9>", g:eaten) |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1646 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
|
1647 |
25122
c1e79652ab27
patch 8.2.3098: popup window test is flaky on MS-Windows with GUI
Bram Moolenaar <Bram@vim.org>
parents:
25114
diff
changeset
|
1648 unlet g:eaten |
c1e79652ab27
patch 8.2.3098: popup window test is flaky on MS-Windows with GUI
Bram Moolenaar <Bram@vim.org>
parents:
25114
diff
changeset
|
1649 unlet g:ignored |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1650 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
|
1651 call popup_clear() |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16878
diff
changeset
|
1652 endfunc |
16890
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
1653 |
22442
73be82f278c0
patch 8.2.1769: popup filter interferes with using :normal to move the cursor
Bram Moolenaar <Bram@vim.org>
parents:
22435
diff
changeset
|
1654 " this tests that the filter is not used for :normal command |
22361
00f2eebe74d9
patch 8.2.1729: endless loop when ":normal" feeds popup window filter
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
1655 func Test_popup_filter_normal_cmd() |
00f2eebe74d9
patch 8.2.1729: endless loop when ":normal" feeds popup window filter
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
1656 CheckScreendump |
00f2eebe74d9
patch 8.2.1729: endless loop when ":normal" feeds popup window filter
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
1657 |
00f2eebe74d9
patch 8.2.1729: endless loop when ":normal" feeds popup window filter
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
1658 let lines =<< trim END |
22442
73be82f278c0
patch 8.2.1769: popup filter interferes with using :normal to move the cursor
Bram Moolenaar <Bram@vim.org>
parents:
22435
diff
changeset
|
1659 let text = range(1, 20)->map({_, v -> string(v)}) |
73be82f278c0
patch 8.2.1769: popup filter interferes with using :normal to move the cursor
Bram Moolenaar <Bram@vim.org>
parents:
22435
diff
changeset
|
1660 let g:winid = popup_create(text, #{maxheight: 5, minwidth: 3, filter: 'invalidfilter'}) |
73be82f278c0
patch 8.2.1769: popup filter interferes with using :normal to move the cursor
Bram Moolenaar <Bram@vim.org>
parents:
22435
diff
changeset
|
1661 call timer_start(0, {-> win_execute(g:winid, 'norm! 10Gzz')}) |
22361
00f2eebe74d9
patch 8.2.1729: endless loop when ":normal" feeds popup window filter
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
1662 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
1663 call writefile(lines, 'XtestPopupNormal', 'D') |
22361
00f2eebe74d9
patch 8.2.1729: endless loop when ":normal" feeds popup window filter
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
1664 let buf = RunVimInTerminal('-S XtestPopupNormal', #{rows: 10}) |
00f2eebe74d9
patch 8.2.1729: endless loop when ":normal" feeds popup window filter
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
1665 call TermWait(buf, 100) |
00f2eebe74d9
patch 8.2.1729: endless loop when ":normal" feeds popup window filter
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
1666 call VerifyScreenDump(buf, 'Test_popupwin_normal_cmd', {}) |
00f2eebe74d9
patch 8.2.1729: endless loop when ":normal" feeds popup window filter
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
1667 |
00f2eebe74d9
patch 8.2.1729: endless loop when ":normal" feeds popup window filter
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
1668 call StopVimInTerminal(buf) |
00f2eebe74d9
patch 8.2.1729: endless loop when ":normal" feeds popup window filter
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
1669 endfunc |
00f2eebe74d9
patch 8.2.1729: endless loop when ":normal" feeds popup window filter
Bram Moolenaar <Bram@vim.org>
parents:
22357
diff
changeset
|
1670 |
22377
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1671 " test that cursor line highlight is updated after using win_execute() |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1672 func Test_popup_filter_win_execute() |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1673 CheckScreendump |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1674 |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1675 let lines =<< trim END |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1676 let lines = range(1, &lines * 2)->map({_, v -> string(v)}) |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1677 let g:id = popup_create(lines, #{ |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1678 \ minheight: &lines - 5, |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1679 \ maxheight: &lines - 5, |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1680 \ cursorline: 1, |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1681 \ }) |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1682 redraw |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1683 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
1684 call writefile(lines, 'XtestPopupWinExecute', 'D') |
22377
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1685 let buf = RunVimInTerminal('-S XtestPopupWinExecute', #{rows: 14}) |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1686 |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1687 call term_sendkeys(buf, ":call win_execute(g:id, ['normal 17Gzz'])\<CR>") |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1688 call term_sendkeys(buf, ":\<CR>") |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1689 |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1690 call VerifyScreenDump(buf, 'Test_popupwin_win_execute_cursorline', {}) |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1691 |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1692 call StopVimInTerminal(buf) |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1693 endfunc |
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1694 |
22403
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1695 func Test_popup_set_firstline() |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1696 CheckScreendump |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1697 |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1698 let lines =<< trim END |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1699 let lines = range(1, 50)->map({_, v -> string(v)}) |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1700 let g:id = popup_create(lines, #{ |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1701 \ minwidth: 20, |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1702 \ maxwidth: 20, |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1703 \ minheight: &lines - 5, |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1704 \ maxheight: &lines - 5, |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1705 \ cursorline: 1, |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1706 \ }) |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1707 call popup_setoptions(g:id, #{firstline: 10}) |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1708 redraw |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1709 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
1710 call writefile(lines, 'XtestPopupWinSetFirstline', 'D') |
22403
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1711 let buf = RunVimInTerminal('-S XtestPopupWinSetFirstline', #{rows: 16}) |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1712 |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1713 call VerifyScreenDump(buf, 'Test_popupwin_set_firstline_1', {}) |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1714 |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1715 call term_sendkeys(buf, ":call popup_setoptions(g:id, #{firstline: 5})\<CR>") |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1716 call term_sendkeys(buf, ":\<CR>") |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1717 call VerifyScreenDump(buf, 'Test_popupwin_set_firstline_2', {}) |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1718 |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1719 call StopVimInTerminal(buf) |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1720 endfunc |
3351d2cd3f1f
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Bram Moolenaar <Bram@vim.org>
parents:
22377
diff
changeset
|
1721 |
22367
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22361
diff
changeset
|
1722 " this tests that we don't get stuck with an error in "win_execute()" |
22377
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1723 func Test_popup_filter_win_execute_error() |
22367
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22361
diff
changeset
|
1724 CheckScreendump |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22361
diff
changeset
|
1725 |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22361
diff
changeset
|
1726 let lines =<< trim END |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22361
diff
changeset
|
1727 let g:winid = popup_create('some text', {'filter': 'invalidfilter'}) |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22361
diff
changeset
|
1728 call timer_start(0, {-> win_execute(g:winid, 'invalidCommand')}) |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22361
diff
changeset
|
1729 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
1730 call writefile(lines, 'XtestPopupWinExecuteError', 'D') |
22377
b2cb2a321af9
patch 8.2.1737: cursor line highlight in popup window is not always updated
Bram Moolenaar <Bram@vim.org>
parents:
22367
diff
changeset
|
1731 let buf = RunVimInTerminal('-S XtestPopupWinExecuteError', #{rows: 10, wait_for_ruler: 0}) |
22367
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22361
diff
changeset
|
1732 |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22361
diff
changeset
|
1733 call WaitFor({-> term_getline(buf, 9) =~ 'Not an editor command: invalidCommand'}) |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22361
diff
changeset
|
1734 call term_sendkeys(buf, "\<CR>") |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22361
diff
changeset
|
1735 call WaitFor({-> term_getline(buf, 9) =~ 'Unknown function: invalidfilter'}) |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22361
diff
changeset
|
1736 call term_sendkeys(buf, "\<CR>") |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22361
diff
changeset
|
1737 call WaitFor({-> term_getline(buf, 9) =~ 'Not allowed in a popup window'}) |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22361
diff
changeset
|
1738 call term_sendkeys(buf, "\<CR>") |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22361
diff
changeset
|
1739 call term_sendkeys(buf, "\<CR>") |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22361
diff
changeset
|
1740 call VerifyScreenDump(buf, 'Test_popupwin_win_execute', {}) |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22361
diff
changeset
|
1741 |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22361
diff
changeset
|
1742 call StopVimInTerminal(buf) |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22361
diff
changeset
|
1743 endfunc |
997bbc35c181
patch 8.2.1732: stuck when win_execute() for a popup causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22361
diff
changeset
|
1744 |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1745 func ShowDialog(key, result) |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1746 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
|
1747 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
|
1748 \ 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
|
1749 \ callback: 'QuitCallback', |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1750 \ }) |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1751 redraw |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1752 call feedkeys(a:key, "xt") |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1753 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
|
1754 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
|
1755 endfunc |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1756 |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1757 func Test_popup_dialog() |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1758 func QuitCallback(id, res) |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1759 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
|
1760 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
|
1761 endfunc |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1762 |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1763 let winid = ShowDialog("y", 1) |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1764 let winid = ShowDialog("Y", 1) |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1765 let winid = ShowDialog("n", 0) |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1766 let winid = ShowDialog("N", 0) |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1767 let winid = ShowDialog("x", 0) |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1768 let winid = ShowDialog("X", 0) |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1769 let winid = ShowDialog("\<Esc>", 0) |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1770 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
|
1771 |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1772 delfunc QuitCallback |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1773 endfunc |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
1774 |
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
|
1775 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
|
1776 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
|
1777 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
|
1778 \ 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
|
1779 \ }) |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17107
diff
changeset
|
1780 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
|
1781 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
|
1782 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
|
1783 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
|
1784 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
|
1785 |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17107
diff
changeset
|
1786 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
|
1787 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
|
1788 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
|
1789 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
|
1790 endfunc |
17604
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
1791 " mapping won't be used in popup |
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
1792 map j k |
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
|
1793 |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17107
diff
changeset
|
1794 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
|
1795 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
|
1796 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
|
1797 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
|
1798 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
|
1799 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
|
1800 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
|
1801 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
|
1802 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
|
1803 |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17107
diff
changeset
|
1804 delfunc QuitCallback |
17604
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
1805 unmap j |
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
|
1806 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
|
1807 |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17107
diff
changeset
|
1808 func Test_popup_menu_screenshot() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
1809 CheckScreendump |
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
|
1810 |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17107
diff
changeset
|
1811 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
|
1812 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
|
1813 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
|
1814 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
|
1815 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
|
1816 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
|
1817 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
|
1818 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
1819 call writefile(lines, 'XtestPopupMenu', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
1820 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
|
1821 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
|
1822 |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17107
diff
changeset
|
1823 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
|
1824 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
|
1825 |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17107
diff
changeset
|
1826 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
|
1827 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
|
1828 |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17107
diff
changeset
|
1829 " 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
|
1830 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
|
1831 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
|
1832 |
17438
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1833 func Test_popup_menu_narrow() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
1834 CheckScreendump |
17438
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1835 |
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1836 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
|
1837 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
|
1838 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
|
1839 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
|
1840 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
|
1841 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
|
1842 endfunc |
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1843 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
1844 call writefile(lines, 'XtestPopupNarrowMenu', 'D') |
17438
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1845 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
|
1846 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
|
1847 |
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1848 " clean up |
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1849 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
|
1850 call StopVimInTerminal(buf) |
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1851 endfunc |
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
1852 |
17119
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1853 func Test_popup_title() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
1854 CheckScreendump |
17119
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1855 |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1856 " 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
|
1857 " 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
|
1858 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
|
1859 call setline(1, range(1, 20)) |
17634
6e6a84993444
patch 8.1.1814: a long title in a popup window overflows
Bram Moolenaar <Bram@vim.org>
parents:
17628
diff
changeset
|
1860 let winid = 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
|
1861 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
1862 call writefile(lines, 'XtestPopupTitle', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
1863 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
|
1864 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
|
1865 |
17634
6e6a84993444
patch 8.1.1814: a long title in a popup window overflows
Bram Moolenaar <Bram@vim.org>
parents:
17628
diff
changeset
|
1866 call term_sendkeys(buf, ":call popup_setoptions(winid, #{maxwidth: 20, title: 'a very long title that is not going to fit'})\<CR>") |
6e6a84993444
patch 8.1.1814: a long title in a popup window overflows
Bram Moolenaar <Bram@vim.org>
parents:
17628
diff
changeset
|
1867 call term_sendkeys(buf, ":\<CR>") |
6e6a84993444
patch 8.1.1814: a long title in a popup window overflows
Bram Moolenaar <Bram@vim.org>
parents:
17628
diff
changeset
|
1868 call VerifyScreenDump(buf, 'Test_popupwin_longtitle_1', {}) |
6e6a84993444
patch 8.1.1814: a long title in a popup window overflows
Bram Moolenaar <Bram@vim.org>
parents:
17628
diff
changeset
|
1869 |
6e6a84993444
patch 8.1.1814: a long title in a popup window overflows
Bram Moolenaar <Bram@vim.org>
parents:
17628
diff
changeset
|
1870 call term_sendkeys(buf, ":call popup_setoptions(winid, #{border: []})\<CR>") |
6e6a84993444
patch 8.1.1814: a long title in a popup window overflows
Bram Moolenaar <Bram@vim.org>
parents:
17628
diff
changeset
|
1871 call term_sendkeys(buf, ":\<CR>") |
6e6a84993444
patch 8.1.1814: a long title in a popup window overflows
Bram Moolenaar <Bram@vim.org>
parents:
17628
diff
changeset
|
1872 call VerifyScreenDump(buf, 'Test_popupwin_longtitle_2', {}) |
6e6a84993444
patch 8.1.1814: a long title in a popup window overflows
Bram Moolenaar <Bram@vim.org>
parents:
17628
diff
changeset
|
1873 |
23173
6620b51e2916
patch 8.2.2132: padding not drawn properly for popup window with title
Bram Moolenaar <Bram@vim.org>
parents:
23154
diff
changeset
|
1874 call term_sendkeys(buf, ":call popup_clear()\<CR>") |
6620b51e2916
patch 8.2.2132: padding not drawn properly for popup window with title
Bram Moolenaar <Bram@vim.org>
parents:
23154
diff
changeset
|
1875 call term_sendkeys(buf, ":call popup_create(['aaa', 'bbb'], #{title: 'Title', minwidth: 12, padding: [2, 2, 2, 2]})\<CR>") |
6620b51e2916
patch 8.2.2132: padding not drawn properly for popup window with title
Bram Moolenaar <Bram@vim.org>
parents:
23154
diff
changeset
|
1876 call term_sendkeys(buf, ":\<CR>") |
6620b51e2916
patch 8.2.2132: padding not drawn properly for popup window with title
Bram Moolenaar <Bram@vim.org>
parents:
23154
diff
changeset
|
1877 call VerifyScreenDump(buf, 'Test_popupwin_longtitle_3', {}) |
6620b51e2916
patch 8.2.2132: padding not drawn properly for popup window with title
Bram Moolenaar <Bram@vim.org>
parents:
23154
diff
changeset
|
1878 |
6620b51e2916
patch 8.2.2132: padding not drawn properly for popup window with title
Bram Moolenaar <Bram@vim.org>
parents:
23154
diff
changeset
|
1879 call term_sendkeys(buf, ":call popup_clear()\<CR>") |
6620b51e2916
patch 8.2.2132: padding not drawn properly for popup window with title
Bram Moolenaar <Bram@vim.org>
parents:
23154
diff
changeset
|
1880 call term_sendkeys(buf, ":call popup_create(['aaa', 'bbb'], #{title: 'Title', minwidth: 12, border: [], padding: [2, 2, 2, 2]})\<CR>") |
6620b51e2916
patch 8.2.2132: padding not drawn properly for popup window with title
Bram Moolenaar <Bram@vim.org>
parents:
23154
diff
changeset
|
1881 call term_sendkeys(buf, ":\<CR>") |
6620b51e2916
patch 8.2.2132: padding not drawn properly for popup window with title
Bram Moolenaar <Bram@vim.org>
parents:
23154
diff
changeset
|
1882 call VerifyScreenDump(buf, 'Test_popupwin_longtitle_4', {}) |
6620b51e2916
patch 8.2.2132: padding not drawn properly for popup window with title
Bram Moolenaar <Bram@vim.org>
parents:
23154
diff
changeset
|
1883 |
24709
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
24053
diff
changeset
|
1884 call term_sendkeys(buf, ":call popup_clear()\<CR>") |
25535
7cb1597067e0
patch 8.2.3304: popup window title with wide characters is truncated
Bram Moolenaar <Bram@vim.org>
parents:
25122
diff
changeset
|
1885 call term_sendkeys(buf, ":call popup_menu(['This is a line', 'and another line'], #{title: '▶Äあいうえお◀', })\<CR>") |
24709
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
24053
diff
changeset
|
1886 call VerifyScreenDump(buf, 'Test_popupwin_multibytetitle', {}) |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
24053
diff
changeset
|
1887 call term_sendkeys(buf, "x") |
9d304d363ab6
patch 8.2.2893: multi-byte text in popup title shows up wrong
Bram Moolenaar <Bram@vim.org>
parents:
24053
diff
changeset
|
1888 |
17119
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1889 " clean up |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1890 call StopVimInTerminal(buf) |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
1891 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
1892 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
|
1893 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
|
1894 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
|
1895 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
|
1896 |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
1897 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
|
1898 endfunc |
b439e096a011
patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17117
diff
changeset
|
1899 |
16890
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
1900 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
|
1901 func PopupDone(id, result) |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
1902 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
|
1903 endfunc |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
1904 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
|
1905 redraw |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
1906 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
|
1907 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
|
1908 endfunc |
16892
60c9ac14a2ec
patch 8.1.1447: not allowed to create an empty popup
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
1909 |
60c9ac14a2ec
patch 8.1.1447: not allowed to create an empty popup
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
1910 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
|
1911 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
|
1912 redraw |
60c9ac14a2ec
patch 8.1.1447: not allowed to create an empty popup
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
1913 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
|
1914 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
|
1915 call assert_equal(5, pos.height) |
20386
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20375
diff
changeset
|
1916 call popup_close(winid) |
16892
60c9ac14a2ec
patch 8.1.1447: not allowed to create an empty popup
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
1917 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
1918 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
|
1919 redraw |
60c9ac14a2ec
patch 8.1.1447: not allowed to create an empty popup
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
1920 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
|
1921 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
|
1922 call assert_equal(3, pos.height) |
20386
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20375
diff
changeset
|
1923 call popup_close(winid) |
16892
60c9ac14a2ec
patch 8.1.1447: not allowed to create an empty popup
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
1924 endfunc |
16894
236c182c6300
patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1925 |
236c182c6300
patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1926 func Test_popup_never_behind() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
1927 CheckScreendump |
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
1928 |
16894
236c182c6300
patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1929 " +-----------------------------+ |
236c182c6300
patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1930 " | | | |
236c182c6300
patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1931 " | | | |
236c182c6300
patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1932 " | | | |
236c182c6300
patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1933 " | line1 | |
236c182c6300
patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1934 " |------------line2------------| |
236c182c6300
patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1935 " | line3 | |
236c182c6300
patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1936 " | line4 | |
236c182c6300
patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1937 " | | |
236c182c6300
patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1938 " | | |
236c182c6300
patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1939 " +-----------------------------+ |
236c182c6300
patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1940 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
|
1941 split |
236c182c6300
patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1942 vsplit |
236c182c6300
patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1943 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
|
1944 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
|
1945 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
|
1946 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
|
1947 \ line : line, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
1948 \ 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
|
1949 \ }) |
236c182c6300
patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1950 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
1951 call writefile(lines, 'XtestPopupBehind', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
1952 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
|
1953 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
|
1954 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
|
1955 |
236c182c6300
patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1956 " clean up |
236c182c6300
patch 8.1.1448: statusline is sometimes drawn on top of popup
Bram Moolenaar <Bram@vim.org>
parents:
16892
diff
changeset
|
1957 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
|
1958 endfunc |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
1959 |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
1960 func s:VerifyPosition(p, msg, line, col, width, height) |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
1961 call assert_equal(a:line, popup_getpos(a:p).line, a:msg . ' (l)') |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
1962 call assert_equal(a:col, popup_getpos(a:p).col, a:msg . ' (c)') |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
1963 call assert_equal(a:width, popup_getpos(a:p).width, a:msg . ' (w)') |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
1964 call assert_equal(a:height, popup_getpos(a:p).height, a:msg . ' (h)') |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
1965 endfunc |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
1966 |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
1967 func Test_popup_position_adjust() |
19071
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
1968 " Anything placed past the last cell on the right of the screen is moved to |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
1969 " the left. |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
1970 " |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
1971 " 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
|
1972 " 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
|
1973 |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
1974 " 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
|
1975 " 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
|
1976 let both_wrap_tests = [ |
19071
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
1977 \ ['a', 5, &columns, 5, &columns, 1, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
1978 \ ['b', 5, &columns + 1, 5, &columns, 1, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
1979 \ ['c', 5, &columns - 1, 5, &columns - 1, 1, 1], |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
1980 \ ['d', 5, &columns - 2, 5, &columns - 2, 1, 1], |
19071
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
1981 \ ['e', 5, &columns - 3, 5, &columns - 3, 1, 1]] |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
1982 |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
1983 " 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
|
1984 " - 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
|
1985 " - 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
|
1986 " - 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
|
1987 " - text |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
1988 " - row |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
1989 " - col |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
1990 " - expected row |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
1991 " - expected col |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
1992 " - expected width |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
1993 " - expected height |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
1994 let tests = [ |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
1995 \ #{ |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
1996 \ comment: 'left-aligned with wrapping', |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
1997 \ options: #{ |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
1998 \ wrap: 1, |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
1999 \ pos: 'botleft', |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2000 \ }, |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2001 \ tests: both_wrap_tests + [ |
19071
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2002 \ ['aa', 5, &columns, 4, &columns, 1, 2], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2003 \ ['bb', 5, &columns + 1, 4, &columns, 1, 2], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2004 \ ['cc', 5, &columns - 1, 5, &columns - 1, 2, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2005 \ ['dd', 5, &columns - 2, 5, &columns - 2, 2, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2006 \ ['ee', 5, &columns - 3, 5, &columns - 3, 2, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2007 \ |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2008 \ ['aaa', 5, &columns, 3, &columns, 1, 3], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2009 \ ['bbb', 5, &columns + 1, 3, &columns, 1, 3], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2010 \ ['ccc', 5, &columns - 1, 4, &columns - 1, 2, 2], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2011 \ ['ddd', 5, &columns - 2, 5, &columns - 2, 3, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2012 \ ['eee', 5, &columns - 3, 5, &columns - 3, 3, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2013 \ |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2014 \ ['aaaa', 5, &columns, 2, &columns, 1, 4], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2015 \ ['bbbb', 5, &columns + 1, 2, &columns, 1, 4], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2016 \ ['cccc', 5, &columns - 1, 4, &columns - 1, 2, 2], |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2017 \ ['dddd', 5, &columns - 2, 4, &columns - 2, 3, 2], |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2018 \ ['eeee', 5, &columns - 3, 5, &columns - 3, 4, 1], |
19071
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2019 \ ['eeee', 5, &columns - 4, 5, &columns - 4, 4, 1], |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2020 \ ], |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2021 \ }, |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2022 \ #{ |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2023 \ comment: 'left aligned without wrapping', |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2024 \ options: #{ |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2025 \ wrap: 0, |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2026 \ pos: 'botleft', |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2027 \ }, |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2028 \ tests: both_wrap_tests + [ |
19071
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2029 \ ['aa', 5, &columns, 5, &columns - 1, 2, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2030 \ ['bb', 5, &columns + 1, 5, &columns - 1, 2, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2031 \ ['cc', 5, &columns - 1, 5, &columns - 1, 2, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2032 \ ['dd', 5, &columns - 2, 5, &columns - 2, 2, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2033 \ ['ee', 5, &columns - 3, 5, &columns - 3, 2, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2034 \ |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2035 \ ['aaa', 5, &columns, 5, &columns - 2, 3, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2036 \ ['bbb', 5, &columns + 1, 5, &columns - 2, 3, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2037 \ ['ccc', 5, &columns - 1, 5, &columns - 2, 3, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2038 \ ['ddd', 5, &columns - 2, 5, &columns - 2, 3, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2039 \ ['eee', 5, &columns - 3, 5, &columns - 3, 3, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2040 \ |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2041 \ ['aaaa', 5, &columns, 5, &columns - 3, 4, 1], |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2042 \ ['bbbb', 5, &columns + 1, 5, &columns - 3, 4, 1], |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2043 \ ['cccc', 5, &columns - 1, 5, &columns - 3, 4, 1], |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2044 \ ['dddd', 5, &columns - 2, 5, &columns - 3, 4, 1], |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2045 \ ['eeee', 5, &columns - 3, 5, &columns - 3, 4, 1], |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2046 \ ], |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2047 \ }, |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2048 \ #{ |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2049 \ comment: 'left aligned with fixed position', |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2050 \ options: #{ |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2051 \ wrap: 0, |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2052 \ fixed: 1, |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2053 \ pos: 'botleft', |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2054 \ }, |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2055 \ tests: both_wrap_tests + [ |
19071
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2056 \ ['aa', 5, &columns, 5, &columns, 1, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2057 \ ['bb', 5, &columns + 1, 5, &columns, 1, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2058 \ ['cc', 5, &columns - 1, 5, &columns - 1, 2, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2059 \ ['dd', 5, &columns - 2, 5, &columns - 2, 2, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2060 \ ['ee', 5, &columns - 3, 5, &columns - 3, 2, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2061 \ |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2062 \ ['aaa', 5, &columns, 5, &columns, 1, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2063 \ ['bbb', 5, &columns + 1, 5, &columns, 1, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2064 \ ['ccc', 5, &columns - 1, 5, &columns - 1, 2, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2065 \ ['ddd', 5, &columns - 2, 5, &columns - 2, 3, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2066 \ ['eee', 5, &columns - 3, 5, &columns - 3, 3, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2067 \ |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2068 \ ['aaaa', 5, &columns, 5, &columns, 1, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2069 \ ['bbbb', 5, &columns + 1, 5, &columns, 1, 1], |
48e0208f53c2
patch 8.2.0096: cannot create tiny popup window in last column
Bram Moolenaar <Bram@vim.org>
parents:
18868
diff
changeset
|
2070 \ ['cccc', 5, &columns - 1, 5, &columns - 1, 2, 1], |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2071 \ ['dddd', 5, &columns - 2, 5, &columns - 2, 3, 1], |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2072 \ ['eeee', 5, &columns - 3, 5, &columns - 3, 4, 1], |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2073 \ ], |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2074 \ }, |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2075 \ ] |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2076 |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2077 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
|
2078 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
|
2079 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
|
2080 let options = #{ |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2081 \ line: line, |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2082 \ col: col, |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2083 \ } |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2084 call extend(options, test_group.options) |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2085 |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2086 let p = popup_create(text, options) |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2087 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
2088 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
|
2089 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
|
2090 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
|
2091 endfor |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2092 endfor |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2093 |
17026
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
17022
diff
changeset
|
2094 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
|
2095 %bwipe! |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2096 endfunc |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2097 |
16904
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2098 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
|
2099 " width of screen |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2100 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
|
2101 |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2102 let p = popup_create(X, #{line: 1, col: 1, wrap: 0}) |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2103 call s:VerifyPosition(p, 'full width topleft', 1, 1, &columns, 1) |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2104 |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2105 redraw |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2106 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
|
2107 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
|
2108 |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2109 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
|
2110 redraw |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2111 |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2112 " Same if placed on the right hand side |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2113 let p = popup_create(X, #{line: 1, col: &columns, wrap: 0}) |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2114 call s:VerifyPosition(p, 'full width topright', 1, 1, &columns, 1) |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2115 |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2116 redraw |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2117 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
|
2118 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
|
2119 |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2120 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
|
2121 redraw |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2122 |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2123 " 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
|
2124 let X .= 'x' |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2125 |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2126 let p = popup_create(X, #{line: 1, col: 1, wrap: 0}) |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2127 call s:VerifyPosition(p, 'full width + 1 topleft', 1, 1, &columns, 1) |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2128 |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2129 redraw |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2130 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
|
2131 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
|
2132 |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2133 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
|
2134 redraw |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2135 |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2136 " Shifted then truncated (the x is not visible) |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2137 let p = popup_create(X, #{line: 1, col: &columns - 3, wrap: 0}) |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2138 call s:VerifyPosition(p, 'full width + 1 topright', 1, 1, &columns, 1) |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2139 |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2140 redraw |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2141 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
|
2142 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
|
2143 |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2144 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
|
2145 redraw |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2146 |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2147 " Not shifted, just truncated |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2148 let p = popup_create(X, |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2149 \ #{line: 1, col: 2, wrap: 0, fixed: 1}) |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2150 call s:VerifyPosition(p, 'full width + 1 fixed', 1, 2, &columns - 1, 1) |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2151 |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2152 redraw |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2153 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
|
2154 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
|
2155 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
|
2156 |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
2157 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
|
2158 redraw |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16894
diff
changeset
|
2159 |
17026
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
17022
diff
changeset
|
2160 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
|
2161 %bwipe! |
16904
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2162 endfunc |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2163 |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2164 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
|
2165 new |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2166 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
|
2167 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
|
2168 |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2169 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
|
2170 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
|
2171 redraw |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2172 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
|
2173 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
|
2174 " 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
|
2175 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
|
2176 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
|
2177 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
|
2178 |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2179 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
|
2180 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
|
2181 redraw |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2182 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
|
2183 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
|
2184 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
|
2185 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
|
2186 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
|
2187 |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2188 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
|
2189 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
|
2190 redraw |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2191 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
|
2192 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
|
2193 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
|
2194 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
|
2195 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
|
2196 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
|
2197 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
|
2198 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
|
2199 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
|
2200 |
16908
df06694b761b
patch 8.1.1455: popup_atcursor() not completely implemented
Bram Moolenaar <Bram@vim.org>
parents:
16904
diff
changeset
|
2201 " 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
|
2202 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
|
2203 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
|
2204 redraw |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2205 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
|
2206 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
|
2207 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
|
2208 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
|
2209 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
|
2210 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
|
2211 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
|
2212 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
|
2213 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
|
2214 |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2215 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
|
2216 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
|
2217 redraw |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2218 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
|
2219 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
|
2220 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
|
2221 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
|
2222 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
|
2223 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
|
2224 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
|
2225 |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2226 bwipe! |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16902
diff
changeset
|
2227 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
|
2228 endfunc |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17043
diff
changeset
|
2229 |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17043
diff
changeset
|
2230 func Test_notifications() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
2231 CheckFeature timers |
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
2232 CheckScreendump |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17043
diff
changeset
|
2233 |
17920
233e316c0b5a
patch 8.1.1956: screenshot tests may use a different encoding
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2234 let lines =<< trim END |
233e316c0b5a
patch 8.1.1956: screenshot tests may use a different encoding
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2235 call setline(1, range(1, 20)) |
233e316c0b5a
patch 8.1.1956: screenshot tests may use a different encoding
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2236 hi Notification ctermbg=lightblue |
233e316c0b5a
patch 8.1.1956: screenshot tests may use a different encoding
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2237 call popup_notification('first notification', {}) |
233e316c0b5a
patch 8.1.1956: screenshot tests may use a different encoding
Bram Moolenaar <Bram@vim.org>
parents:
17918
diff
changeset
|
2238 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
2239 call writefile(lines, 'XtestNotifications', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
2240 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
|
2241 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
|
2242 |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17043
diff
changeset
|
2243 " 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
|
2244 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
|
2245 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
|
2246 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
|
2247 |
17180
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
2248 " clean up |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
2249 call StopVimInTerminal(buf) |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
2250 endfunc |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
2251 |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
2252 func Test_popup_scrollbar() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
2253 CheckScreendump |
17180
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
2254 |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
2255 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
|
2256 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
|
2257 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
|
2258 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
|
2259 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
|
2260 \ '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
|
2261 \ minwidth: 8, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
2262 \ maxheight: 4, |
17180
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17172
diff
changeset
|
2263 \ }) |
17198
4c009ec23c0a
patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents:
17182
diff
changeset
|
2264 func ScrollUp() |
4c009ec23c0a
patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents:
17182
diff
changeset
|
2265 call feedkeys("\<F3>\<ScrollWheelUp>", "xt") |
4c009ec23c0a
patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents:
17182
diff
changeset
|
2266 endfunc |
4c009ec23c0a
patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents:
17182
diff
changeset
|
2267 func ScrollDown() |
4c009ec23c0a
patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents:
17182
diff
changeset
|
2268 call feedkeys("\<F3>\<ScrollWheelDown>", "xt") |
4c009ec23c0a
patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents:
17182
diff
changeset
|
2269 endfunc |
17216
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17210
diff
changeset
|
2270 func ClickTop() |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17210
diff
changeset
|
2271 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
|
2272 endfunc |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17210
diff
changeset
|
2273 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
|
2274 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
|
2275 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
|
2276 endfunc |
18492
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2277 func Popup_filter(winid, key) |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2278 if a:key == 'j' |
22675
ff29f22c93f7
patch 8.2.1886: using ":silent!" in a popup filter has unexpected effect
Bram Moolenaar <Bram@vim.org>
parents:
22600
diff
changeset
|
2279 silent! this_throws_an_error_but_is_ignored |
18492
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2280 let line = popup_getoptions(a:winid).firstline |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2281 let nlines = line('$', a:winid) |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2282 let newline = line < nlines ? (line + 1) : nlines |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2283 call popup_setoptions(a:winid, #{firstline: newline}) |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2284 return v:true |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2285 elseif a:key == 'x' |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2286 call popup_close(a:winid) |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2287 return v:true |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2288 endif |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2289 endfunc |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2290 |
29036
71b766ba26a6
patch 8.2.5040: scrollbar thumb in scrolled popup not visible
Bram Moolenaar <Bram@vim.org>
parents:
29034
diff
changeset
|
2291 def CreatePopup(text: list<string>): number |
71b766ba26a6
patch 8.2.5040: scrollbar thumb in scrolled popup not visible
Bram Moolenaar <Bram@vim.org>
parents:
29034
diff
changeset
|
2292 return popup_create(text, { |
22429
909ce065e99a
patch 8.2.1763: Vim9: cannot use "true" for popup window scrollbar option
Bram Moolenaar <Bram@vim.org>
parents:
22403
diff
changeset
|
2293 \ minwidth: 30, |
909ce065e99a
patch 8.2.1763: Vim9: cannot use "true" for popup window scrollbar option
Bram Moolenaar <Bram@vim.org>
parents:
22403
diff
changeset
|
2294 \ maxwidth: 30, |
909ce065e99a
patch 8.2.1763: Vim9: cannot use "true" for popup window scrollbar option
Bram Moolenaar <Bram@vim.org>
parents:
22403
diff
changeset
|
2295 \ minheight: 4, |
909ce065e99a
patch 8.2.1763: Vim9: cannot use "true" for popup window scrollbar option
Bram Moolenaar <Bram@vim.org>
parents:
22403
diff
changeset
|
2296 \ maxheight: 4, |
909ce065e99a
patch 8.2.1763: Vim9: cannot use "true" for popup window scrollbar option
Bram Moolenaar <Bram@vim.org>
parents:
22403
diff
changeset
|
2297 \ firstline: 1, |
909ce065e99a
patch 8.2.1763: Vim9: cannot use "true" for popup window scrollbar option
Bram Moolenaar <Bram@vim.org>
parents:
22403
diff
changeset
|
2298 \ lastline: 4, |
909ce065e99a
patch 8.2.1763: Vim9: cannot use "true" for popup window scrollbar option
Bram Moolenaar <Bram@vim.org>
parents:
22403
diff
changeset
|
2299 \ wrap: true, |
909ce065e99a
patch 8.2.1763: Vim9: cannot use "true" for popup window scrollbar option
Bram Moolenaar <Bram@vim.org>
parents:
22403
diff
changeset
|
2300 \ scrollbar: true, |
909ce065e99a
patch 8.2.1763: Vim9: cannot use "true" for popup window scrollbar option
Bram Moolenaar <Bram@vim.org>
parents:
22403
diff
changeset
|
2301 \ mapping: false, |
27464
a14c4d3e3260
patch 8.2.4260: Vim9: can still use a global function without g:
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
2302 \ filter: g:Popup_filter, |
22429
909ce065e99a
patch 8.2.1763: Vim9: cannot use "true" for popup window scrollbar option
Bram Moolenaar <Bram@vim.org>
parents:
22403
diff
changeset
|
2303 \ }) |
909ce065e99a
patch 8.2.1763: Vim9: cannot use "true" for popup window scrollbar option
Bram Moolenaar <Bram@vim.org>
parents:
22403
diff
changeset
|
2304 enddef |
909ce065e99a
patch 8.2.1763: Vim9: cannot use "true" for popup window scrollbar option
Bram Moolenaar <Bram@vim.org>
parents:
22403
diff
changeset
|
2305 |
18492
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2306 func PopupScroll() |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2307 call popup_clear() |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2308 let text =<< trim END |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2309 1 |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2310 2 |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2311 3 |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2312 4 |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2313 long line long line long line long line long line long line |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2314 long line long line long line long line long line long line |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2315 long line long line long line long line long line long line |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2316 END |
22429
909ce065e99a
patch 8.2.1763: Vim9: cannot use "true" for popup window scrollbar option
Bram Moolenaar <Bram@vim.org>
parents:
22403
diff
changeset
|
2317 call CreatePopup(text) |
18492
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2318 endfunc |
29036
71b766ba26a6
patch 8.2.5040: scrollbar thumb in scrolled popup not visible
Bram Moolenaar <Bram@vim.org>
parents:
29034
diff
changeset
|
2319 func ScrollBottom() |
71b766ba26a6
patch 8.2.5040: scrollbar thumb in scrolled popup not visible
Bram Moolenaar <Bram@vim.org>
parents:
29034
diff
changeset
|
2320 call popup_clear() |
29040
5d71ed834c03
patch 8.2.5042: scrollbar thumb in tall scrolled popup not visible
Bram Moolenaar <Bram@vim.org>
parents:
29038
diff
changeset
|
2321 let id = CreatePopup(range(100)->map({k, v -> string(v)})) |
5d71ed834c03
patch 8.2.5042: scrollbar thumb in tall scrolled popup not visible
Bram Moolenaar <Bram@vim.org>
parents:
29038
diff
changeset
|
2322 call popup_setoptions(id, #{firstline: 100, minheight: 9, maxheight: 9}) |
29036
71b766ba26a6
patch 8.2.5040: scrollbar thumb in scrolled popup not visible
Bram Moolenaar <Bram@vim.org>
parents:
29034
diff
changeset
|
2323 endfunc |
17198
4c009ec23c0a
patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents:
17182
diff
changeset
|
2324 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
|
2325 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
|
2326 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
|
2327 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
2328 call writefile(lines, 'XtestPopupScroll', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
2329 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
|
2330 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
|
2331 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
2332 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
|
2333 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
|
2334 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
|
2335 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
2336 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
|
2337 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
|
2338 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
|
2339 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
2340 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
|
2341 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
|
2342 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
|
2343 |
17897
fa032e079825
patch 8.1.1945: popup window "firstline" cannot be reset
Bram Moolenaar <Bram@vim.org>
parents:
17847
diff
changeset
|
2344 call term_sendkeys(buf, ":call popup_setoptions(winid, #{scrollbarhighlight: 'ScrollBar', thumbhighlight: 'ScrollThumb', firstline: 5})\<CR>") |
17926
ad7a4bd65f20
patch 8.1.1959: when using "firstline" in popup window text may jump
Bram Moolenaar <Bram@vim.org>
parents:
17920
diff
changeset
|
2345 " this scrolls two lines (half the window height) |
17198
4c009ec23c0a
patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents:
17182
diff
changeset
|
2346 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
|
2347 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
|
2348 |
4c009ec23c0a
patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents:
17182
diff
changeset
|
2349 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
|
2350 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
|
2351 |
4c009ec23c0a
patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents:
17182
diff
changeset
|
2352 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
|
2353 " 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
|
2354 sleep 100m |
17198
4c009ec23c0a
patch 8.1.1598: update to test file missing
Bram Moolenaar <Bram@vim.org>
parents:
17182
diff
changeset
|
2355 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
|
2356 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
|
2357 |
17216
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17210
diff
changeset
|
2358 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
|
2359 sleep 100m |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17210
diff
changeset
|
2360 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
|
2361 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
|
2362 |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17210
diff
changeset
|
2363 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
|
2364 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
|
2365 |
17905
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
2366 " remove the minwidth and maxheight |
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
2367 call term_sendkeys(buf, ":call popup_setoptions(winid, #{maxheight: 0, minwidth: 0})\<CR>") |
18110
6a6c4536ea4c
patch 8.1.2050: popup window test fails in some configurations
Bram Moolenaar <Bram@vim.org>
parents:
18088
diff
changeset
|
2368 call term_sendkeys(buf, ":\<CR>") |
17905
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
2369 call VerifyScreenDump(buf, 'Test_popupwin_scroll_10', {}) |
fb773f73a4be
patch 8.1.1949: cannot scroll a popup window to the very bottom
Bram Moolenaar <Bram@vim.org>
parents:
17897
diff
changeset
|
2370 |
18492
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2371 " check size with non-wrapping lines |
27464
a14c4d3e3260
patch 8.2.4260: Vim9: can still use a global function without g:
Bram Moolenaar <Bram@vim.org>
parents:
27457
diff
changeset
|
2372 call term_sendkeys(buf, ":call g:PopupScroll()\<CR>") |
18492
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2373 call VerifyScreenDump(buf, 'Test_popupwin_scroll_11', {}) |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2374 |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2375 " check size with wrapping lines |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2376 call term_sendkeys(buf, "j") |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2377 call VerifyScreenDump(buf, 'Test_popupwin_scroll_12', {}) |
41a5f241e9d5
patch 8.1.2240: popup window width changes when scrolling
Bram Moolenaar <Bram@vim.org>
parents:
18432
diff
changeset
|
2378 |
29036
71b766ba26a6
patch 8.2.5040: scrollbar thumb in scrolled popup not visible
Bram Moolenaar <Bram@vim.org>
parents:
29034
diff
changeset
|
2379 " check thumb when scrolled all the way down |
71b766ba26a6
patch 8.2.5040: scrollbar thumb in scrolled popup not visible
Bram Moolenaar <Bram@vim.org>
parents:
29034
diff
changeset
|
2380 call term_sendkeys(buf, ":call ScrollBottom()\<CR>") |
71b766ba26a6
patch 8.2.5040: scrollbar thumb in scrolled popup not visible
Bram Moolenaar <Bram@vim.org>
parents:
29034
diff
changeset
|
2381 call VerifyScreenDump(buf, 'Test_popupwin_scroll_13', {}) |
71b766ba26a6
patch 8.2.5040: scrollbar thumb in scrolled popup not visible
Bram Moolenaar <Bram@vim.org>
parents:
29034
diff
changeset
|
2382 |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17043
diff
changeset
|
2383 " clean up |
20927
9328feafbbf5
patch 8.2.1015: popup filter gets key with modifier prepended
Bram Moolenaar <Bram@vim.org>
parents:
20865
diff
changeset
|
2384 call term_sendkeys(buf, "x") |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17043
diff
changeset
|
2385 call StopVimInTerminal(buf) |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17043
diff
changeset
|
2386 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
|
2387 |
21713
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2388 func Test_popup_too_high_scrollbar() |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2389 CheckScreendump |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2390 |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2391 let lines =<< trim END |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2392 call setline(1, range(1, 20)->map({i, v -> repeat(v, 10)})) |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2393 set scrolloff=0 |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2394 func ShowPopup() |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2395 let winid = popup_atcursor(['one', 'two', 'three', 'four', 'five', |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2396 \ 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve'], #{ |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2397 \ minwidth: 8, |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2398 \ border: [], |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2399 \ }) |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2400 endfunc |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2401 normal 3G$ |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2402 call ShowPopup() |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2403 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
2404 call writefile(lines, 'XtestPopupToohigh', 'D') |
21713
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2405 let buf = RunVimInTerminal('-S XtestPopupToohigh', #{rows: 10}) |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2406 call VerifyScreenDump(buf, 'Test_popupwin_toohigh_1', {}) |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2407 |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2408 call term_sendkeys(buf, ":call popup_clear()\<CR>") |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2409 call term_sendkeys(buf, "8G$") |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2410 call term_sendkeys(buf, ":call ShowPopup()\<CR>") |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2411 call VerifyScreenDump(buf, 'Test_popupwin_toohigh_2', {}) |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2412 |
21729
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
2413 call term_sendkeys(buf, ":call popup_clear()\<CR>") |
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
2414 call term_sendkeys(buf, "gg$") |
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
2415 call term_sendkeys(buf, ":call ShowPopup()\<CR>") |
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
2416 call VerifyScreenDump(buf, 'Test_popupwin_toohigh_3', {}) |
f2ba8ebbab2b
patch 8.2.1414: popupwindow missing last couple of lines
Bram Moolenaar <Bram@vim.org>
parents:
21713
diff
changeset
|
2417 |
21713
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2418 " clean up |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2419 call StopVimInTerminal(buf) |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2420 endfunc |
b997e872ff95
patch 8.2.1406: popupwindow lacks scrollbar if no "maxheight" is used
Bram Moolenaar <Bram@vim.org>
parents:
21552
diff
changeset
|
2421 |
17274
6a7ba68d448e
patch 8.1.1636: crash when popup has fitting scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17253
diff
changeset
|
2422 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
|
2423 " 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
|
2424 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
|
2425 \ '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
|
2426 \ scrollbar: 1, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
2427 \ maxwidth: 10, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
2428 \ maxheight: 5, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
2429 \ firstline: 2}) |
17274
6a7ba68d448e
patch 8.1.1636: crash when popup has fitting scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17253
diff
changeset
|
2430 redraw |
6a7ba68d448e
patch 8.1.1636: crash when popup has fitting scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17253
diff
changeset
|
2431 call popup_clear() |
6a7ba68d448e
patch 8.1.1636: crash when popup has fitting scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17253
diff
changeset
|
2432 endfunc |
6a7ba68d448e
patch 8.1.1636: crash when popup has fitting scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
17253
diff
changeset
|
2433 |
17121
808ea76535a9
patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
2434 func Test_popup_settext() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
2435 CheckScreendump |
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
|
2436 |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
2437 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
|
2438 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
|
2439 let p = popup_create('test', opts) |
17972
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17946
diff
changeset
|
2440 eval p->popup_settext('this is a text') |
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
|
2441 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
|
2442 |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
2443 call writefile(lines, 'XtestPopupSetText', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
2444 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
|
2445 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
|
2446 |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
2447 " 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
|
2448 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
|
2449 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
|
2450 |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
2451 " 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
|
2452 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
|
2453 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
|
2454 |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
2455 " 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
|
2456 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
|
2457 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
|
2458 |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
2459 " 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
|
2460 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
|
2461 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
|
2462 |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
2463 " 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
|
2464 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
|
2465 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
|
2466 |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17101
diff
changeset
|
2467 " Dicts |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
2468 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
|
2469 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
|
2470 |
19241
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
2471 " range() (doesn't work) |
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
2472 call term_sendkeys(buf, ":call popup_settext(p, range(4, 8))\<CR>") |
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
2473 call VerifyScreenDump(buf, 'Test_popup_settext_07', {}) |
c53dbbf3229b
patch 8.2.0179: still a few places where range() does not work
Bram Moolenaar <Bram@vim.org>
parents:
19166
diff
changeset
|
2474 |
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
|
2475 " 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
|
2476 call StopVimInTerminal(buf) |
17121
808ea76535a9
patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
2477 endfunc |
808ea76535a9
patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
2478 |
22063
0716b3299872
patch 8.2.1581: using line() for global popup window doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
22057
diff
changeset
|
2479 func Test_popup_settext_getline() |
0716b3299872
patch 8.2.1581: using line() for global popup window doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
22057
diff
changeset
|
2480 let id = popup_create('', #{ tabpage: 0 }) |
0716b3299872
patch 8.2.1581: using line() for global popup window doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
22057
diff
changeset
|
2481 call popup_settext(id, ['a','b']) |
0716b3299872
patch 8.2.1581: using line() for global popup window doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
22057
diff
changeset
|
2482 call assert_equal(2, line('$', id)) " OK :) |
0716b3299872
patch 8.2.1581: using line() for global popup window doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
22057
diff
changeset
|
2483 call popup_close(id) |
0716b3299872
patch 8.2.1581: using line() for global popup window doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
22057
diff
changeset
|
2484 |
0716b3299872
patch 8.2.1581: using line() for global popup window doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
22057
diff
changeset
|
2485 let id = popup_create('', #{ tabpage: -1 }) |
0716b3299872
patch 8.2.1581: using line() for global popup window doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
22057
diff
changeset
|
2486 call popup_settext(id, ['a','b']) |
0716b3299872
patch 8.2.1581: using line() for global popup window doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
22057
diff
changeset
|
2487 call assert_equal(2, line('$', id)) " Fails :( |
0716b3299872
patch 8.2.1581: using line() for global popup window doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
22057
diff
changeset
|
2488 call popup_close(id) |
0716b3299872
patch 8.2.1581: using line() for global popup window doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
22057
diff
changeset
|
2489 endfunc |
0716b3299872
patch 8.2.1581: using line() for global popup window doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
22057
diff
changeset
|
2490 |
22600
d5ce7dd60dc1
patch 8.2.1848: crash when passing a NULL string or list to popup_settext()
Bram Moolenaar <Bram@vim.org>
parents:
22518
diff
changeset
|
2491 func Test_popup_settext_null() |
d5ce7dd60dc1
patch 8.2.1848: crash when passing a NULL string or list to popup_settext()
Bram Moolenaar <Bram@vim.org>
parents:
22518
diff
changeset
|
2492 let id = popup_create('', #{ tabpage: 0 }) |
d5ce7dd60dc1
patch 8.2.1848: crash when passing a NULL string or list to popup_settext()
Bram Moolenaar <Bram@vim.org>
parents:
22518
diff
changeset
|
2493 call popup_settext(id, test_null_list()) |
d5ce7dd60dc1
patch 8.2.1848: crash when passing a NULL string or list to popup_settext()
Bram Moolenaar <Bram@vim.org>
parents:
22518
diff
changeset
|
2494 call popup_close(id) |
d5ce7dd60dc1
patch 8.2.1848: crash when passing a NULL string or list to popup_settext()
Bram Moolenaar <Bram@vim.org>
parents:
22518
diff
changeset
|
2495 |
d5ce7dd60dc1
patch 8.2.1848: crash when passing a NULL string or list to popup_settext()
Bram Moolenaar <Bram@vim.org>
parents:
22518
diff
changeset
|
2496 let id = popup_create('', #{ tabpage: 0 }) |
d5ce7dd60dc1
patch 8.2.1848: crash when passing a NULL string or list to popup_settext()
Bram Moolenaar <Bram@vim.org>
parents:
22518
diff
changeset
|
2497 call popup_settext(id, test_null_string()) |
d5ce7dd60dc1
patch 8.2.1848: crash when passing a NULL string or list to popup_settext()
Bram Moolenaar <Bram@vim.org>
parents:
22518
diff
changeset
|
2498 call popup_close(id) |
d5ce7dd60dc1
patch 8.2.1848: crash when passing a NULL string or list to popup_settext()
Bram Moolenaar <Bram@vim.org>
parents:
22518
diff
changeset
|
2499 endfunc |
d5ce7dd60dc1
patch 8.2.1848: crash when passing a NULL string or list to popup_settext()
Bram Moolenaar <Bram@vim.org>
parents:
22518
diff
changeset
|
2500 |
17121
808ea76535a9
patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
2501 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
|
2502 new |
808ea76535a9
patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
2503 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
2504 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
|
2505 redraw |
808ea76535a9
patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
2506 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
|
2507 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
|
2508 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
2509 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
|
2510 redraw |
808ea76535a9
patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
2511 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
|
2512 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
|
2513 |
808ea76535a9
patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
2514 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
|
2515 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
|
2516 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
|
2517 endfunc |
17972
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17946
diff
changeset
|
2518 let winid = 'make a choice'->popup_dialog(#{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
|
2519 \ 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
|
2520 \ callback: 'QuitCallback', |
17121
808ea76535a9
patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
2521 \ }) |
808ea76535a9
patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
2522 redraw |
808ea76535a9
patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
2523 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
|
2524 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
|
2525 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
|
2526 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
|
2527 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
|
2528 |
808ea76535a9
patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
2529 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
|
2530 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
|
2531 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
|
2532 |
808ea76535a9
patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
2533 bwipe! |
808ea76535a9
patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
2534 delfunc QuitCallback |
808ea76535a9
patch 8.1.1560: popup window hidden option not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
2535 endfunc |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2536 |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2537 " 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
|
2538 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
|
2539 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
|
2540 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
|
2541 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
|
2542 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
|
2543 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
|
2544 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
2545 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
|
2546 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
|
2547 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
|
2548 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
|
2549 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
|
2550 |
29994
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29046
diff
changeset
|
2551 call assert_fails('call popup_setoptions(winid, [])', 'E1206:') |
86eb4aba16c3
patch 9.0.0335: checks for Dictionary argument often give a vague error
Bram Moolenaar <Bram@vim.org>
parents:
29046
diff
changeset
|
2552 call assert_fails('call popup_setoptions(winid, test_null_dict())', 'E1297:') |
20120
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
2553 |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2554 call popup_close(winid) |
20120
16460964c304
patch 8.2.0615: regexp benchmark stest is old style
Bram Moolenaar <Bram@vim.org>
parents:
19954
diff
changeset
|
2555 call assert_equal(0, popup_setoptions(winid, options.wrap)) |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17121
diff
changeset
|
2556 endfunc |
17151
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
2557 |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
2558 func Test_popupwin_garbage_collect() |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
2559 func MyPopupFilter(x, winid, c) |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
2560 " NOP |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
2561 endfunc |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
2562 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
2563 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
|
2564 call test_garbagecollect_now() |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
2565 redraw |
17918
9606c0adc148
patch 8.1.1955: tests contain typos
Bram Moolenaar <Bram@vim.org>
parents:
17905
diff
changeset
|
2566 " Must not crash caused by invalid memory access |
17151
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
2567 call feedkeys('j', 'xt') |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
2568 call assert_true(v:true) |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
2569 |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
2570 call popup_close(winid) |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
2571 delfunc MyPopupFilter |
ebe9aab81898
patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents:
17149
diff
changeset
|
2572 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
|
2573 |
17946
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2574 func Test_popupwin_filter_mode() |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2575 func MyPopupFilter(winid, c) |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2576 let s:typed = a:c |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2577 if a:c == ':' || a:c == "\r" || a:c == 'v' |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2578 " can start cmdline mode, get out, and start/stop Visual mode |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2579 return 0 |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2580 endif |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2581 return 1 |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2582 endfunc |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2583 |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2584 " Normal, Visual and Insert mode |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2585 let winid = popup_create('something', #{filter: 'MyPopupFilter', filtermode: 'nvi'}) |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2586 redraw |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2587 call feedkeys('x', 'xt') |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2588 call assert_equal('x', s:typed) |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2589 |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2590 call feedkeys(":let g:foo = 'foo'\<CR>", 'xt') |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2591 call assert_equal(':', s:typed) |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2592 call assert_equal('foo', g:foo) |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2593 |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2594 let @x = 'something' |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2595 call feedkeys('v$"xy', 'xt') |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2596 call assert_equal('y', s:typed) |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2597 call assert_equal('something', @x) " yank command is filtered out |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2598 call feedkeys('v', 'xt') " end Visual mode |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2599 |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2600 call popup_close(winid) |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2601 |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2602 " only Normal mode |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2603 let winid = popup_create('something', #{filter: 'MyPopupFilter', filtermode: 'n'}) |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2604 redraw |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2605 call feedkeys('x', 'xt') |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2606 call assert_equal('x', s:typed) |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2607 |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2608 call feedkeys(":let g:foo = 'foo'\<CR>", 'xt') |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2609 call assert_equal(':', s:typed) |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2610 call assert_equal('foo', g:foo) |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2611 |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2612 let @x = 'something' |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2613 call feedkeys('v$"xy', 'xt') |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2614 call assert_equal('v', s:typed) |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2615 call assert_notequal('something', @x) |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2616 |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2617 call popup_close(winid) |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2618 |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2619 " default: all modes |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2620 let winid = popup_create('something', #{filter: 'MyPopupFilter'}) |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2621 redraw |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2622 call feedkeys('x', 'xt') |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2623 call assert_equal('x', s:typed) |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2624 |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2625 let g:foo = 'bar' |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2626 call feedkeys(":let g:foo = 'foo'\<CR>", 'xt') |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2627 call assert_equal("\r", s:typed) |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2628 call assert_equal('bar', g:foo) |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2629 |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2630 let @x = 'something' |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2631 call feedkeys('v$"xy', 'xt') |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2632 call assert_equal('y', s:typed) |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2633 call assert_equal('something', @x) " yank command is filtered out |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2634 call feedkeys('v', 'xt') " end Visual mode |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2635 |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2636 call popup_close(winid) |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2637 delfunc MyPopupFilter |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2638 endfunc |
ec4248c4b92c
patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
2639 |
18544
a6dbbedddce1
patch 8.1.2266: position unknown for a mouse click in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
18542
diff
changeset
|
2640 func Test_popupwin_filter_mouse() |
a6dbbedddce1
patch 8.1.2266: position unknown for a mouse click in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
18542
diff
changeset
|
2641 func MyPopupFilter(winid, c) |
18623
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2642 let g:got_mousepos = getmousepos() |
18544
a6dbbedddce1
patch 8.1.2266: position unknown for a mouse click in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
18542
diff
changeset
|
2643 return 0 |
a6dbbedddce1
patch 8.1.2266: position unknown for a mouse click in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
18542
diff
changeset
|
2644 endfunc |
a6dbbedddce1
patch 8.1.2266: position unknown for a mouse click in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
18542
diff
changeset
|
2645 |
18623
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2646 call setline(1, ['.'->repeat(25)]->repeat(10)) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2647 let winid = popup_create(['short', 'long line that will wrap', 'other'], #{ |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2648 \ line: 2, |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2649 \ col: 4, |
18544
a6dbbedddce1
patch 8.1.2266: position unknown for a mouse click in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
18542
diff
changeset
|
2650 \ maxwidth: 12, |
18623
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2651 \ padding: [], |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2652 \ border: [], |
18544
a6dbbedddce1
patch 8.1.2266: position unknown for a mouse click in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
18542
diff
changeset
|
2653 \ filter: 'MyPopupFilter', |
a6dbbedddce1
patch 8.1.2266: position unknown for a mouse click in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
18542
diff
changeset
|
2654 \ }) |
a6dbbedddce1
patch 8.1.2266: position unknown for a mouse click in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
18542
diff
changeset
|
2655 redraw |
18623
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2656 " 123456789012345678901 |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2657 " 1 ..................... |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2658 " 2 ...+--------------+.. |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2659 " 3 ...| |.. |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2660 " 4 ...| short |.. |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2661 " 5 ...| long line th |.. |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2662 " 6 ...| at will wrap |.. |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2663 " 7 ...| other |.. |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2664 " 8 ...| |.. |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2665 " 9 ...+--------------+.. |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2666 " 10 ..................... |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2667 let tests = [] |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2668 |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2669 func AddItemOutsidePopup(tests, row, col) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2670 eval a:tests->add(#{clickrow: a:row, clickcol: a:col, result: #{ |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2671 \ screenrow: a:row, screencol: a:col, |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2672 \ winid: win_getid(), winrow: a:row, wincol: a:col, |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2673 \ line: a:row, column: a:col, |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2674 \ }}) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2675 endfunc |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2676 func AddItemInPopupBorder(tests, winid, row, col) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2677 eval a:tests->add(#{clickrow: a:row, clickcol: a:col, result: #{ |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2678 \ screenrow: a:row, screencol: a:col, |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2679 \ winid: a:winid, winrow: a:row - 1, wincol: a:col - 3, |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2680 \ line: 0, column: 0, |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2681 \ }}) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2682 endfunc |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2683 func AddItemInPopupText(tests, winid, row, col, textline, textcol) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2684 eval a:tests->add(#{clickrow: a:row, clickcol: a:col, result: #{ |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2685 \ screenrow: a:row, screencol: a:col, |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2686 \ winid: a:winid, winrow: a:row - 1, wincol: a:col - 3, |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2687 \ line: a:textline, column: a:textcol, |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2688 \ }}) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2689 endfunc |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2690 |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2691 " above and below popup |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2692 for c in range(1, 21) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2693 call AddItemOutsidePopup(tests, 1, c) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2694 call AddItemOutsidePopup(tests, 10, c) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2695 endfor |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2696 " left and right of popup |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2697 for r in range(1, 10) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2698 call AddItemOutsidePopup(tests, r, 3) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2699 call AddItemOutsidePopup(tests, r, 20) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2700 endfor |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2701 " top and bottom in popup |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2702 for c in range(4, 19) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2703 call AddItemInPopupBorder(tests, winid, 2, c) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2704 call AddItemInPopupBorder(tests, winid, 3, c) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2705 call AddItemInPopupBorder(tests, winid, 8, c) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2706 call AddItemInPopupBorder(tests, winid, 9, c) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2707 endfor |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2708 " left and right margin in popup |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2709 for r in range(2, 9) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2710 call AddItemInPopupBorder(tests, winid, r, 4) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2711 call AddItemInPopupBorder(tests, winid, r, 5) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2712 call AddItemInPopupBorder(tests, winid, r, 18) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2713 call AddItemInPopupBorder(tests, winid, r, 19) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2714 endfor |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2715 " text "short" |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2716 call AddItemInPopupText(tests, winid, 4, 6, 1, 1) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2717 call AddItemInPopupText(tests, winid, 4, 10, 1, 5) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2718 call AddItemInPopupText(tests, winid, 4, 11, 1, 6) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2719 call AddItemInPopupText(tests, winid, 4, 17, 1, 6) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2720 " text "long line th" |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2721 call AddItemInPopupText(tests, winid, 5, 6, 2, 1) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2722 call AddItemInPopupText(tests, winid, 5, 10, 2, 5) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2723 call AddItemInPopupText(tests, winid, 5, 17, 2, 12) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2724 " text "at will wrap" |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2725 call AddItemInPopupText(tests, winid, 6, 6, 2, 13) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2726 call AddItemInPopupText(tests, winid, 6, 10, 2, 17) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2727 call AddItemInPopupText(tests, winid, 6, 17, 2, 24) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2728 " text "other" |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2729 call AddItemInPopupText(tests, winid, 7, 6, 3, 1) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2730 call AddItemInPopupText(tests, winid, 7, 10, 3, 5) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2731 call AddItemInPopupText(tests, winid, 7, 11, 3, 6) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2732 call AddItemInPopupText(tests, winid, 7, 17, 3, 6) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2733 |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2734 for item in tests |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2735 call test_setmouse(item.clickrow, item.clickcol) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2736 call feedkeys("\<LeftMouse>", 'xt') |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2737 call assert_equal(item.result, g:got_mousepos) |
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2738 endfor |
18544
a6dbbedddce1
patch 8.1.2266: position unknown for a mouse click in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
18542
diff
changeset
|
2739 |
a6dbbedddce1
patch 8.1.2266: position unknown for a mouse click in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
18542
diff
changeset
|
2740 call popup_close(winid) |
18623
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18613
diff
changeset
|
2741 enew! |
18544
a6dbbedddce1
patch 8.1.2266: position unknown for a mouse click in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
18542
diff
changeset
|
2742 delfunc MyPopupFilter |
a6dbbedddce1
patch 8.1.2266: position unknown for a mouse click in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
18542
diff
changeset
|
2743 endfunc |
a6dbbedddce1
patch 8.1.2266: position unknown for a mouse click in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
18542
diff
changeset
|
2744 |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2745 func Test_popupwin_with_buffer() |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
2746 call writefile(['some text', 'in a buffer'], 'XsomeFile', 'D') |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2747 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
|
2748 call assert_equal(0, bufloaded(buf)) |
17845
b6acc24df7de
patch 8.1.1919: using window options when passing a buffer to popup_create()
Bram Moolenaar <Bram@vim.org>
parents:
17841
diff
changeset
|
2749 |
b6acc24df7de
patch 8.1.1919: using window options when passing a buffer to popup_create()
Bram Moolenaar <Bram@vim.org>
parents:
17841
diff
changeset
|
2750 setlocal number |
b6acc24df7de
patch 8.1.1919: using window options when passing a buffer to popup_create()
Bram Moolenaar <Bram@vim.org>
parents:
17841
diff
changeset
|
2751 call setbufvar(buf, "&wrapmargin", 13) |
b6acc24df7de
patch 8.1.1919: using window options when passing a buffer to popup_create()
Bram Moolenaar <Bram@vim.org>
parents:
17841
diff
changeset
|
2752 |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2753 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
|
2754 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
|
2755 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
|
2756 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
|
2757 call assert_equal(1, bufloaded(buf)) |
17845
b6acc24df7de
patch 8.1.1919: using window options when passing a buffer to popup_create()
Bram Moolenaar <Bram@vim.org>
parents:
17841
diff
changeset
|
2758 |
b6acc24df7de
patch 8.1.1919: using window options when passing a buffer to popup_create()
Bram Moolenaar <Bram@vim.org>
parents:
17841
diff
changeset
|
2759 " window-local option is set to default, buffer-local is not |
b6acc24df7de
patch 8.1.1919: using window options when passing a buffer to popup_create()
Bram Moolenaar <Bram@vim.org>
parents:
17841
diff
changeset
|
2760 call assert_equal(0, getwinvar(winid, '&number')) |
b6acc24df7de
patch 8.1.1919: using window options when passing a buffer to popup_create()
Bram Moolenaar <Bram@vim.org>
parents:
17841
diff
changeset
|
2761 call assert_equal(13, getbufvar(buf, '&wrapmargin')) |
b6acc24df7de
patch 8.1.1919: using window options when passing a buffer to popup_create()
Bram Moolenaar <Bram@vim.org>
parents:
17841
diff
changeset
|
2762 |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2763 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
|
2764 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
|
2765 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
|
2766 exe 'bwipe! ' .. buf |
17845
b6acc24df7de
patch 8.1.1919: using window options when passing a buffer to popup_create()
Bram Moolenaar <Bram@vim.org>
parents:
17841
diff
changeset
|
2767 setlocal nonumber |
17231
e9ebf3f27af6
patch 8.1.1615: crash when passing buffer number to popup_create()
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
2768 |
e9ebf3f27af6
patch 8.1.1615: crash when passing buffer number to popup_create()
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
2769 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
|
2770 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
|
2771 redraw |
e9ebf3f27af6
patch 8.1.1615: crash when passing buffer number to popup_create()
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
2772 call popup_close(winid) |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
2773 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
|
2774 |
28319
427600f3b1c5
patch 8.2.4685: when a swap file is found for a popup there is no dialog
Bram Moolenaar <Bram@vim.org>
parents:
28279
diff
changeset
|
2775 func Test_popupwin_buffer_with_swapfile() |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
2776 call writefile(['some text', 'in a buffer'], 'XopenFile', 'D') |
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
2777 call writefile([''], '.XopenFile.swp', 'D') |
28319
427600f3b1c5
patch 8.2.4685: when a swap file is found for a popup there is no dialog
Bram Moolenaar <Bram@vim.org>
parents:
28279
diff
changeset
|
2778 let g:ignoreSwapExists = 1 |
427600f3b1c5
patch 8.2.4685: when a swap file is found for a popup there is no dialog
Bram Moolenaar <Bram@vim.org>
parents:
28279
diff
changeset
|
2779 |
427600f3b1c5
patch 8.2.4685: when a swap file is found for a popup there is no dialog
Bram Moolenaar <Bram@vim.org>
parents:
28279
diff
changeset
|
2780 let bufnr = bufadd('XopenFile') |
427600f3b1c5
patch 8.2.4685: when a swap file is found for a popup there is no dialog
Bram Moolenaar <Bram@vim.org>
parents:
28279
diff
changeset
|
2781 call assert_equal(0, bufloaded(bufnr)) |
427600f3b1c5
patch 8.2.4685: when a swap file is found for a popup there is no dialog
Bram Moolenaar <Bram@vim.org>
parents:
28279
diff
changeset
|
2782 let winid = popup_create(bufnr, {'hidden': 1}) |
427600f3b1c5
patch 8.2.4685: when a swap file is found for a popup there is no dialog
Bram Moolenaar <Bram@vim.org>
parents:
28279
diff
changeset
|
2783 call assert_equal(1, bufloaded(bufnr)) |
427600f3b1c5
patch 8.2.4685: when a swap file is found for a popup there is no dialog
Bram Moolenaar <Bram@vim.org>
parents:
28279
diff
changeset
|
2784 call popup_close(winid) |
427600f3b1c5
patch 8.2.4685: when a swap file is found for a popup there is no dialog
Bram Moolenaar <Bram@vim.org>
parents:
28279
diff
changeset
|
2785 |
427600f3b1c5
patch 8.2.4685: when a swap file is found for a popup there is no dialog
Bram Moolenaar <Bram@vim.org>
parents:
28279
diff
changeset
|
2786 exe 'buffer ' .. bufnr |
427600f3b1c5
patch 8.2.4685: when a swap file is found for a popup there is no dialog
Bram Moolenaar <Bram@vim.org>
parents:
28279
diff
changeset
|
2787 call assert_equal(1, &readonly) |
427600f3b1c5
patch 8.2.4685: when a swap file is found for a popup there is no dialog
Bram Moolenaar <Bram@vim.org>
parents:
28279
diff
changeset
|
2788 bwipe! |
427600f3b1c5
patch 8.2.4685: when a swap file is found for a popup there is no dialog
Bram Moolenaar <Bram@vim.org>
parents:
28279
diff
changeset
|
2789 |
427600f3b1c5
patch 8.2.4685: when a swap file is found for a popup there is no dialog
Bram Moolenaar <Bram@vim.org>
parents:
28279
diff
changeset
|
2790 unlet g:ignoreSwapExists |
427600f3b1c5
patch 8.2.4685: when a swap file is found for a popup there is no dialog
Bram Moolenaar <Bram@vim.org>
parents:
28279
diff
changeset
|
2791 endfunc |
427600f3b1c5
patch 8.2.4685: when a swap file is found for a popup there is no dialog
Bram Moolenaar <Bram@vim.org>
parents:
28279
diff
changeset
|
2792 |
18162
9c3347b21b89
patch 8.1.2076: crash when trying to put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
2793 func Test_popupwin_terminal_buffer() |
18168
781a81bf4d24
patch 8.1.2079: popup window test fails without +terminal
Bram Moolenaar <Bram@vim.org>
parents:
18162
diff
changeset
|
2794 CheckFeature terminal |
19275
2142fb624658
patch 8.2.0196: blocking commands for a finished job in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
2795 CheckUnix |
20395
8216bfb88709
patch 8.2.0752: terminal in popup window test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
20386
diff
changeset
|
2796 " Starting a terminal to run a shell in is considered flaky. |
8216bfb88709
patch 8.2.0752: terminal in popup window test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents:
20386
diff
changeset
|
2797 let g:test_is_flaky = 1 |
19275
2142fb624658
patch 8.2.0196: blocking commands for a finished job in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
2798 |
2142fb624658
patch 8.2.0196: blocking commands for a finished job in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
2799 let origwin = win_getid() |
22518
81ae5fa92928
patch 8.2.1807: can use :help in a terminal popup window
Bram Moolenaar <Bram@vim.org>
parents:
22442
diff
changeset
|
2800 |
81ae5fa92928
patch 8.2.1807: can use :help in a terminal popup window
Bram Moolenaar <Bram@vim.org>
parents:
22442
diff
changeset
|
2801 " open help window to test that :help below fails |
81ae5fa92928
patch 8.2.1807: can use :help in a terminal popup window
Bram Moolenaar <Bram@vim.org>
parents:
22442
diff
changeset
|
2802 help |
81ae5fa92928
patch 8.2.1807: can use :help in a terminal popup window
Bram Moolenaar <Bram@vim.org>
parents:
22442
diff
changeset
|
2803 |
20474
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20395
diff
changeset
|
2804 let termbuf = term_start(&shell, #{hidden: 1}) |
23041
139573353c6d
patch 8.2.2067: cursor position in popup terminal is wrong
Bram Moolenaar <Bram@vim.org>
parents:
22967
diff
changeset
|
2805 let winid = popup_create(termbuf, #{minwidth: 40, minheight: 10, border: []}) |
23217
0e4b3e7010df
patch 8.2.2154: popupwin test for terminal buffer fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
23215
diff
changeset
|
2806 " Wait for shell to start |
20474
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20395
diff
changeset
|
2807 call WaitForAssert({-> assert_equal("run", job_status(term_getjob(termbuf)))}) |
23217
0e4b3e7010df
patch 8.2.2154: popupwin test for terminal buffer fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
23215
diff
changeset
|
2808 " Wait for a prompt (see border char first, then space after prompt) |
0e4b3e7010df
patch 8.2.2154: popupwin test for terminal buffer fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
23215
diff
changeset
|
2809 call WaitForAssert({ -> assert_equal(' ', screenstring(screenrow(), screencol() - 1))}) |
23041
139573353c6d
patch 8.2.2067: cursor position in popup terminal is wrong
Bram Moolenaar <Bram@vim.org>
parents:
22967
diff
changeset
|
2810 |
139573353c6d
patch 8.2.2067: cursor position in popup terminal is wrong
Bram Moolenaar <Bram@vim.org>
parents:
22967
diff
changeset
|
2811 " When typing a character, the cursor is after it. |
139573353c6d
patch 8.2.2067: cursor position in popup terminal is wrong
Bram Moolenaar <Bram@vim.org>
parents:
22967
diff
changeset
|
2812 call feedkeys("x", 'xt') |
23217
0e4b3e7010df
patch 8.2.2154: popupwin test for terminal buffer fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
23215
diff
changeset
|
2813 call term_wait(termbuf) |
23041
139573353c6d
patch 8.2.2067: cursor position in popup terminal is wrong
Bram Moolenaar <Bram@vim.org>
parents:
22967
diff
changeset
|
2814 redraw |
139573353c6d
patch 8.2.2067: cursor position in popup terminal is wrong
Bram Moolenaar <Bram@vim.org>
parents:
22967
diff
changeset
|
2815 call WaitForAssert({ -> assert_equal('x', screenstring(screenrow(), screencol() - 1))}) |
139573353c6d
patch 8.2.2067: cursor position in popup terminal is wrong
Bram Moolenaar <Bram@vim.org>
parents:
22967
diff
changeset
|
2816 call feedkeys("\<BS>", 'xt') |
139573353c6d
patch 8.2.2067: cursor position in popup terminal is wrong
Bram Moolenaar <Bram@vim.org>
parents:
22967
diff
changeset
|
2817 |
19291
1d6bc6b31c2e
patch 8.2.0204: crash when using winnr('j') in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19275
diff
changeset
|
2818 " Check this doesn't crash |
1d6bc6b31c2e
patch 8.2.0204: crash when using winnr('j') in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19275
diff
changeset
|
2819 call assert_equal(winnr(), winnr('j')) |
1d6bc6b31c2e
patch 8.2.0204: crash when using winnr('j') in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19275
diff
changeset
|
2820 call assert_equal(winnr(), winnr('k')) |
1d6bc6b31c2e
patch 8.2.0204: crash when using winnr('j') in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19275
diff
changeset
|
2821 call assert_equal(winnr(), winnr('h')) |
1d6bc6b31c2e
patch 8.2.0204: crash when using winnr('j') in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19275
diff
changeset
|
2822 call assert_equal(winnr(), winnr('l')) |
20375
b790d00d5ccb
patch 8.2.0743: can move to another buffer from a terminal in popup window
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
2823 |
19275
2142fb624658
patch 8.2.0196: blocking commands for a finished job in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
2824 " Cannot quit while job is running |
2142fb624658
patch 8.2.0196: blocking commands for a finished job in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
2825 call assert_fails('call feedkeys("\<C-W>:quit\<CR>", "xt")', 'E948:') |
20375
b790d00d5ccb
patch 8.2.0743: can move to another buffer from a terminal in popup window
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
2826 |
20474
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20395
diff
changeset
|
2827 " Cannot enter Terminal-Normal mode. (TODO: but it works...) |
20375
b790d00d5ccb
patch 8.2.0743: can move to another buffer from a terminal in popup window
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
2828 call feedkeys("xxx\<C-W>N", 'xt') |
b790d00d5ccb
patch 8.2.0743: can move to another buffer from a terminal in popup window
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
2829 call assert_fails('call feedkeys("gf", "xt")', 'E863:') |
b790d00d5ccb
patch 8.2.0743: can move to another buffer from a terminal in popup window
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
2830 call feedkeys("a\<C-U>", 'xt') |
b790d00d5ccb
patch 8.2.0743: can move to another buffer from a terminal in popup window
Bram Moolenaar <Bram@vim.org>
parents:
20120
diff
changeset
|
2831 |
20561
18c52f380193
patch 8.2.0834: :drop command in terminal popup causes problems
Bram Moolenaar <Bram@vim.org>
parents:
20474
diff
changeset
|
2832 " Cannot escape from terminal window |
18c52f380193
patch 8.2.0834: :drop command in terminal popup causes problems
Bram Moolenaar <Bram@vim.org>
parents:
20474
diff
changeset
|
2833 call assert_fails('tab drop xxx', 'E863:') |
22518
81ae5fa92928
patch 8.2.1807: can use :help in a terminal popup window
Bram Moolenaar <Bram@vim.org>
parents:
22442
diff
changeset
|
2834 call assert_fails('help', 'E994:') |
20561
18c52f380193
patch 8.2.0834: :drop command in terminal popup causes problems
Bram Moolenaar <Bram@vim.org>
parents:
20474
diff
changeset
|
2835 |
20474
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20395
diff
changeset
|
2836 " Cannot open a second one. |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20395
diff
changeset
|
2837 let termbuf2 = term_start(&shell, #{hidden: 1}) |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20395
diff
changeset
|
2838 call assert_fails('call popup_create(termbuf2, #{})', 'E861:') |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20395
diff
changeset
|
2839 call term_sendkeys(termbuf2, "exit\<CR>") |
3fe45aa3bbc5
patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents:
20395
diff
changeset
|
2840 |
29032
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2841 " Exiting shell puts popup window in Terminal-Normal mode. |
19275
2142fb624658
patch 8.2.0196: blocking commands for a finished job in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
2842 call feedkeys("exit\<CR>", 'xt') |
2142fb624658
patch 8.2.0196: blocking commands for a finished job in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
2843 " Wait for shell to exit |
20974
769f5a2d0879
patch 8.2.1038: popupwin test fails
Bram Moolenaar <Bram@vim.org>
parents:
20970
diff
changeset
|
2844 call WaitForAssert({-> assert_equal("dead", job_status(term_getjob(termbuf)))}) |
20970
736d6e6f55f6
patch 8.2.1036: popupwin test fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
20937
diff
changeset
|
2845 |
22518
81ae5fa92928
patch 8.2.1807: can use :help in a terminal popup window
Bram Moolenaar <Bram@vim.org>
parents:
22442
diff
changeset
|
2846 helpclose |
19275
2142fb624658
patch 8.2.0196: blocking commands for a finished job in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
2847 call feedkeys(":quit\<CR>", 'xt') |
2142fb624658
patch 8.2.0196: blocking commands for a finished job in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19241
diff
changeset
|
2848 call assert_equal(origwin, win_getid()) |
18162
9c3347b21b89
patch 8.1.2076: crash when trying to put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
2849 endfunc |
9c3347b21b89
patch 8.1.2076: crash when trying to put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
18137
diff
changeset
|
2850 |
29038
ad99b7b9df13
patch 8.2.5041: cannot close a terminal popup with "NONE" job
Bram Moolenaar <Bram@vim.org>
parents:
29036
diff
changeset
|
2851 func Test_popupwin_terminal_buffer_none() |
ad99b7b9df13
patch 8.2.5041: cannot close a terminal popup with "NONE" job
Bram Moolenaar <Bram@vim.org>
parents:
29036
diff
changeset
|
2852 CheckFeature terminal |
ad99b7b9df13
patch 8.2.5041: cannot close a terminal popup with "NONE" job
Bram Moolenaar <Bram@vim.org>
parents:
29036
diff
changeset
|
2853 CheckUnix |
ad99b7b9df13
patch 8.2.5041: cannot close a terminal popup with "NONE" job
Bram Moolenaar <Bram@vim.org>
parents:
29036
diff
changeset
|
2854 |
ad99b7b9df13
patch 8.2.5041: cannot close a terminal popup with "NONE" job
Bram Moolenaar <Bram@vim.org>
parents:
29036
diff
changeset
|
2855 " Starting a terminal to run a shell in is considered flaky. |
ad99b7b9df13
patch 8.2.5041: cannot close a terminal popup with "NONE" job
Bram Moolenaar <Bram@vim.org>
parents:
29036
diff
changeset
|
2856 let g:test_is_flaky = 1 |
ad99b7b9df13
patch 8.2.5041: cannot close a terminal popup with "NONE" job
Bram Moolenaar <Bram@vim.org>
parents:
29036
diff
changeset
|
2857 |
ad99b7b9df13
patch 8.2.5041: cannot close a terminal popup with "NONE" job
Bram Moolenaar <Bram@vim.org>
parents:
29036
diff
changeset
|
2858 let origwin = win_getid() |
ad99b7b9df13
patch 8.2.5041: cannot close a terminal popup with "NONE" job
Bram Moolenaar <Bram@vim.org>
parents:
29036
diff
changeset
|
2859 call term_start("NONE", {"hidden": 1})->popup_create({"border": []}) |
ad99b7b9df13
patch 8.2.5041: cannot close a terminal popup with "NONE" job
Bram Moolenaar <Bram@vim.org>
parents:
29036
diff
changeset
|
2860 sleep 50m |
ad99b7b9df13
patch 8.2.5041: cannot close a terminal popup with "NONE" job
Bram Moolenaar <Bram@vim.org>
parents:
29036
diff
changeset
|
2861 |
ad99b7b9df13
patch 8.2.5041: cannot close a terminal popup with "NONE" job
Bram Moolenaar <Bram@vim.org>
parents:
29036
diff
changeset
|
2862 " since no actual job is running can close the window with :quit |
ad99b7b9df13
patch 8.2.5041: cannot close a terminal popup with "NONE" job
Bram Moolenaar <Bram@vim.org>
parents:
29036
diff
changeset
|
2863 call feedkeys("\<C-W>:q\<CR>", 'xt') |
ad99b7b9df13
patch 8.2.5041: cannot close a terminal popup with "NONE" job
Bram Moolenaar <Bram@vim.org>
parents:
29036
diff
changeset
|
2864 call assert_equal([], popup_list()) |
ad99b7b9df13
patch 8.2.5041: cannot close a terminal popup with "NONE" job
Bram Moolenaar <Bram@vim.org>
parents:
29036
diff
changeset
|
2865 |
ad99b7b9df13
patch 8.2.5041: cannot close a terminal popup with "NONE" job
Bram Moolenaar <Bram@vim.org>
parents:
29036
diff
changeset
|
2866 call assert_equal(origwin, win_getid()) |
ad99b7b9df13
patch 8.2.5041: cannot close a terminal popup with "NONE" job
Bram Moolenaar <Bram@vim.org>
parents:
29036
diff
changeset
|
2867 endfunc |
ad99b7b9df13
patch 8.2.5041: cannot close a terminal popup with "NONE" job
Bram Moolenaar <Bram@vim.org>
parents:
29036
diff
changeset
|
2868 |
29032
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2869 func Test_popupwin_terminal_scrollbar() |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2870 CheckFeature terminal |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2871 CheckScreendump |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2872 CheckUnix |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2873 |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
2874 call writefile(range(50), 'Xtestfile', 'D') |
29032
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2875 let lines =<< trim END |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2876 vim9script |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2877 |
29046
ab7f050f4335
patch 8.2.5045: can escape a terminal popup window when the job is finished
Bram Moolenaar <Bram@vim.org>
parents:
29040
diff
changeset
|
2878 # testing CTRL-W CTRL-W requires two windows |
ab7f050f4335
patch 8.2.5045: can escape a terminal popup window when the job is finished
Bram Moolenaar <Bram@vim.org>
parents:
29040
diff
changeset
|
2879 split |
ab7f050f4335
patch 8.2.5045: can escape a terminal popup window when the job is finished
Bram Moolenaar <Bram@vim.org>
parents:
29040
diff
changeset
|
2880 |
29032
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2881 term_start(['cat', 'Xtestfile'], {hidden: true}) |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2882 ->popup_create({ |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2883 minwidth: 40, |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2884 maxwidth: 40, |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2885 minheight: 8, |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2886 maxheight: 8, |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2887 scrollbar: true, |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2888 border: [] |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2889 }) |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2890 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
2891 call writefile(lines, 'Xpterm', 'D') |
29032
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2892 let buf = RunVimInTerminal('-S Xpterm', #{rows: 15}) |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2893 call VerifyScreenDump(buf, 'Test_popupwin_poptermscroll_1', {}) |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2894 |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2895 " scroll to the middle |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2896 call term_sendkeys(buf, "50%") |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2897 call VerifyScreenDump(buf, 'Test_popupwin_poptermscroll_2', {}) |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2898 |
29046
ab7f050f4335
patch 8.2.5045: can escape a terminal popup window when the job is finished
Bram Moolenaar <Bram@vim.org>
parents:
29040
diff
changeset
|
2899 " get error if trying to escape the window |
ab7f050f4335
patch 8.2.5045: can escape a terminal popup window when the job is finished
Bram Moolenaar <Bram@vim.org>
parents:
29040
diff
changeset
|
2900 call term_sendkeys(buf, "\<C-W>\<C-W>") |
ab7f050f4335
patch 8.2.5045: can escape a terminal popup window when the job is finished
Bram Moolenaar <Bram@vim.org>
parents:
29040
diff
changeset
|
2901 call VerifyScreenDump(buf, 'Test_popupwin_poptermscroll_3', {}) |
ab7f050f4335
patch 8.2.5045: can escape a terminal popup window when the job is finished
Bram Moolenaar <Bram@vim.org>
parents:
29040
diff
changeset
|
2902 |
29032
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2903 " close the popupwin. |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2904 call term_sendkeys(buf, ":q\<CR>") |
29046
ab7f050f4335
patch 8.2.5045: can escape a terminal popup window when the job is finished
Bram Moolenaar <Bram@vim.org>
parents:
29040
diff
changeset
|
2905 call VerifyScreenDump(buf, 'Test_popupwin_poptermscroll_4', {}) |
29032
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2906 |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2907 call StopVimInTerminal(buf) |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2908 endfunc |
361b46a07f5e
patch 8.2.5038: a finished terminal in a popup window does not show scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
28778
diff
changeset
|
2909 |
20865
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20561
diff
changeset
|
2910 func Test_popupwin_close_prevwin() |
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20561
diff
changeset
|
2911 CheckFeature terminal |
22057
f64a16f5bff0
patch 8.2.1578: Vim9: popup_clear() does not take "true" as argument
Bram Moolenaar <Bram@vim.org>
parents:
21897
diff
changeset
|
2912 call Popupwin_close_prevwin() |
f64a16f5bff0
patch 8.2.1578: Vim9: popup_clear() does not take "true" as argument
Bram Moolenaar <Bram@vim.org>
parents:
21897
diff
changeset
|
2913 endfunc |
f64a16f5bff0
patch 8.2.1578: Vim9: popup_clear() does not take "true" as argument
Bram Moolenaar <Bram@vim.org>
parents:
21897
diff
changeset
|
2914 |
f64a16f5bff0
patch 8.2.1578: Vim9: popup_clear() does not take "true" as argument
Bram Moolenaar <Bram@vim.org>
parents:
21897
diff
changeset
|
2915 def Popupwin_close_prevwin() |
f64a16f5bff0
patch 8.2.1578: Vim9: popup_clear() does not take "true" as argument
Bram Moolenaar <Bram@vim.org>
parents:
21897
diff
changeset
|
2916 assert_equal(1, winnr('$')) |
20865
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20561
diff
changeset
|
2917 split |
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20561
diff
changeset
|
2918 wincmd b |
22057
f64a16f5bff0
patch 8.2.1578: Vim9: popup_clear() does not take "true" as argument
Bram Moolenaar <Bram@vim.org>
parents:
21897
diff
changeset
|
2919 assert_equal(2, winnr()) |
23072
4b398a229b0b
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents:
23041
diff
changeset
|
2920 var buf = term_start(&shell, {hidden: 1}) |
22057
f64a16f5bff0
patch 8.2.1578: Vim9: popup_clear() does not take "true" as argument
Bram Moolenaar <Bram@vim.org>
parents:
21897
diff
changeset
|
2921 popup_create(buf, {}) |
27457
4c16acb2525f
patch 8.2.4257: Vim9: finding global function without g: prefix inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
26332
diff
changeset
|
2922 g:TermWait(buf, 100) |
22057
f64a16f5bff0
patch 8.2.1578: Vim9: popup_clear() does not take "true" as argument
Bram Moolenaar <Bram@vim.org>
parents:
21897
diff
changeset
|
2923 popup_clear(true) |
f64a16f5bff0
patch 8.2.1578: Vim9: popup_clear() does not take "true" as argument
Bram Moolenaar <Bram@vim.org>
parents:
21897
diff
changeset
|
2924 assert_equal(2, winnr()) |
20865
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20561
diff
changeset
|
2925 |
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20561
diff
changeset
|
2926 quit |
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20561
diff
changeset
|
2927 exe 'bwipe! ' .. buf |
22057
f64a16f5bff0
patch 8.2.1578: Vim9: popup_clear() does not take "true" as argument
Bram Moolenaar <Bram@vim.org>
parents:
21897
diff
changeset
|
2928 enddef |
20865
0e4cf74642a3
patch 8.2.0984: not using previous window when closing a shell popup window
Bram Moolenaar <Bram@vim.org>
parents:
20561
diff
changeset
|
2929 |
17934
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2930 func Test_popupwin_with_buffer_and_filter() |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2931 new Xwithfilter |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2932 call setline(1, range(100)) |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2933 let bufnr = bufnr() |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2934 hide |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2935 |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2936 func BufferFilter(win, key) |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2937 if a:key == 'G' |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2938 " recursive use of "G" does not cause problems. |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2939 call win_execute(a:win, 'normal! G') |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2940 return 1 |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2941 endif |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2942 return 0 |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2943 endfunc |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2944 |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2945 let winid = popup_create(bufnr, #{maxheight: 5, filter: 'BufferFilter'}) |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2946 call assert_equal(1, popup_getpos(winid).firstline) |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2947 redraw |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2948 call feedkeys("G", 'xt') |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2949 call assert_equal(99, popup_getpos(winid).firstline) |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2950 |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2951 call popup_close(winid) |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2952 exe 'bwipe! ' .. bufnr |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2953 endfunc |
0bf8cb0258be
patch 8.1.1963: popup window filter may be called recursively
Bram Moolenaar <Bram@vim.org>
parents:
17926
diff
changeset
|
2954 |
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
|
2955 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
|
2956 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
|
2957 \ maxwidth: 40, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
2958 \ 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
|
2959 \ }) |
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
|
2960 for top in range(1, 20) |
17972
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17946
diff
changeset
|
2961 eval winid->popup_setoptions(#{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
|
2962 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
|
2963 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
|
2964 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
|
2965 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
|
2966 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
|
2967 |
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
|
2968 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
|
2969 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
|
2970 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
|
2971 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
|
2972 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
|
2973 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
|
2974 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
|
2975 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
|
2976 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
|
2977 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
|
2978 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
|
2979 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
|
2980 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
|
2981 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
|
2982 |
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
|
2983 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
|
2984 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
|
2985 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
|
2986 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
|
2987 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
|
2988 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
|
2989 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
|
2990 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
|
2991 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
|
2992 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
|
2993 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
|
2994 |
102ed3a26a5d
patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
17348
diff
changeset
|
2995 func Test_popup_menu_with_maxwidth() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
2996 CheckScreendump |
17354
102ed3a26a5d
patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
17348
diff
changeset
|
2997 |
102ed3a26a5d
patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
17348
diff
changeset
|
2998 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
|
2999 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
|
3000 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
|
3001 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
|
3002 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
|
3003 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
|
3004 \ maxwidth: 10, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
3005 \ maxheight: 3, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
3006 \ pos : 'topleft', |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
3007 \ 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
|
3008 \ 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
|
3009 \ 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
|
3010 \ }) |
102ed3a26a5d
patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
17348
diff
changeset
|
3011 endfunc |
102ed3a26a5d
patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
17348
diff
changeset
|
3012 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
|
3013 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
|
3014 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
|
3015 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
|
3016 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
|
3017 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
3018 call writefile(lines, 'XtestPopupMenuMaxWidth', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
3019 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
|
3020 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
|
3021 |
102ed3a26a5d
patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
17348
diff
changeset
|
3022 " 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
|
3023 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
|
3024 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
|
3025 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
|
3026 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
|
3027 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
|
3028 |
102ed3a26a5d
patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
17348
diff
changeset
|
3029 " 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
|
3030 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
|
3031 endfunc |
102ed3a26a5d
patch 8.1.1676: "maxwidth" of popup window does not always work properly
Bram Moolenaar <Bram@vim.org>
parents:
17348
diff
changeset
|
3032 |
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
|
3033 func Test_popup_menu_with_scrollbar() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
3034 CheckScreendump |
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
|
3035 |
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
|
3036 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
|
3037 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
|
3038 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
|
3039 hi ScrollBar ctermbg=red |
17972
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17946
diff
changeset
|
3040 eval ['one', 'two', 'three', 'four', 'five', |
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17946
diff
changeset
|
3041 \ 'six', 'seven', 'eight', 'nine'] |
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17946
diff
changeset
|
3042 \ ->popup_menu(#{ |
17368
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
3043 \ minwidth: 8, |
6604ecb7a615
patch 8.1.1683: dictionary with string keys is longer than needed
Bram Moolenaar <Bram@vim.org>
parents:
17358
diff
changeset
|
3044 \ 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
|
3045 \ }) |
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
|
3046 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
3047 call writefile(lines, 'XtestPopupMenuScroll', 'D') |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
3048 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
|
3049 |
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
|
3050 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
|
3051 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
|
3052 |
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
|
3053 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
|
3054 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
|
3055 |
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
|
3056 " 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
|
3057 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
|
3058 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
|
3059 |
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
|
3060 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
|
3061 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
|
3062 |
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
|
3063 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
|
3064 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
|
3065 |
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
|
3066 " 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
|
3067 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
|
3068 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
|
3069 |
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
|
3070 " 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
|
3071 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
|
3072 |
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
|
3073 " 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
|
3074 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
|
3075 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
|
3076 |
17429
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3077 func Test_popup_menu_filter() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
3078 CheckScreendump |
17429
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3079 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3080 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
|
3081 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
|
3082 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
|
3083 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
|
3084 return 1 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3085 endif |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3086 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
|
3087 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
|
3088 return 1 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3089 endif |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3090 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
|
3091 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
|
3092 return 1 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3093 endif |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3094 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
|
3095 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
|
3096 return 1 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3097 endif |
18002
2fdbcecab216
patch 8.1.1997: no redraw after a popup window filter is invoked
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
3098 if a:key == ':' |
17429
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3099 call popup_close(a:winid) |
18002
2fdbcecab216
patch 8.1.1997: no redraw after a popup window filter is invoked
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
3100 return 0 |
17429
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3101 endif |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3102 return 0 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3103 endfunction |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3104 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
|
3105 \ maxheight : 3, |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3106 \ filter : 'MyFilter' |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3107 \ }) |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3108 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
3109 call writefile(lines, 'XtestPopupMenuFilter', 'D') |
17429
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3110 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
|
3111 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3112 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
|
3113 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
|
3114 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3115 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
|
3116 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
|
3117 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3118 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
|
3119 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
|
3120 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3121 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
|
3122 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
|
3123 |
18002
2fdbcecab216
patch 8.1.1997: no redraw after a popup window filter is invoked
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
3124 " check that when the popup is closed in the filter the screen is redrawn |
2fdbcecab216
patch 8.1.1997: no redraw after a popup window filter is invoked
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
3125 call term_sendkeys(buf, ":") |
2fdbcecab216
patch 8.1.1997: no redraw after a popup window filter is invoked
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
3126 call VerifyScreenDump(buf, 'Test_popupwin_menu_filter_5', {}) |
2fdbcecab216
patch 8.1.1997: no redraw after a popup window filter is invoked
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
3127 call term_sendkeys(buf, "\<CR>") |
17429
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3128 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3129 " clean up |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3130 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
|
3131 endfunc |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3132 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3133 func Test_popup_cursorline() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
3134 CheckScreendump |
17429
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3135 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3136 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
|
3137 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
|
3138 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
|
3139 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3140 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
|
3141 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
|
3142 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
|
3143 |
23998
0967c54ff3b2
patch 8.2.2541: popup_create() does not allow boolean for "cursorline"
Bram Moolenaar <Bram@vim.org>
parents:
23936
diff
changeset
|
3144 let winid = popup_create('some text', #{ cursorline: v:true, }) |
0967c54ff3b2
patch 8.2.2541: popup_create() does not allow boolean for "cursorline"
Bram Moolenaar <Bram@vim.org>
parents:
23936
diff
changeset
|
3145 call assert_equal(1, popup_getoptions(winid).cursorline) |
0967c54ff3b2
patch 8.2.2541: popup_create() does not allow boolean for "cursorline"
Bram Moolenaar <Bram@vim.org>
parents:
23936
diff
changeset
|
3146 call popup_close(winid) |
0967c54ff3b2
patch 8.2.2541: popup_create() does not allow boolean for "cursorline"
Bram Moolenaar <Bram@vim.org>
parents:
23936
diff
changeset
|
3147 |
17429
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3148 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
|
3149 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
|
3150 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
|
3151 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3152 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
|
3153 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
|
3154 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
|
3155 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3156 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
|
3157 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
|
3158 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
|
3159 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3160 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
|
3161 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
|
3162 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
|
3163 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3164 " --------- |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3165 " Pattern 1 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3166 " --------- |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3167 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
|
3168 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
|
3169 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
3170 call writefile(lines, 'XtestPopupCursorLine', 'D') |
17429
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3171 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
|
3172 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
|
3173 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
|
3174 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
|
3175 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3176 " --------- |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3177 " Pattern 2 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3178 " --------- |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3179 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
|
3180 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
|
3181 END |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3182 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
|
3183 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
|
3184 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
|
3185 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
|
3186 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
|
3187 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3188 " --------- |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3189 " Pattern 3 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3190 " --------- |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3191 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
|
3192 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
|
3193 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
|
3194 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
|
3195 return 1 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3196 endif |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3197 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
|
3198 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
|
3199 return 1 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3200 endif |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3201 return 0 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3202 endfunction |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3203 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
|
3204 \ cursorline : 0, |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3205 \ maxheight : 2, |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3206 \ filter : 'MyFilter', |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3207 \ }) |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3208 END |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3209 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
|
3210 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
|
3211 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
|
3212 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
|
3213 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
|
3214 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
|
3215 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
|
3216 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
|
3217 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3218 " --------- |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3219 " Pattern 4 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3220 " --------- |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3221 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
|
3222 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
|
3223 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
|
3224 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
|
3225 return 1 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3226 endif |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3227 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
|
3228 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
|
3229 return 1 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3230 endif |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3231 return 0 |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3232 endfunction |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3233 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
|
3234 \ cursorline : 1, |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3235 \ maxheight : 2, |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3236 \ filter : 'MyFilter', |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3237 \ }) |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3238 END |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3239 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
|
3240 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
|
3241 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
|
3242 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
|
3243 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
|
3244 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
|
3245 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
|
3246 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
|
3247 |
18027
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18002
diff
changeset
|
3248 " --------- |
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18002
diff
changeset
|
3249 " Cursor in second line when creating the popup |
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18002
diff
changeset
|
3250 " --------- |
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18002
diff
changeset
|
3251 let lines =<< trim END |
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18002
diff
changeset
|
3252 let winid = popup_create(['111', '222', '333'], #{ |
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18002
diff
changeset
|
3253 \ cursorline : 1, |
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18002
diff
changeset
|
3254 \ }) |
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18002
diff
changeset
|
3255 call win_execute(winid, "2") |
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18002
diff
changeset
|
3256 END |
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18002
diff
changeset
|
3257 call writefile(lines, 'XtestPopupCursorLine') |
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18002
diff
changeset
|
3258 let buf = RunVimInTerminal('-S XtestPopupCursorLine', #{rows: 10}) |
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18002
diff
changeset
|
3259 call VerifyScreenDump(buf, 'Test_popupwin_cursorline_7', {}) |
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18002
diff
changeset
|
3260 call StopVimInTerminal(buf) |
56032a704448
patch 8.1.2009: cursorline highlighting not updated in popup window
Bram Moolenaar <Bram@vim.org>
parents:
18002
diff
changeset
|
3261 |
18603
f249b44039e0
patch 8.1.2295: if buffer of popup is in another window cursorline sign shows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3262 " --------- |
f249b44039e0
patch 8.1.2295: if buffer of popup is in another window cursorline sign shows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3263 " Use current buffer for popupmenu |
f249b44039e0
patch 8.1.2295: if buffer of popup is in another window cursorline sign shows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3264 " --------- |
f249b44039e0
patch 8.1.2295: if buffer of popup is in another window cursorline sign shows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3265 let lines =<< trim END |
f249b44039e0
patch 8.1.2295: if buffer of popup is in another window cursorline sign shows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3266 call setline(1, ['one', 'two', 'three']) |
f249b44039e0
patch 8.1.2295: if buffer of popup is in another window cursorline sign shows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3267 let winid = popup_create(bufnr('%'), #{ |
f249b44039e0
patch 8.1.2295: if buffer of popup is in another window cursorline sign shows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3268 \ cursorline : 1, |
f249b44039e0
patch 8.1.2295: if buffer of popup is in another window cursorline sign shows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3269 \ }) |
f249b44039e0
patch 8.1.2295: if buffer of popup is in another window cursorline sign shows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3270 call win_execute(winid, "2") |
f249b44039e0
patch 8.1.2295: if buffer of popup is in another window cursorline sign shows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3271 END |
f249b44039e0
patch 8.1.2295: if buffer of popup is in another window cursorline sign shows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3272 call writefile(lines, 'XtestPopupCursorLine') |
f249b44039e0
patch 8.1.2295: if buffer of popup is in another window cursorline sign shows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3273 let buf = RunVimInTerminal('-S XtestPopupCursorLine', #{rows: 10}) |
f249b44039e0
patch 8.1.2295: if buffer of popup is in another window cursorline sign shows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3274 call VerifyScreenDump(buf, 'Test_popupwin_cursorline_8', {}) |
f249b44039e0
patch 8.1.2295: if buffer of popup is in another window cursorline sign shows
Bram Moolenaar <Bram@vim.org>
parents:
18597
diff
changeset
|
3275 call StopVimInTerminal(buf) |
17429
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3276 endfunc |
6e756ad5ef1a
patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents:
17421
diff
changeset
|
3277 |
23998
0967c54ff3b2
patch 8.2.2541: popup_create() does not allow boolean for "cursorline"
Bram Moolenaar <Bram@vim.org>
parents:
23936
diff
changeset
|
3278 def Test_popup_cursorline_vim9() |
0967c54ff3b2
patch 8.2.2541: popup_create() does not allow boolean for "cursorline"
Bram Moolenaar <Bram@vim.org>
parents:
23936
diff
changeset
|
3279 var winid = popup_create('some text', { cursorline: true, }) |
0967c54ff3b2
patch 8.2.2541: popup_create() does not allow boolean for "cursorline"
Bram Moolenaar <Bram@vim.org>
parents:
23936
diff
changeset
|
3280 assert_equal(1, popup_getoptions(winid).cursorline) |
0967c54ff3b2
patch 8.2.2541: popup_create() does not allow boolean for "cursorline"
Bram Moolenaar <Bram@vim.org>
parents:
23936
diff
changeset
|
3281 popup_close(winid) |
0967c54ff3b2
patch 8.2.2541: popup_create() does not allow boolean for "cursorline"
Bram Moolenaar <Bram@vim.org>
parents:
23936
diff
changeset
|
3282 |
0967c54ff3b2
patch 8.2.2541: popup_create() does not allow boolean for "cursorline"
Bram Moolenaar <Bram@vim.org>
parents:
23936
diff
changeset
|
3283 assert_fails("popup_create('some text', { cursorline: 2, })", 'E1023:') |
0967c54ff3b2
patch 8.2.2541: popup_create() does not allow boolean for "cursorline"
Bram Moolenaar <Bram@vim.org>
parents:
23936
diff
changeset
|
3284 popup_clear() |
0967c54ff3b2
patch 8.2.2541: popup_create() does not allow boolean for "cursorline"
Bram Moolenaar <Bram@vim.org>
parents:
23936
diff
changeset
|
3285 enddef |
0967c54ff3b2
patch 8.2.2541: popup_create() does not allow boolean for "cursorline"
Bram Moolenaar <Bram@vim.org>
parents:
23936
diff
changeset
|
3286 |
17438
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
3287 func Test_previewpopup() |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
3288 CheckScreendump |
18767
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3289 CheckFeature quickfix |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17644
diff
changeset
|
3290 |
17438
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
3291 call writefile([ |
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
3292 \ "!_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
|
3293 \ "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
|
3294 \ "theword\tXtagfile\t/^theword"], |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
3295 \ 'Xtags', 'D') |
17438
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
3296 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
|
3297 \ + ['theword is here'] |
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
3298 \ + range(22, 27) |
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
3299 \ + ['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
|
3300 \ + range(29, 40), |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
3301 \ "Xtagfile", 'D') |
17644
daa1dea1c1b3
patch 8.1.1819: :pedit does not work with a popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
3302 call writefile(range(1,10) |
daa1dea1c1b3
patch 8.1.1819: :pedit does not work with a popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
3303 \ + ['searched word is here'] |
daa1dea1c1b3
patch 8.1.1819: :pedit does not work with a popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
3304 \ + range(12, 20), |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
3305 \ "Xheader.h", 'D') |
17438
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
3306 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
|
3307 set tags=Xtags |
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
3308 call setline(1, [ |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3309 \ 'one', |
17644
daa1dea1c1b3
patch 8.1.1819: :pedit does not work with a popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
3310 \ '#include "Xheader.h"', |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3311 \ 'three', |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3312 \ 'four', |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3313 \ 'five', |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3314 \ 'six', |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3315 \ 'seven', |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3316 \ 'find theword somewhere', |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3317 \ 'nine', |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3318 \ 'this is another word', |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3319 \ 'very long line where the word is also another']) |
17438
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
3320 set previewpopup=height:4,width:40 |
24053
bcf16185be60
patch 8.2.2568: second time a preview popup is opened highlight is not set
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
3321 hi OtherColor ctermbg=lightcyan guibg=lightcyan |
17644
daa1dea1c1b3
patch 8.1.1819: :pedit does not work with a popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
3322 set path=. |
17438
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
3323 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
3324 call writefile(lines, 'XtestPreviewPopup', 'D') |
17438
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
3325 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
|
3326 |
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
3327 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
|
3328 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
|
3329 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
|
3330 |
24053
bcf16185be60
patch 8.2.2568: second time a preview popup is opened highlight is not set
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
3331 call term_sendkeys(buf, ":set previewpopup+=highlight:OtherColor\<CR>") |
17438
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
3332 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
|
3333 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
|
3334 |
17817
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
3335 call term_sendkeys(buf, ":call popup_move(popup_findpreview(), #{col: 15})\<CR>") |
17551
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3336 call term_sendkeys(buf, ":\<CR>") |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3337 call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_3', {}) |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3338 |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3339 call term_sendkeys(buf, "/another\<CR>\<C-W>}") |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3340 call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_4', {}) |
8cca2654d459
patch 8.1.1773: the preview popup window may be too far to the right
Bram Moolenaar <Bram@vim.org>
parents:
17442
diff
changeset
|
3341 |
19368
fcd5a2acbb3d
patch 8.2.0242: preview popup window test fails with long directory name
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
3342 call term_sendkeys(buf, ":silent cd ..\<CR>:\<CR>") |
17604
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
3343 call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_5', {}) |
19368
fcd5a2acbb3d
patch 8.2.0242: preview popup window test fails with long directory name
Bram Moolenaar <Bram@vim.org>
parents:
19291
diff
changeset
|
3344 call term_sendkeys(buf, ":silent cd testdir\<CR>") |
17644
daa1dea1c1b3
patch 8.1.1819: :pedit does not work with a popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
3345 |
24053
bcf16185be60
patch 8.2.2568: second time a preview popup is opened highlight is not set
Bram Moolenaar <Bram@vim.org>
parents:
23998
diff
changeset
|
3346 call term_sendkeys(buf, ":set previewpopup-=highlight:OtherColor\<CR>") |
17644
daa1dea1c1b3
patch 8.1.1819: :pedit does not work with a popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
3347 call term_sendkeys(buf, ":pclose\<CR>") |
17718
6a73e3bd0ff8
patch 8.1.1856: popup preview test fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
17680
diff
changeset
|
3348 call term_sendkeys(buf, ":\<BS>") |
17644
daa1dea1c1b3
patch 8.1.1819: :pedit does not work with a popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
3349 call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_6', {}) |
daa1dea1c1b3
patch 8.1.1819: :pedit does not work with a popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
3350 |
daa1dea1c1b3
patch 8.1.1819: :pedit does not work with a popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
3351 call term_sendkeys(buf, ":pedit +/theword Xtagfile\<CR>") |
daa1dea1c1b3
patch 8.1.1819: :pedit does not work with a popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
3352 call term_sendkeys(buf, ":\<CR>") |
daa1dea1c1b3
patch 8.1.1819: :pedit does not work with a popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
3353 call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_7', {}) |
daa1dea1c1b3
patch 8.1.1819: :pedit does not work with a popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
3354 |
daa1dea1c1b3
patch 8.1.1819: :pedit does not work with a popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
3355 call term_sendkeys(buf, ":pclose\<CR>") |
daa1dea1c1b3
patch 8.1.1819: :pedit does not work with a popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
3356 call term_sendkeys(buf, ":psearch searched\<CR>") |
daa1dea1c1b3
patch 8.1.1819: :pedit does not work with a popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
3357 call term_sendkeys(buf, ":\<CR>") |
daa1dea1c1b3
patch 8.1.1819: :pedit does not work with a popup preview window
Bram Moolenaar <Bram@vim.org>
parents:
17634
diff
changeset
|
3358 call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_8', {}) |
17604
506dd2efcbb2
patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17580
diff
changeset
|
3359 |
19166
215793f6b59d
patch 8.2.0142: possible to enter popup window with CTRL-W p
Bram Moolenaar <Bram@vim.org>
parents:
19135
diff
changeset
|
3360 call term_sendkeys(buf, "\<C-W>p") |
215793f6b59d
patch 8.2.0142: possible to enter popup window with CTRL-W p
Bram Moolenaar <Bram@vim.org>
parents:
19135
diff
changeset
|
3361 call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_9', {}) |
215793f6b59d
patch 8.2.0142: possible to enter popup window with CTRL-W p
Bram Moolenaar <Bram@vim.org>
parents:
19135
diff
changeset
|
3362 |
215793f6b59d
patch 8.2.0142: possible to enter popup window with CTRL-W p
Bram Moolenaar <Bram@vim.org>
parents:
19135
diff
changeset
|
3363 call term_sendkeys(buf, ":call win_execute(popup_findpreview(), 'call popup_clear()')\<CR>") |
215793f6b59d
patch 8.2.0142: possible to enter popup window with CTRL-W p
Bram Moolenaar <Bram@vim.org>
parents:
19135
diff
changeset
|
3364 call VerifyScreenDump(buf, 'Test_popupwin_previewpopup_10', {}) |
215793f6b59d
patch 8.2.0142: possible to enter popup window with CTRL-W p
Bram Moolenaar <Bram@vim.org>
parents:
19135
diff
changeset
|
3365 |
17438
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
3366 call StopVimInTerminal(buf) |
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
3367 endfunc |
967e2ee9b656
patch 8.1.1717: last char in menu popup window highlighted
Bram Moolenaar <Bram@vim.org>
parents:
17429
diff
changeset
|
3368 |
30606
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3369 func Test_previewpopup_pum() |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3370 CheckScreendump |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3371 CheckFeature quickfix |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3372 |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3373 let lines =<< trim END |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3374 let a = 3 |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3375 let b = 1 |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3376 echo a |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3377 echo b |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3378 call system('echo hello') |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3379 " the end |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3380 END |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3381 call writefile(lines, 'XpreviewText.vim', 'D') |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3382 |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3383 let lines =<< trim END |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3384 call setline(1, ['one', 'two', 'three', 'other', 'once', 'only', 'off']) |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3385 set previewpopup=height:6,width:40 |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3386 pedit XpreviewText.vim |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3387 END |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3388 call writefile(lines, 'XtestPreviewPum', 'D') |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3389 let buf = RunVimInTerminal('-S XtestPreviewPum', #{rows: 12}) |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3390 |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3391 call term_sendkeys(buf, "A o\<C-N>") |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3392 call VerifyScreenDump(buf, 'Test_pum_preview_1', {}) |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3393 |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3394 call term_sendkeys(buf, "\<C-N>") |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3395 call VerifyScreenDump(buf, 'Test_pum_preview_2', {}) |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3396 |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3397 call term_sendkeys(buf, "\<C-N>") |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3398 call VerifyScreenDump(buf, 'Test_pum_preview_3', {}) |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3399 |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3400 call term_sendkeys(buf, "\<C-N>") |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3401 call VerifyScreenDump(buf, 'Test_pum_preview_4', {}) |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3402 |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3403 call term_sendkeys(buf, "\<Esc>") |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3404 call StopVimInTerminal(buf) |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3405 endfunc |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3406 |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30592
diff
changeset
|
3407 |
17811
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3408 func Get_popupmenu_lines() |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3409 let lines =<< trim END |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3410 set completeopt+=preview,popup |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3411 set completefunc=CompleteFuncDict |
17771
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17769
diff
changeset
|
3412 hi InfoPopup ctermbg=yellow |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3413 |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3414 func CompleteFuncDict(findstart, base) |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3415 if a:findstart |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3416 if col('.') > 10 |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3417 return col('.') - 10 |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3418 endif |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3419 return 0 |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3420 endif |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3421 |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3422 return { |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3423 \ 'words': [ |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3424 \ { |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3425 \ 'word': 'aword', |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3426 \ 'abbr': 'wrd', |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3427 \ 'menu': 'extra text', |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3428 \ 'info': 'words are cool', |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3429 \ 'kind': 'W', |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3430 \ 'user_data': 'test' |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3431 \ }, |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3432 \ { |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3433 \ 'word': 'anotherword', |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3434 \ 'abbr': 'anotwrd', |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3435 \ 'menu': 'extra text', |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3436 \ 'info': "other words are\ncooler than this and some more text\nto make wrap", |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3437 \ 'kind': 'W', |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3438 \ 'user_data': 'notest' |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3439 \ }, |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3440 \ { |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3441 \ 'word': 'noinfo', |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3442 \ 'abbr': 'noawrd', |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3443 \ 'menu': 'extra text', |
17771
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17769
diff
changeset
|
3444 \ 'info': "lets\nshow\na\nscrollbar\nhere", |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3445 \ 'kind': 'W', |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3446 \ 'user_data': 'notest' |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3447 \ }, |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3448 \ { |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3449 \ 'word': 'thatword', |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3450 \ 'abbr': 'thatwrd', |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3451 \ 'menu': 'extra text', |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3452 \ 'info': 'that word is cool', |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3453 \ 'kind': 'W', |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3454 \ 'user_data': 'notest' |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3455 \ }, |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3456 \ ] |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3457 \ } |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3458 endfunc |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3459 call setline(1, 'text text text text text text text ') |
17817
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
3460 func ChangeColor() |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
3461 let id = popup_findinfo() |
23154
713912dd96cd
patch 8.2.2123: after using a complete popup the buffer is listed
Bram Moolenaar <Bram@vim.org>
parents:
23072
diff
changeset
|
3462 if buflisted(winbufnr(id)) |
713912dd96cd
patch 8.2.2123: after using a complete popup the buffer is listed
Bram Moolenaar <Bram@vim.org>
parents:
23072
diff
changeset
|
3463 call setline(1, 'buffer is listed') |
713912dd96cd
patch 8.2.2123: after using a complete popup the buffer is listed
Bram Moolenaar <Bram@vim.org>
parents:
23072
diff
changeset
|
3464 endif |
17972
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17946
diff
changeset
|
3465 eval id->popup_setoptions(#{highlight: 'InfoPopup'}) |
17817
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
3466 endfunc |
18396
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3467 |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3468 func InfoHidden() |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3469 set completepopup=height:4,border:off,align:menu |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3470 set completeopt-=popup completeopt+=popuphidden |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3471 au CompleteChanged * call HandleChange() |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3472 endfunc |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3473 |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3474 let s:counter = 0 |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3475 func HandleChange() |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3476 let s:counter += 1 |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3477 let selected = complete_info(['selected']).selected |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3478 if selected <= 0 |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3479 " First time: do nothing, info remains hidden |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3480 return |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3481 endif |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3482 if selected == 1 |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3483 " Second time: show info right away |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3484 let id = popup_findinfo() |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3485 if id |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3486 call popup_settext(id, 'immediate info ' .. s:counter) |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3487 call popup_show(id) |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3488 endif |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3489 else |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3490 " Third time: show info after a short delay |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3491 call timer_start(100, 'ShowInfo') |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3492 endif |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3493 endfunc |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3494 |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3495 func ShowInfo(...) |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3496 let id = popup_findinfo() |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3497 if id |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3498 call popup_settext(id, 'async info ' .. s:counter) |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3499 call popup_show(id) |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3500 endif |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3501 endfunc |
22884
68dc849715b5
patch 8.2.1989: info popup triggers WinEnter and WinLeave autocommands
Bram Moolenaar <Bram@vim.org>
parents:
22838
diff
changeset
|
3502 |
26165
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3503 func OpenOtherPopups() |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3504 call popup_create([ |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3505 \ 'popup below', |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3506 \ 'popup below', |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3507 \ 'popup below', |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3508 \ 'popup below', |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3509 \ ], #{ |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3510 \ line: 'cursor', |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3511 \ col: 'cursor+3', |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3512 \ highlight: 'ErrorMsg', |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3513 \ minwidth: 17, |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3514 \ zindex: 50, |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3515 \ }) |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3516 call popup_create([ |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3517 \ 'popup on top', |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3518 \ 'popup on top', |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3519 \ 'popup on top', |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3520 \ ], #{ |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3521 \ line: 'cursor+3', |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3522 \ col: 'cursor-10', |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3523 \ highlight: 'Search', |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3524 \ minwidth: 10, |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3525 \ zindex: 200, |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3526 \ }) |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3527 endfunc |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3528 |
22884
68dc849715b5
patch 8.2.1989: info popup triggers WinEnter and WinLeave autocommands
Bram Moolenaar <Bram@vim.org>
parents:
22838
diff
changeset
|
3529 " Check that no autocommands are triggered for the info popup |
68dc849715b5
patch 8.2.1989: info popup triggers WinEnter and WinLeave autocommands
Bram Moolenaar <Bram@vim.org>
parents:
22838
diff
changeset
|
3530 au WinEnter * if win_gettype() == 'popup' | call setline(2, 'WinEnter') | endif |
68dc849715b5
patch 8.2.1989: info popup triggers WinEnter and WinLeave autocommands
Bram Moolenaar <Bram@vim.org>
parents:
22838
diff
changeset
|
3531 au WinLeave * if win_gettype() == 'popup' | call setline(2, 'WinLeave') | endif |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3532 END |
17811
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3533 return lines |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3534 endfunc |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3535 |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3536 func Test_popupmenu_info_border() |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3537 CheckScreendump |
18767
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3538 CheckFeature quickfix |
17811
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3539 |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3540 let lines = Get_popupmenu_lines() |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3541 call add(lines, 'set completepopup=height:4,highlight:InfoPopup') |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
3542 call writefile(lines, 'XtestInfoPopup', 'D') |
17811
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3543 |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3544 let buf = RunVimInTerminal('-S XtestInfoPopup', #{rows: 14}) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19732
diff
changeset
|
3545 call TermWait(buf, 25) |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3546 |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3547 call term_sendkeys(buf, "A\<C-X>\<C-U>") |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3548 call VerifyScreenDump(buf, 'Test_popupwin_infopopup_1', {}) |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3549 |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3550 call term_sendkeys(buf, "\<C-N>") |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3551 call VerifyScreenDump(buf, 'Test_popupwin_infopopup_2', {}) |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3552 |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3553 call term_sendkeys(buf, "\<C-N>") |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3554 call VerifyScreenDump(buf, 'Test_popupwin_infopopup_3', {}) |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3555 |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3556 call term_sendkeys(buf, "\<C-N>\<C-N>") |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3557 call VerifyScreenDump(buf, 'Test_popupwin_infopopup_4', {}) |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3558 |
17821
fe92aaf166c1
patch 8.1.1907: wrong position for info popup with scrollbar on the left
Bram Moolenaar <Bram@vim.org>
parents:
17817
diff
changeset
|
3559 " info on the left with scrollbar |
fe92aaf166c1
patch 8.1.1907: wrong position for info popup with scrollbar on the left
Bram Moolenaar <Bram@vim.org>
parents:
17817
diff
changeset
|
3560 call term_sendkeys(buf, "test text test text\<C-X>\<C-U>") |
fe92aaf166c1
patch 8.1.1907: wrong position for info popup with scrollbar on the left
Bram Moolenaar <Bram@vim.org>
parents:
17817
diff
changeset
|
3561 call term_sendkeys(buf, "\<C-N>\<C-N>") |
fe92aaf166c1
patch 8.1.1907: wrong position for info popup with scrollbar on the left
Bram Moolenaar <Bram@vim.org>
parents:
17817
diff
changeset
|
3562 call VerifyScreenDump(buf, 'Test_popupwin_infopopup_5', {}) |
fe92aaf166c1
patch 8.1.1907: wrong position for info popup with scrollbar on the left
Bram Moolenaar <Bram@vim.org>
parents:
17817
diff
changeset
|
3563 |
18665
7369756d05de
patch 8.1.2324: with of scrollbar in popup menu not taken into account
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
3564 " Test that the popupmenu's scrollbar and infopopup do not overlap |
7369756d05de
patch 8.1.2324: with of scrollbar in popup menu not taken into account
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
3565 call term_sendkeys(buf, "\<Esc>") |
7369756d05de
patch 8.1.2324: with of scrollbar in popup menu not taken into account
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
3566 call term_sendkeys(buf, ":set pumheight=3\<CR>") |
7369756d05de
patch 8.1.2324: with of scrollbar in popup menu not taken into account
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
3567 call term_sendkeys(buf, "cc\<C-X>\<C-U>") |
7369756d05de
patch 8.1.2324: with of scrollbar in popup menu not taken into account
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
3568 call VerifyScreenDump(buf, 'Test_popupwin_infopopup_6', {}) |
7369756d05de
patch 8.1.2324: with of scrollbar in popup menu not taken into account
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
3569 |
23229
b545334ae654
patch 8.2.2160: various typos
Bram Moolenaar <Bram@vim.org>
parents:
23217
diff
changeset
|
3570 " Hide the info popup, cycle through buffers, make sure it didn't get |
19117
8db080710015
patch 8.2.0118: crash when cycling to buffers involving popup window
Bram Moolenaar <Bram@vim.org>
parents:
19071
diff
changeset
|
3571 " deleted. |
8db080710015
patch 8.2.0118: crash when cycling to buffers involving popup window
Bram Moolenaar <Bram@vim.org>
parents:
19071
diff
changeset
|
3572 call term_sendkeys(buf, "\<Esc>") |
8db080710015
patch 8.2.0118: crash when cycling to buffers involving popup window
Bram Moolenaar <Bram@vim.org>
parents:
19071
diff
changeset
|
3573 call term_sendkeys(buf, ":set hidden\<CR>") |
8db080710015
patch 8.2.0118: crash when cycling to buffers involving popup window
Bram Moolenaar <Bram@vim.org>
parents:
19071
diff
changeset
|
3574 call term_sendkeys(buf, ":bn\<CR>") |
8db080710015
patch 8.2.0118: crash when cycling to buffers involving popup window
Bram Moolenaar <Bram@vim.org>
parents:
19071
diff
changeset
|
3575 call term_sendkeys(buf, ":bn\<CR>") |
8db080710015
patch 8.2.0118: crash when cycling to buffers involving popup window
Bram Moolenaar <Bram@vim.org>
parents:
19071
diff
changeset
|
3576 call term_sendkeys(buf, "otest text test text\<C-X>\<C-U>") |
8db080710015
patch 8.2.0118: crash when cycling to buffers involving popup window
Bram Moolenaar <Bram@vim.org>
parents:
19071
diff
changeset
|
3577 call VerifyScreenDump(buf, 'Test_popupwin_infopopup_7', {}) |
8db080710015
patch 8.2.0118: crash when cycling to buffers involving popup window
Bram Moolenaar <Bram@vim.org>
parents:
19071
diff
changeset
|
3578 |
21373
3d73cdd173ab
patch 8.2.1237: changing 'completepopup' after opening popup has no effect
Bram Moolenaar <Bram@vim.org>
parents:
21339
diff
changeset
|
3579 " Test that when the option is changed the popup changes. |
3d73cdd173ab
patch 8.2.1237: changing 'completepopup' after opening popup has no effect
Bram Moolenaar <Bram@vim.org>
parents:
21339
diff
changeset
|
3580 call term_sendkeys(buf, "\<Esc>") |
3d73cdd173ab
patch 8.2.1237: changing 'completepopup' after opening popup has no effect
Bram Moolenaar <Bram@vim.org>
parents:
21339
diff
changeset
|
3581 call term_sendkeys(buf, ":set completepopup=border:off\<CR>") |
3d73cdd173ab
patch 8.2.1237: changing 'completepopup' after opening popup has no effect
Bram Moolenaar <Bram@vim.org>
parents:
21339
diff
changeset
|
3582 call term_sendkeys(buf, "a\<C-X>\<C-U>") |
3d73cdd173ab
patch 8.2.1237: changing 'completepopup' after opening popup has no effect
Bram Moolenaar <Bram@vim.org>
parents:
21339
diff
changeset
|
3583 call VerifyScreenDump(buf, 'Test_popupwin_infopopup_8', {}) |
3d73cdd173ab
patch 8.2.1237: changing 'completepopup' after opening popup has no effect
Bram Moolenaar <Bram@vim.org>
parents:
21339
diff
changeset
|
3584 |
21506
1d1ffb0dbd87
patch 8.2.1303: calling popup_setoptions() resets 'signcolumn'
Bram Moolenaar <Bram@vim.org>
parents:
21373
diff
changeset
|
3585 call term_sendkeys(buf, " \<Esc>") |
1d1ffb0dbd87
patch 8.2.1303: calling popup_setoptions() resets 'signcolumn'
Bram Moolenaar <Bram@vim.org>
parents:
21373
diff
changeset
|
3586 call term_sendkeys(buf, ":set completepopup+=width:10\<CR>") |
1d1ffb0dbd87
patch 8.2.1303: calling popup_setoptions() resets 'signcolumn'
Bram Moolenaar <Bram@vim.org>
parents:
21373
diff
changeset
|
3587 call term_sendkeys(buf, "a\<C-X>\<C-U>") |
1d1ffb0dbd87
patch 8.2.1303: calling popup_setoptions() resets 'signcolumn'
Bram Moolenaar <Bram@vim.org>
parents:
21373
diff
changeset
|
3588 call VerifyScreenDump(buf, 'Test_popupwin_infopopup_9', {}) |
1d1ffb0dbd87
patch 8.2.1303: calling popup_setoptions() resets 'signcolumn'
Bram Moolenaar <Bram@vim.org>
parents:
21373
diff
changeset
|
3589 |
19117
8db080710015
patch 8.2.0118: crash when cycling to buffers involving popup window
Bram Moolenaar <Bram@vim.org>
parents:
19071
diff
changeset
|
3590 call term_sendkeys(buf, "\<Esc>") |
17767
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3591 call StopVimInTerminal(buf) |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3592 endfunc |
c75da1064e33
patch 8.1.1880: cannot show extra info for completion in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17754
diff
changeset
|
3593 |
17811
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3594 func Test_popupmenu_info_noborder() |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3595 CheckScreendump |
18767
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3596 CheckFeature quickfix |
17811
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3597 |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3598 let lines = Get_popupmenu_lines() |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3599 call add(lines, 'set completepopup=height:4,border:off') |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
3600 call writefile(lines, 'XtestInfoPopupNb', 'D') |
17811
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3601 |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3602 let buf = RunVimInTerminal('-S XtestInfoPopupNb', #{rows: 14}) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19732
diff
changeset
|
3603 call TermWait(buf, 25) |
17811
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3604 |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3605 call term_sendkeys(buf, "A\<C-X>\<C-U>") |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3606 call VerifyScreenDump(buf, 'Test_popupwin_infopopup_nb_1', {}) |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3607 |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3608 call StopVimInTerminal(buf) |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3609 endfunc |
b5499bf22a97
patch 8.1.1902: cannot have an info popup without a border
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
3610 |
17815
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3611 func Test_popupmenu_info_align_menu() |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3612 CheckScreendump |
18767
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3613 CheckFeature quickfix |
17815
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3614 |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3615 let lines = Get_popupmenu_lines() |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3616 call add(lines, 'set completepopup=height:4,border:off,align:menu') |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
3617 call writefile(lines, 'XtestInfoPopupNb', 'D') |
17815
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3618 |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3619 let buf = RunVimInTerminal('-S XtestInfoPopupNb', #{rows: 14}) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19732
diff
changeset
|
3620 call TermWait(buf, 25) |
17815
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3621 |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3622 call term_sendkeys(buf, "A\<C-X>\<C-U>") |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3623 call term_sendkeys(buf, "\<C-N>") |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3624 call term_sendkeys(buf, "\<C-N>") |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3625 call term_sendkeys(buf, "\<C-N>") |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3626 call VerifyScreenDump(buf, 'Test_popupwin_infopopup_align_1', {}) |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3627 |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3628 call term_sendkeys(buf, "test text test text test\<C-X>\<C-U>") |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3629 call term_sendkeys(buf, "\<C-N>") |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3630 call VerifyScreenDump(buf, 'Test_popupwin_infopopup_align_2', {}) |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3631 |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3632 call term_sendkeys(buf, "\<Esc>") |
17817
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17815
diff
changeset
|
3633 call term_sendkeys(buf, ":call ChangeColor()\<CR>") |
17815
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3634 call term_sendkeys(buf, ":call setline(2, ['x']->repeat(10))\<CR>") |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3635 call term_sendkeys(buf, "Gotest text test text\<C-X>\<C-U>") |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3636 call VerifyScreenDump(buf, 'Test_popupwin_infopopup_align_3', {}) |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3637 |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3638 call StopVimInTerminal(buf) |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3639 endfunc |
9ec2526c04c5
patch 8.1.1904: cannot have an info popup align with the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17811
diff
changeset
|
3640 |
18396
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3641 func Test_popupmenu_info_hidden() |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3642 CheckScreendump |
18767
068337e86133
patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3643 CheckFeature quickfix |
18396
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3644 |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3645 let lines = Get_popupmenu_lines() |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3646 call add(lines, 'call InfoHidden()') |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
3647 call writefile(lines, 'XtestInfoPopupHidden', 'D') |
18396
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3648 |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3649 let buf = RunVimInTerminal('-S XtestInfoPopupHidden', #{rows: 14}) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19732
diff
changeset
|
3650 call TermWait(buf, 25) |
18396
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3651 |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3652 call term_sendkeys(buf, "A\<C-X>\<C-U>") |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3653 call VerifyScreenDump(buf, 'Test_popupwin_infopopup_hidden_1', {}) |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3654 |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3655 call term_sendkeys(buf, "\<C-N>") |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3656 call VerifyScreenDump(buf, 'Test_popupwin_infopopup_hidden_2', {}) |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3657 |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3658 call term_sendkeys(buf, "\<C-N>") |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3659 call VerifyScreenDump(buf, 'Test_popupwin_infopopup_hidden_3', {}) |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3660 |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3661 call term_sendkeys(buf, "\<Esc>") |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3662 call StopVimInTerminal(buf) |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3663 endfunc |
ba5d8c5d77d7
patch 8.1.2192: cannot easily fill the info popup asynchronously
Bram Moolenaar <Bram@vim.org>
parents:
18339
diff
changeset
|
3664 |
18823
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3665 func Test_popupmenu_info_too_wide() |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3666 CheckScreendump |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3667 CheckFeature quickfix |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3668 |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3669 let lines =<< trim END |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3670 call setline(1, range(10)) |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3671 |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3672 set completeopt+=preview,popup |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3673 set completepopup=align:menu |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3674 set omnifunc=OmniFunc |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3675 hi InfoPopup ctermbg=lightgrey |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3676 |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3677 func OmniFunc(findstart, base) |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3678 if a:findstart |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3679 return 0 |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3680 endif |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3681 |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3682 let menuText = 'some long text to make sure the menu takes up all of the width of the window' |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3683 return #{ |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3684 \ words: [ |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3685 \ #{ |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3686 \ word: 'scrap', |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3687 \ menu: menuText, |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3688 \ info: "other words are\ncooler than this and some more text\nto make wrap", |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3689 \ }, |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3690 \ #{ |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3691 \ word: 'scappier', |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3692 \ menu: menuText, |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3693 \ info: 'words are cool', |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3694 \ }, |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3695 \ #{ |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3696 \ word: 'scrappier2', |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3697 \ menu: menuText, |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3698 \ info: 'words are cool', |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3699 \ }, |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3700 \ ] |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3701 \ } |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3702 endfunc |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3703 END |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3704 |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
3705 call writefile(lines, 'XtestInfoPopupWide', 'D') |
18823
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3706 let buf = RunVimInTerminal('-S XtestInfoPopupWide', #{rows: 8}) |
19954
c087099e9163
patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents:
19732
diff
changeset
|
3707 call TermWait(buf, 25) |
18823
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3708 |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3709 call term_sendkeys(buf, "Ascr\<C-X>\<C-O>") |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3710 call VerifyScreenDump(buf, 'Test_popupwin_infopopup_wide_1', {}) |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3711 |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3712 call term_sendkeys(buf, "\<Esc>") |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3713 call StopVimInTerminal(buf) |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3714 endfunc |
ae2bd5ec98d0
patch 8.1.2399: info popup on top of cursor if it doesn't fit
Bram Moolenaar <Bram@vim.org>
parents:
18767
diff
changeset
|
3715 |
26165
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3716 func Test_popupmenu_masking() |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3717 " Test that popup windows that are opened while popup menu is open are |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3718 " properly displayed. |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3719 CheckScreendump |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3720 CheckFeature quickfix |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3721 |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3722 let lines = Get_popupmenu_lines() |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3723 call add(lines, 'inoremap <C-A> <Cmd>call OpenOtherPopups()<CR>') |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
3724 call writefile(lines, 'XtestPopupmenuMasking', 'D') |
26165
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3725 |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3726 let buf = RunVimInTerminal('-S XtestPopupmenuMasking', #{rows: 14}) |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3727 call TermWait(buf, 25) |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3728 |
31245
fbc4d3b0302d
patch 9.0.0956: terminal tests fail when using key with modifier
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
3729 call term_sendkeys(buf, "A" .. GetEscCodeWithModifier('C', 'X') |
fbc4d3b0302d
patch 9.0.0956: terminal tests fail when using key with modifier
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
3730 \ .. GetEscCodeWithModifier('C', 'U') |
fbc4d3b0302d
patch 9.0.0956: terminal tests fail when using key with modifier
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
3731 \ .. GetEscCodeWithModifier('C', 'A')) |
26165
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3732 call VerifyScreenDump(buf, 'Test_popupwin_popupmenu_masking_1', {}) |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3733 |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3734 call term_sendkeys(buf, "\<Esc>") |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3735 call VerifyScreenDump(buf, 'Test_popupwin_popupmenu_masking_2', {}) |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3736 |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3737 call StopVimInTerminal(buf) |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3738 endfunc |
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25535
diff
changeset
|
3739 |
17823
7e6b7a4f13bc
patch 8.1.1908: every popup window consumes a buffer number
Bram Moolenaar <Bram@vim.org>
parents:
17821
diff
changeset
|
3740 func Test_popupwin_recycle_bnr() |
17825
ce993ba17adb
patch 8.1.1909: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17823
diff
changeset
|
3741 let bufnr = popup_notification('nothing wrong', {})->winbufnr() |
17823
7e6b7a4f13bc
patch 8.1.1908: every popup window consumes a buffer number
Bram Moolenaar <Bram@vim.org>
parents:
17821
diff
changeset
|
3742 call popup_clear() |
17972
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17946
diff
changeset
|
3743 let winid = 'nothing wrong'->popup_notification({}) |
17823
7e6b7a4f13bc
patch 8.1.1908: every popup window consumes a buffer number
Bram Moolenaar <Bram@vim.org>
parents:
17821
diff
changeset
|
3744 call assert_equal(bufnr, winbufnr(winid)) |
7e6b7a4f13bc
patch 8.1.1908: every popup window consumes a buffer number
Bram Moolenaar <Bram@vim.org>
parents:
17821
diff
changeset
|
3745 call popup_clear() |
7e6b7a4f13bc
patch 8.1.1908: every popup window consumes a buffer number
Bram Moolenaar <Bram@vim.org>
parents:
17821
diff
changeset
|
3746 endfunc |
7e6b7a4f13bc
patch 8.1.1908: every popup window consumes a buffer number
Bram Moolenaar <Bram@vim.org>
parents:
17821
diff
changeset
|
3747 |
18229
e6c83ae0c4d0
patch 8.1.2109: popup_getoptions() hangs with tab-local popup
Bram Moolenaar <Bram@vim.org>
parents:
18168
diff
changeset
|
3748 func Test_popupwin_getoptions_tablocal() |
e6c83ae0c4d0
patch 8.1.2109: popup_getoptions() hangs with tab-local popup
Bram Moolenaar <Bram@vim.org>
parents:
18168
diff
changeset
|
3749 topleft split |
e6c83ae0c4d0
patch 8.1.2109: popup_getoptions() hangs with tab-local popup
Bram Moolenaar <Bram@vim.org>
parents:
18168
diff
changeset
|
3750 let win1 = popup_create('nothing', #{maxheight: 8}) |
e6c83ae0c4d0
patch 8.1.2109: popup_getoptions() hangs with tab-local popup
Bram Moolenaar <Bram@vim.org>
parents:
18168
diff
changeset
|
3751 let win2 = popup_create('something', #{maxheight: 10}) |
e6c83ae0c4d0
patch 8.1.2109: popup_getoptions() hangs with tab-local popup
Bram Moolenaar <Bram@vim.org>
parents:
18168
diff
changeset
|
3752 let win3 = popup_create('something', #{maxheight: 15}) |
e6c83ae0c4d0
patch 8.1.2109: popup_getoptions() hangs with tab-local popup
Bram Moolenaar <Bram@vim.org>
parents:
18168
diff
changeset
|
3753 call assert_equal(8, popup_getoptions(win1).maxheight) |
e6c83ae0c4d0
patch 8.1.2109: popup_getoptions() hangs with tab-local popup
Bram Moolenaar <Bram@vim.org>
parents:
18168
diff
changeset
|
3754 call assert_equal(10, popup_getoptions(win2).maxheight) |
e6c83ae0c4d0
patch 8.1.2109: popup_getoptions() hangs with tab-local popup
Bram Moolenaar <Bram@vim.org>
parents:
18168
diff
changeset
|
3755 call assert_equal(15, popup_getoptions(win3).maxheight) |
e6c83ae0c4d0
patch 8.1.2109: popup_getoptions() hangs with tab-local popup
Bram Moolenaar <Bram@vim.org>
parents:
18168
diff
changeset
|
3756 call popup_clear() |
e6c83ae0c4d0
patch 8.1.2109: popup_getoptions() hangs with tab-local popup
Bram Moolenaar <Bram@vim.org>
parents:
18168
diff
changeset
|
3757 quit |
e6c83ae0c4d0
patch 8.1.2109: popup_getoptions() hangs with tab-local popup
Bram Moolenaar <Bram@vim.org>
parents:
18168
diff
changeset
|
3758 endfunc |
e6c83ae0c4d0
patch 8.1.2109: popup_getoptions() hangs with tab-local popup
Bram Moolenaar <Bram@vim.org>
parents:
18168
diff
changeset
|
3759 |
18231
25535ef50842
patch 8.1.2110: CTRL-C closes two popups instead of one
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3760 func Test_popupwin_cancel() |
25535ef50842
patch 8.1.2110: CTRL-C closes two popups instead of one
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3761 let win1 = popup_create('one', #{line: 5, filter: {... -> 0}}) |
25535ef50842
patch 8.1.2110: CTRL-C closes two popups instead of one
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3762 let win2 = popup_create('two', #{line: 10, filter: {... -> 0}}) |
25535ef50842
patch 8.1.2110: CTRL-C closes two popups instead of one
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3763 let win3 = popup_create('three', #{line: 15, filter: {... -> 0}}) |
25535ef50842
patch 8.1.2110: CTRL-C closes two popups instead of one
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3764 call assert_equal(5, popup_getpos(win1).line) |
25535ef50842
patch 8.1.2110: CTRL-C closes two popups instead of one
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3765 call assert_equal(10, popup_getpos(win2).line) |
25535ef50842
patch 8.1.2110: CTRL-C closes two popups instead of one
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3766 call assert_equal(15, popup_getpos(win3).line) |
25535ef50842
patch 8.1.2110: CTRL-C closes two popups instead of one
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3767 " TODO: this also works without patch 8.1.2110 |
25535ef50842
patch 8.1.2110: CTRL-C closes two popups instead of one
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3768 call feedkeys("\<C-C>", 'xt') |
25535ef50842
patch 8.1.2110: CTRL-C closes two popups instead of one
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3769 call assert_equal(5, popup_getpos(win1).line) |
25535ef50842
patch 8.1.2110: CTRL-C closes two popups instead of one
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3770 call assert_equal(10, popup_getpos(win2).line) |
25535ef50842
patch 8.1.2110: CTRL-C closes two popups instead of one
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3771 call assert_equal({}, popup_getpos(win3)) |
25535ef50842
patch 8.1.2110: CTRL-C closes two popups instead of one
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3772 call feedkeys("\<C-C>", 'xt') |
25535ef50842
patch 8.1.2110: CTRL-C closes two popups instead of one
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3773 call assert_equal(5, popup_getpos(win1).line) |
25535ef50842
patch 8.1.2110: CTRL-C closes two popups instead of one
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3774 call assert_equal({}, popup_getpos(win2)) |
25535ef50842
patch 8.1.2110: CTRL-C closes two popups instead of one
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3775 call assert_equal({}, popup_getpos(win3)) |
25535ef50842
patch 8.1.2110: CTRL-C closes two popups instead of one
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3776 call feedkeys("\<C-C>", 'xt') |
25535ef50842
patch 8.1.2110: CTRL-C closes two popups instead of one
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3777 call assert_equal({}, popup_getpos(win1)) |
25535ef50842
patch 8.1.2110: CTRL-C closes two popups instead of one
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3778 call assert_equal({}, popup_getpos(win2)) |
25535ef50842
patch 8.1.2110: CTRL-C closes two popups instead of one
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3779 call assert_equal({}, popup_getpos(win3)) |
25535ef50842
patch 8.1.2110: CTRL-C closes two popups instead of one
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3780 endfunc |
25535ef50842
patch 8.1.2110: CTRL-C closes two popups instead of one
Bram Moolenaar <Bram@vim.org>
parents:
18229
diff
changeset
|
3781 |
18613
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3782 func Test_popupwin_filter_redraw() |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3783 " Create two popups with a filter that closes the popup when typing "0". |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3784 " Both popups should close, even though the redraw also calls |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3785 " popup_reset_handled() |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3786 |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3787 func CloseFilter(winid, key) |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3788 if a:key == '0' |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3789 call popup_close(a:winid) |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3790 redraw |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3791 endif |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3792 return 0 " pass the key |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3793 endfunc |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3794 |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3795 let id1 = popup_create('first one', #{ |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3796 \ line: 1, |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3797 \ col: 1, |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3798 \ filter: 'CloseFilter', |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3799 \ }) |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3800 let id2 = popup_create('second one', #{ |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3801 \ line: 9, |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3802 \ col: 1, |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3803 \ filter: 'CloseFilter', |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3804 \ }) |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3805 call assert_equal(1, popup_getpos(id1).line) |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3806 call assert_equal(9, popup_getpos(id2).line) |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3807 |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3808 call feedkeys('0', 'xt') |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3809 call assert_equal({}, popup_getpos(id1)) |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3810 call assert_equal({}, popup_getpos(id2)) |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3811 |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3812 call popup_clear() |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3813 delfunc CloseFilter |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3814 endfunc |
fa995154904e
patch 8.1.2300: redraw breaks going through list of popup windows
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
3815 |
18751
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3816 func Test_popupwin_double_width() |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3817 CheckScreendump |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3818 |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3819 let lines =<< trim END |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3820 call setline(1, 'x你好世界你好世你好世界你好') |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3821 call setline(2, '你好世界你好世你好世界你好') |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3822 call setline(3, 'x你好世界你好世你好世界你好') |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3823 call popup_create('你好,世界 - 你好,世界xxxxx', #{line: 1, col: 3, maxwidth: 14}) |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3824 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
3825 call writefile(lines, 'XtestPopupWide', 'D') |
18751
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3826 |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3827 let buf = RunVimInTerminal('-S XtestPopupWide', #{rows: 10}) |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3828 call VerifyScreenDump(buf, 'Test_popupwin_doublewidth_1', {}) |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3829 |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3830 call StopVimInTerminal(buf) |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3831 endfunc |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3832 |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3833 func Test_popupwin_sign() |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3834 CheckScreendump |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3835 |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3836 let lines =<< trim END |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3837 call setline(1, range(10)) |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3838 call sign_define('Current', { |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3839 \ 'text': '>>', |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3840 \ 'texthl': 'WarningMsg', |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3841 \ 'linehl': 'Error', |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3842 \ }) |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3843 call sign_define('Other', { |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3844 \ 'text': '#!', |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3845 \ 'texthl': 'Error', |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3846 \ 'linehl': 'Search', |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3847 \ }) |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3848 let winid = popup_create(['hello', 'bright', 'world'], { |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3849 \ 'minwidth': 20, |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3850 \ }) |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3851 call setwinvar(winid, "&signcolumn", "yes") |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3852 let winbufnr = winbufnr(winid) |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3853 |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3854 " add sign to current buffer, shows |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3855 call sign_place(1, 'Selected', 'Current', bufnr('%'), {'lnum': 1}) |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3856 " add sign to current buffer, does not show |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3857 call sign_place(2, 'PopUpSelected', 'Other', bufnr('%'), {'lnum': 2}) |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3858 |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3859 " add sign to popup buffer, shows |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3860 call sign_place(3, 'PopUpSelected', 'Other', winbufnr, {'lnum': 1}) |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3861 " add sign to popup buffer, does not show |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3862 call sign_place(4, 'Selected', 'Current', winbufnr, {'lnum': 2}) |
21514
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
3863 |
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
3864 func SetOptions() |
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
3865 call setwinvar(g:winid, '&number', 1) |
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
3866 call setwinvar(g:winid, '&foldcolumn', 2) |
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
3867 call popup_settext(g:winid, 'a longer line to check the width') |
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
3868 endfunc |
18751
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3869 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
3870 call writefile(lines, 'XtestPopupSign', 'D') |
18751
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3871 |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3872 let buf = RunVimInTerminal('-S XtestPopupSign', #{rows: 10}) |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3873 call VerifyScreenDump(buf, 'Test_popupwin_sign_1', {}) |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3874 |
21514
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
3875 " set more options to check the width is adjusted |
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
3876 call term_sendkeys(buf, ":call SetOptions()\<CR>") |
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
3877 call VerifyScreenDump(buf, 'Test_popupwin_sign_2', {}) |
27bbd918e70c
patch 8.2.1307: popup window width does not include number of sign columns
Bram Moolenaar <Bram@vim.org>
parents:
21506
diff
changeset
|
3878 |
18751
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3879 call StopVimInTerminal(buf) |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3880 endfunc |
aa385f88f900
patch 8.1.2365: missing tests for recent popupwin changes
Bram Moolenaar <Bram@vim.org>
parents:
18665
diff
changeset
|
3881 |
18864
9449ed2ee8d4
patch 8.1.2418: bufnr('$') is wrong after recycling popup buffer
Bram Moolenaar <Bram@vim.org>
parents:
18823
diff
changeset
|
3882 func Test_popupwin_bufnr() |
9449ed2ee8d4
patch 8.1.2418: bufnr('$') is wrong after recycling popup buffer
Bram Moolenaar <Bram@vim.org>
parents:
18823
diff
changeset
|
3883 let popwin = popup_create(['blah'], #{}) |
9449ed2ee8d4
patch 8.1.2418: bufnr('$') is wrong after recycling popup buffer
Bram Moolenaar <Bram@vim.org>
parents:
18823
diff
changeset
|
3884 let popbuf = winbufnr(popwin) |
9449ed2ee8d4
patch 8.1.2418: bufnr('$') is wrong after recycling popup buffer
Bram Moolenaar <Bram@vim.org>
parents:
18823
diff
changeset
|
3885 split asdfasdf |
9449ed2ee8d4
patch 8.1.2418: bufnr('$') is wrong after recycling popup buffer
Bram Moolenaar <Bram@vim.org>
parents:
18823
diff
changeset
|
3886 let newbuf = bufnr() |
9449ed2ee8d4
patch 8.1.2418: bufnr('$') is wrong after recycling popup buffer
Bram Moolenaar <Bram@vim.org>
parents:
18823
diff
changeset
|
3887 call assert_true(newbuf > popbuf, 'New buffer number is higher') |
9449ed2ee8d4
patch 8.1.2418: bufnr('$') is wrong after recycling popup buffer
Bram Moolenaar <Bram@vim.org>
parents:
18823
diff
changeset
|
3888 call assert_equal(newbuf, bufnr('$')) |
9449ed2ee8d4
patch 8.1.2418: bufnr('$') is wrong after recycling popup buffer
Bram Moolenaar <Bram@vim.org>
parents:
18823
diff
changeset
|
3889 call popup_clear() |
9449ed2ee8d4
patch 8.1.2418: bufnr('$') is wrong after recycling popup buffer
Bram Moolenaar <Bram@vim.org>
parents:
18823
diff
changeset
|
3890 let popwin = popup_create(['blah'], #{}) |
9449ed2ee8d4
patch 8.1.2418: bufnr('$') is wrong after recycling popup buffer
Bram Moolenaar <Bram@vim.org>
parents:
18823
diff
changeset
|
3891 " reuses previous buffer number |
9449ed2ee8d4
patch 8.1.2418: bufnr('$') is wrong after recycling popup buffer
Bram Moolenaar <Bram@vim.org>
parents:
18823
diff
changeset
|
3892 call assert_equal(popbuf, winbufnr(popwin)) |
9449ed2ee8d4
patch 8.1.2418: bufnr('$') is wrong after recycling popup buffer
Bram Moolenaar <Bram@vim.org>
parents:
18823
diff
changeset
|
3893 call assert_equal(newbuf, bufnr('$')) |
9449ed2ee8d4
patch 8.1.2418: bufnr('$') is wrong after recycling popup buffer
Bram Moolenaar <Bram@vim.org>
parents:
18823
diff
changeset
|
3894 |
9449ed2ee8d4
patch 8.1.2418: bufnr('$') is wrong after recycling popup buffer
Bram Moolenaar <Bram@vim.org>
parents:
18823
diff
changeset
|
3895 call popup_clear() |
9449ed2ee8d4
patch 8.1.2418: bufnr('$') is wrong after recycling popup buffer
Bram Moolenaar <Bram@vim.org>
parents:
18823
diff
changeset
|
3896 bwipe! |
9449ed2ee8d4
patch 8.1.2418: bufnr('$') is wrong after recycling popup buffer
Bram Moolenaar <Bram@vim.org>
parents:
18823
diff
changeset
|
3897 endfunc |
9449ed2ee8d4
patch 8.1.2418: bufnr('$') is wrong after recycling popup buffer
Bram Moolenaar <Bram@vim.org>
parents:
18823
diff
changeset
|
3898 |
19544
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19368
diff
changeset
|
3899 func Test_popupwin_filter_input_multibyte() |
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19368
diff
changeset
|
3900 func MyPopupFilter(winid, c) |
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19368
diff
changeset
|
3901 let g:bytes = range(a:c->strlen())->map({i -> char2nr(a:c[i])}) |
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19368
diff
changeset
|
3902 return 0 |
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19368
diff
changeset
|
3903 endfunc |
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19368
diff
changeset
|
3904 let winid = popup_create('', #{mapping: 0, filter: 'MyPopupFilter'}) |
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19368
diff
changeset
|
3905 |
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19368
diff
changeset
|
3906 " UTF-8: E3 80 80, including K_SPECIAL(0x80) |
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19368
diff
changeset
|
3907 call feedkeys("\u3000", 'xt') |
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19368
diff
changeset
|
3908 call assert_equal([0xe3, 0x80, 0x80], g:bytes) |
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19368
diff
changeset
|
3909 |
19599
5eb0ead1415f
patch 8.2.0356: MS-Windows: feedkeys() with VIMDLL cannot handle CSI
Bram Moolenaar <Bram@vim.org>
parents:
19544
diff
changeset
|
3910 " UTF-8: E3 80 9B, including CSI(0x9B) |
5eb0ead1415f
patch 8.2.0356: MS-Windows: feedkeys() with VIMDLL cannot handle CSI
Bram Moolenaar <Bram@vim.org>
parents:
19544
diff
changeset
|
3911 call feedkeys("\u301b", 'xt') |
5eb0ead1415f
patch 8.2.0356: MS-Windows: feedkeys() with VIMDLL cannot handle CSI
Bram Moolenaar <Bram@vim.org>
parents:
19544
diff
changeset
|
3912 call assert_equal([0xe3, 0x80, 0x9b], g:bytes) |
19544
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19368
diff
changeset
|
3913 |
20927
9328feafbbf5
patch 8.2.1015: popup filter gets key with modifier prepended
Bram Moolenaar <Bram@vim.org>
parents:
20865
diff
changeset
|
3914 if has('unix') |
9328feafbbf5
patch 8.2.1015: popup filter gets key with modifier prepended
Bram Moolenaar <Bram@vim.org>
parents:
20865
diff
changeset
|
3915 " with modifyOtherKeys <M-S-a> does not include a modifier sequence |
20937
a02ba6be5a84
patch 8.2.1020: popupwin test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
20927
diff
changeset
|
3916 if has('gui_running') |
a02ba6be5a84
patch 8.2.1020: popupwin test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
20927
diff
changeset
|
3917 call feedkeys("\x9b\xfc\x08A", 'Lx!') |
a02ba6be5a84
patch 8.2.1020: popupwin test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
20927
diff
changeset
|
3918 else |
a02ba6be5a84
patch 8.2.1020: popupwin test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
20927
diff
changeset
|
3919 call feedkeys("\<Esc>[27;4;65~", 'Lx!') |
a02ba6be5a84
patch 8.2.1020: popupwin test fails in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
20927
diff
changeset
|
3920 endif |
20927
9328feafbbf5
patch 8.2.1015: popup filter gets key with modifier prepended
Bram Moolenaar <Bram@vim.org>
parents:
20865
diff
changeset
|
3921 call assert_equal([0xc3, 0x81], g:bytes) |
9328feafbbf5
patch 8.2.1015: popup filter gets key with modifier prepended
Bram Moolenaar <Bram@vim.org>
parents:
20865
diff
changeset
|
3922 endif |
9328feafbbf5
patch 8.2.1015: popup filter gets key with modifier prepended
Bram Moolenaar <Bram@vim.org>
parents:
20865
diff
changeset
|
3923 |
19544
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19368
diff
changeset
|
3924 call popup_clear() |
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19368
diff
changeset
|
3925 delfunc MyPopupFilter |
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19368
diff
changeset
|
3926 unlet g:bytes |
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19368
diff
changeset
|
3927 endfunc |
167181848770
patch 8.2.0329: popup filter converts 0x80 bytes
Bram Moolenaar <Bram@vim.org>
parents:
19368
diff
changeset
|
3928 |
21731
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3929 func Test_popupwin_filter_close_ctrl_c() |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3930 CheckScreendump |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3931 |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3932 let lines =<< trim END |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3933 vsplit |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3934 set laststatus=2 |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3935 set statusline=%!Statusline() |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3936 |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3937 function Statusline() abort |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3938 return '%<%f %h%m%r%=%-14.(%l,%c%V%) %P' |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3939 endfunction |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3940 |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3941 call popup_create('test test test test...', {'filter': {-> 0}}) |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3942 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
3943 call writefile(lines, 'XtestPopupCtrlC', 'D') |
21731
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3944 |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3945 let buf = RunVimInTerminal('-S XtestPopupCtrlC', #{rows: 10}) |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3946 |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3947 call term_sendkeys(buf, "\<C-C>") |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3948 call VerifyScreenDump(buf, 'Test_popupwin_ctrl_c', {}) |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3949 |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3950 call StopVimInTerminal(buf) |
22174
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3951 endfunc |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3952 |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3953 func Test_popupwin_filter_close_wrong_name() |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3954 CheckScreendump |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3955 |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3956 let lines =<< trim END |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3957 call popup_create('one two three...', {'filter': 'NoSuchFunc'}) |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3958 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
3959 call writefile(lines, 'XtestPopupWrongName', 'D') |
22174
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3960 |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3961 let buf = RunVimInTerminal('-S XtestPopupWrongName', #{rows: 10}) |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3962 |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3963 call term_sendkeys(buf, "j") |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3964 call VerifyScreenDump(buf, 'Test_popupwin_wrong_name', {}) |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3965 |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3966 call StopVimInTerminal(buf) |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3967 endfunc |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3968 |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3969 func Test_popupwin_filter_close_three_errors() |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3970 CheckScreendump |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3971 |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3972 let lines =<< trim END |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3973 set cmdheight=2 |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3974 call popup_create('one two three...', {'filter': 'filter'}) |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3975 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
3976 call writefile(lines, 'XtestPopupThreeErrors', 'D') |
22174
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3977 |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3978 let buf = RunVimInTerminal('-S XtestPopupThreeErrors', #{rows: 10}) |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3979 |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3980 call term_sendkeys(buf, "jj") |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3981 call VerifyScreenDump(buf, 'Test_popupwin_three_errors_1', {}) |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3982 call term_sendkeys(buf, "j") |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3983 call VerifyScreenDump(buf, 'Test_popupwin_three_errors_2', {}) |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3984 |
ea87cd1fac75
patch 8.2.1636: get stuck if a popup filter causes an error
Bram Moolenaar <Bram@vim.org>
parents:
22087
diff
changeset
|
3985 call StopVimInTerminal(buf) |
21731
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3986 endfunc |
48f9bf2c677d
patch 8.2.1415: closing a popup window with CTRL-C interrupts 'statusline'
Bram Moolenaar <Bram@vim.org>
parents:
21729
diff
changeset
|
3987 |
22832
8059beb101d0
patch 8.2.1963: crash when using a popup window with "latin1" encoding
Bram Moolenaar <Bram@vim.org>
parents:
22675
diff
changeset
|
3988 func Test_popupwin_latin1_encoding() |
8059beb101d0
patch 8.2.1963: crash when using a popup window with "latin1" encoding
Bram Moolenaar <Bram@vim.org>
parents:
22675
diff
changeset
|
3989 CheckScreendump |
8059beb101d0
patch 8.2.1963: crash when using a popup window with "latin1" encoding
Bram Moolenaar <Bram@vim.org>
parents:
22675
diff
changeset
|
3990 CheckUnix |
8059beb101d0
patch 8.2.1963: crash when using a popup window with "latin1" encoding
Bram Moolenaar <Bram@vim.org>
parents:
22675
diff
changeset
|
3991 |
8059beb101d0
patch 8.2.1963: crash when using a popup window with "latin1" encoding
Bram Moolenaar <Bram@vim.org>
parents:
22675
diff
changeset
|
3992 " When 'encoding' is a single-byte encoding a terminal window will mess up |
8059beb101d0
patch 8.2.1963: crash when using a popup window with "latin1" encoding
Bram Moolenaar <Bram@vim.org>
parents:
22675
diff
changeset
|
3993 " the display. Check that showing a popup on top of that doesn't crash. |
8059beb101d0
patch 8.2.1963: crash when using a popup window with "latin1" encoding
Bram Moolenaar <Bram@vim.org>
parents:
22675
diff
changeset
|
3994 let lines =<< trim END |
8059beb101d0
patch 8.2.1963: crash when using a popup window with "latin1" encoding
Bram Moolenaar <Bram@vim.org>
parents:
22675
diff
changeset
|
3995 set encoding=latin1 |
8059beb101d0
patch 8.2.1963: crash when using a popup window with "latin1" encoding
Bram Moolenaar <Bram@vim.org>
parents:
22675
diff
changeset
|
3996 terminal cat Xmultibyte |
8059beb101d0
patch 8.2.1963: crash when using a popup window with "latin1" encoding
Bram Moolenaar <Bram@vim.org>
parents:
22675
diff
changeset
|
3997 call popup_create(['one', 'two', 'three', 'four'], #{line: 1, col: 10}) |
23207
f2da0d40449f
patch 8.2.2149: popupwin test for latin1 sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
23173
diff
changeset
|
3998 redraw |
23215
62310124e265
patch 8.2.2153: popupwin test for latin1 still fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
23207
diff
changeset
|
3999 " wait for "cat" to finish |
62310124e265
patch 8.2.2153: popupwin test for latin1 still fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
23207
diff
changeset
|
4000 while execute('ls!') !~ 'finished' |
62310124e265
patch 8.2.2153: popupwin test for latin1 still fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
23207
diff
changeset
|
4001 sleep 10m |
62310124e265
patch 8.2.2153: popupwin test for latin1 still fails sometimes
Bram Moolenaar <Bram@vim.org>
parents:
23207
diff
changeset
|
4002 endwhile |
23207
f2da0d40449f
patch 8.2.2149: popupwin test for latin1 sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
23173
diff
changeset
|
4003 echo "Done" |
22832
8059beb101d0
patch 8.2.1963: crash when using a popup window with "latin1" encoding
Bram Moolenaar <Bram@vim.org>
parents:
22675
diff
changeset
|
4004 END |
30592
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
4005 call writefile(lines, 'XtestPopupLatin', 'D') |
457ea0570b6f
patch 9.0.0631: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents:
30160
diff
changeset
|
4006 call writefile([repeat("\u3042 ", 120)], 'Xmultibyte', 'D') |
22832
8059beb101d0
patch 8.2.1963: crash when using a popup window with "latin1" encoding
Bram Moolenaar <Bram@vim.org>
parents:
22675
diff
changeset
|
4007 |
8059beb101d0
patch 8.2.1963: crash when using a popup window with "latin1" encoding
Bram Moolenaar <Bram@vim.org>
parents:
22675
diff
changeset
|
4008 let buf = RunVimInTerminal('-S XtestPopupLatin', #{rows: 10}) |
23207
f2da0d40449f
patch 8.2.2149: popupwin test for latin1 sometimes fails
Bram Moolenaar <Bram@vim.org>
parents:
23173
diff
changeset
|
4009 call WaitForAssert({-> assert_match('Done', term_getline(buf, 10))}) |
22832
8059beb101d0
patch 8.2.1963: crash when using a popup window with "latin1" encoding
Bram Moolenaar <Bram@vim.org>
parents:
22675
diff
changeset
|
4010 |
8059beb101d0
patch 8.2.1963: crash when using a popup window with "latin1" encoding
Bram Moolenaar <Bram@vim.org>
parents:
22675
diff
changeset
|
4011 call term_sendkeys(buf, ":q\<CR>") |
8059beb101d0
patch 8.2.1963: crash when using a popup window with "latin1" encoding
Bram Moolenaar <Bram@vim.org>
parents:
22675
diff
changeset
|
4012 call StopVimInTerminal(buf) |
8059beb101d0
patch 8.2.1963: crash when using a popup window with "latin1" encoding
Bram Moolenaar <Bram@vim.org>
parents:
22675
diff
changeset
|
4013 endfunc |
8059beb101d0
patch 8.2.1963: crash when using a popup window with "latin1" encoding
Bram Moolenaar <Bram@vim.org>
parents:
22675
diff
changeset
|
4014 |
19605
5ad7a406647a
patch 8.2.0359: popup_atcursor() may hang
Bram Moolenaar <Bram@vim.org>
parents:
19599
diff
changeset
|
4015 func Test_popupwin_atcursor_far_right() |
5ad7a406647a
patch 8.2.0359: popup_atcursor() may hang
Bram Moolenaar <Bram@vim.org>
parents:
19599
diff
changeset
|
4016 new |
5ad7a406647a
patch 8.2.0359: popup_atcursor() may hang
Bram Moolenaar <Bram@vim.org>
parents:
19599
diff
changeset
|
4017 |
5ad7a406647a
patch 8.2.0359: popup_atcursor() may hang
Bram Moolenaar <Bram@vim.org>
parents:
19599
diff
changeset
|
4018 " this was getting stuck |
5ad7a406647a
patch 8.2.0359: popup_atcursor() may hang
Bram Moolenaar <Bram@vim.org>
parents:
19599
diff
changeset
|
4019 set signcolumn=yes |
5ad7a406647a
patch 8.2.0359: popup_atcursor() may hang
Bram Moolenaar <Bram@vim.org>
parents:
19599
diff
changeset
|
4020 call setline(1, repeat('=', &columns)) |
5ad7a406647a
patch 8.2.0359: popup_atcursor() may hang
Bram Moolenaar <Bram@vim.org>
parents:
19599
diff
changeset
|
4021 normal! ggg$ |
20386
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20375
diff
changeset
|
4022 let winid = popup_atcursor(repeat('x', 500), #{moved: 'any', border: []}) |
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20375
diff
changeset
|
4023 |
21506
1d1ffb0dbd87
patch 8.2.1303: calling popup_setoptions() resets 'signcolumn'
Bram Moolenaar <Bram@vim.org>
parents:
21373
diff
changeset
|
4024 " 'signcolumn' was getting reset |
1d1ffb0dbd87
patch 8.2.1303: calling popup_setoptions() resets 'signcolumn'
Bram Moolenaar <Bram@vim.org>
parents:
21373
diff
changeset
|
4025 call setwinvar(winid, '&signcolumn', 'yes') |
1d1ffb0dbd87
patch 8.2.1303: calling popup_setoptions() resets 'signcolumn'
Bram Moolenaar <Bram@vim.org>
parents:
21373
diff
changeset
|
4026 call popup_setoptions(winid, {'zindex': 1000}) |
1d1ffb0dbd87
patch 8.2.1303: calling popup_setoptions() resets 'signcolumn'
Bram Moolenaar <Bram@vim.org>
parents:
21373
diff
changeset
|
4027 call assert_equal('yes', getwinvar(winid, '&signcolumn')) |
1d1ffb0dbd87
patch 8.2.1303: calling popup_setoptions() resets 'signcolumn'
Bram Moolenaar <Bram@vim.org>
parents:
21373
diff
changeset
|
4028 |
20386
3b3589275ab9
patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents:
20375
diff
changeset
|
4029 call popup_close(winid) |
19605
5ad7a406647a
patch 8.2.0359: popup_atcursor() may hang
Bram Moolenaar <Bram@vim.org>
parents:
19599
diff
changeset
|
4030 bwipe! |
5ad7a406647a
patch 8.2.0359: popup_atcursor() may hang
Bram Moolenaar <Bram@vim.org>
parents:
19599
diff
changeset
|
4031 set signcolumn& |
5ad7a406647a
patch 8.2.0359: popup_atcursor() may hang
Bram Moolenaar <Bram@vim.org>
parents:
19599
diff
changeset
|
4032 endfunc |
5ad7a406647a
patch 8.2.0359: popup_atcursor() may hang
Bram Moolenaar <Bram@vim.org>
parents:
19599
diff
changeset
|
4033 |
19732
e292acf16e26
patch 8.2.0422: crash when passing popup window to win_splitmove()
Bram Moolenaar <Bram@vim.org>
parents:
19621
diff
changeset
|
4034 func Test_popupwin_splitmove() |
e292acf16e26
patch 8.2.0422: crash when passing popup window to win_splitmove()
Bram Moolenaar <Bram@vim.org>
parents:
19621
diff
changeset
|
4035 vsplit |
e292acf16e26
patch 8.2.0422: crash when passing popup window to win_splitmove()
Bram Moolenaar <Bram@vim.org>
parents:
19621
diff
changeset
|
4036 let win2 = win_getid() |
e292acf16e26
patch 8.2.0422: crash when passing popup window to win_splitmove()
Bram Moolenaar <Bram@vim.org>
parents:
19621
diff
changeset
|
4037 let popup_winid = popup_dialog('hello', {}) |
e292acf16e26
patch 8.2.0422: crash when passing popup window to win_splitmove()
Bram Moolenaar <Bram@vim.org>
parents:
19621
diff
changeset
|
4038 call assert_fails('call win_splitmove(popup_winid, win2)', 'E957:') |
e292acf16e26
patch 8.2.0422: crash when passing popup window to win_splitmove()
Bram Moolenaar <Bram@vim.org>
parents:
19621
diff
changeset
|
4039 call assert_fails('call win_splitmove(win2, popup_winid)', 'E957:') |
e292acf16e26
patch 8.2.0422: crash when passing popup window to win_splitmove()
Bram Moolenaar <Bram@vim.org>
parents:
19621
diff
changeset
|
4040 |
e292acf16e26
patch 8.2.0422: crash when passing popup window to win_splitmove()
Bram Moolenaar <Bram@vim.org>
parents:
19621
diff
changeset
|
4041 call popup_clear() |
e292acf16e26
patch 8.2.0422: crash when passing popup window to win_splitmove()
Bram Moolenaar <Bram@vim.org>
parents:
19621
diff
changeset
|
4042 bwipe |
e292acf16e26
patch 8.2.0422: crash when passing popup window to win_splitmove()
Bram Moolenaar <Bram@vim.org>
parents:
19621
diff
changeset
|
4043 endfunc |
e292acf16e26
patch 8.2.0422: crash when passing popup window to win_splitmove()
Bram Moolenaar <Bram@vim.org>
parents:
19621
diff
changeset
|
4044 |
22838
80bd5de5dcab
patch 8.2.1966: popup becomes current window after closing a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4045 func Test_popupwin_exiting_terminal() |
80bd5de5dcab
patch 8.2.1966: popup becomes current window after closing a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4046 CheckFeature terminal |
80bd5de5dcab
patch 8.2.1966: popup becomes current window after closing a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4047 |
80bd5de5dcab
patch 8.2.1966: popup becomes current window after closing a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4048 " Tests that when creating a popup right after closing a terminal window does |
80bd5de5dcab
patch 8.2.1966: popup becomes current window after closing a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4049 " not make the popup the current window. |
80bd5de5dcab
patch 8.2.1966: popup becomes current window after closing a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4050 let winid = win_getid() |
80bd5de5dcab
patch 8.2.1966: popup becomes current window after closing a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4051 try |
80bd5de5dcab
patch 8.2.1966: popup becomes current window after closing a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4052 augroup Test_popupwin_exiting_terminal |
80bd5de5dcab
patch 8.2.1966: popup becomes current window after closing a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4053 autocmd! |
80bd5de5dcab
patch 8.2.1966: popup becomes current window after closing a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4054 autocmd WinEnter * :call popup_create('test', {}) |
80bd5de5dcab
patch 8.2.1966: popup becomes current window after closing a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4055 augroup END |
80bd5de5dcab
patch 8.2.1966: popup becomes current window after closing a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4056 let bnr = term_start(&shell, #{term_finish: 'close'}) |
80bd5de5dcab
patch 8.2.1966: popup becomes current window after closing a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4057 call term_sendkeys(bnr, "exit\r\n") |
80bd5de5dcab
patch 8.2.1966: popup becomes current window after closing a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4058 call WaitForAssert({-> assert_equal(winid, win_getid())}) |
80bd5de5dcab
patch 8.2.1966: popup becomes current window after closing a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4059 finally |
80bd5de5dcab
patch 8.2.1966: popup becomes current window after closing a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4060 call popup_clear(1) |
80bd5de5dcab
patch 8.2.1966: popup becomes current window after closing a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4061 augroup Test_popupwin_exiting_terminal |
80bd5de5dcab
patch 8.2.1966: popup becomes current window after closing a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4062 autocmd! |
80bd5de5dcab
patch 8.2.1966: popup becomes current window after closing a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4063 augroup END |
80bd5de5dcab
patch 8.2.1966: popup becomes current window after closing a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4064 endtry |
80bd5de5dcab
patch 8.2.1966: popup becomes current window after closing a terminal window
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4065 endfunc |
19732
e292acf16e26
patch 8.2.0422: crash when passing popup window to win_splitmove()
Bram Moolenaar <Bram@vim.org>
parents:
19621
diff
changeset
|
4066 |
23507
88a7e3bbb594
patch 8.2.2296: cannot use CTRL-N and CTRL-P in a popup menu
Bram Moolenaar <Bram@vim.org>
parents:
23400
diff
changeset
|
4067 func Test_popup_filter_menu() |
88a7e3bbb594
patch 8.2.2296: cannot use CTRL-N and CTRL-P in a popup menu
Bram Moolenaar <Bram@vim.org>
parents:
23400
diff
changeset
|
4068 let colors = ['red', 'green', 'blue'] |
88a7e3bbb594
patch 8.2.2296: cannot use CTRL-N and CTRL-P in a popup menu
Bram Moolenaar <Bram@vim.org>
parents:
23400
diff
changeset
|
4069 call popup_menu(colors, #{callback: {_, result -> assert_equal('green', colors[result - 1])}}) |
88a7e3bbb594
patch 8.2.2296: cannot use CTRL-N and CTRL-P in a popup menu
Bram Moolenaar <Bram@vim.org>
parents:
23400
diff
changeset
|
4070 call feedkeys("\<c-n>\<c-n>\<c-p>\<cr>", 'xt') |
88a7e3bbb594
patch 8.2.2296: cannot use CTRL-N and CTRL-P in a popup menu
Bram Moolenaar <Bram@vim.org>
parents:
23400
diff
changeset
|
4071 endfunc |
88a7e3bbb594
patch 8.2.2296: cannot use CTRL-N and CTRL-P in a popup menu
Bram Moolenaar <Bram@vim.org>
parents:
23400
diff
changeset
|
4072 |
23857
16a19892e22e
patch 8.2.2470: popup_getoptions() does not get textprop from other tab
Bram Moolenaar <Bram@vim.org>
parents:
23507
diff
changeset
|
4073 func Test_popup_getoptions_other_tab() |
16a19892e22e
patch 8.2.2470: popup_getoptions() does not get textprop from other tab
Bram Moolenaar <Bram@vim.org>
parents:
23507
diff
changeset
|
4074 new |
16a19892e22e
patch 8.2.2470: popup_getoptions() does not get textprop from other tab
Bram Moolenaar <Bram@vim.org>
parents:
23507
diff
changeset
|
4075 call setline(1, 'some text') |
16a19892e22e
patch 8.2.2470: popup_getoptions() does not get textprop from other tab
Bram Moolenaar <Bram@vim.org>
parents:
23507
diff
changeset
|
4076 call prop_type_add('textprop', {}) |
16a19892e22e
patch 8.2.2470: popup_getoptions() does not get textprop from other tab
Bram Moolenaar <Bram@vim.org>
parents:
23507
diff
changeset
|
4077 call prop_add(1, 1, #{type: 'textprop', length: 1}) |
16a19892e22e
patch 8.2.2470: popup_getoptions() does not get textprop from other tab
Bram Moolenaar <Bram@vim.org>
parents:
23507
diff
changeset
|
4078 let id = popup_create('TEST', #{textprop: 'textprop', highlight: 'ErrorMsg', tabpage: 1}) |
16a19892e22e
patch 8.2.2470: popup_getoptions() does not get textprop from other tab
Bram Moolenaar <Bram@vim.org>
parents:
23507
diff
changeset
|
4079 tab sp |
16a19892e22e
patch 8.2.2470: popup_getoptions() does not get textprop from other tab
Bram Moolenaar <Bram@vim.org>
parents:
23507
diff
changeset
|
4080 call assert_equal(['textprop', 'textpropid', 'textpropwin'], popup_getoptions(id)->keys()->filter({_, v -> v =~ 'textprop'})) |
16a19892e22e
patch 8.2.2470: popup_getoptions() does not get textprop from other tab
Bram Moolenaar <Bram@vim.org>
parents:
23507
diff
changeset
|
4081 |
16a19892e22e
patch 8.2.2470: popup_getoptions() does not get textprop from other tab
Bram Moolenaar <Bram@vim.org>
parents:
23507
diff
changeset
|
4082 tabclose |
23859
12b446696927
patch 8.2.2471: popup_setoptions() does not set textprop in other tab
Bram Moolenaar <Bram@vim.org>
parents:
23857
diff
changeset
|
4083 call popup_close(id) |
23857
16a19892e22e
patch 8.2.2470: popup_getoptions() does not get textprop from other tab
Bram Moolenaar <Bram@vim.org>
parents:
23507
diff
changeset
|
4084 bwipe! |
16a19892e22e
patch 8.2.2470: popup_getoptions() does not get textprop from other tab
Bram Moolenaar <Bram@vim.org>
parents:
23507
diff
changeset
|
4085 call prop_type_delete('textprop') |
16a19892e22e
patch 8.2.2470: popup_getoptions() does not get textprop from other tab
Bram Moolenaar <Bram@vim.org>
parents:
23507
diff
changeset
|
4086 endfunc |
16a19892e22e
patch 8.2.2470: popup_getoptions() does not get textprop from other tab
Bram Moolenaar <Bram@vim.org>
parents:
23507
diff
changeset
|
4087 |
23859
12b446696927
patch 8.2.2471: popup_setoptions() does not set textprop in other tab
Bram Moolenaar <Bram@vim.org>
parents:
23857
diff
changeset
|
4088 |
12b446696927
patch 8.2.2471: popup_setoptions() does not set textprop in other tab
Bram Moolenaar <Bram@vim.org>
parents:
23857
diff
changeset
|
4089 func Test_popup_setoptions_other_tab() |
30051
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29994
diff
changeset
|
4090 new Xpotfile |
23859
12b446696927
patch 8.2.2471: popup_setoptions() does not set textprop in other tab
Bram Moolenaar <Bram@vim.org>
parents:
23857
diff
changeset
|
4091 let winid = win_getid() |
12b446696927
patch 8.2.2471: popup_setoptions() does not set textprop in other tab
Bram Moolenaar <Bram@vim.org>
parents:
23857
diff
changeset
|
4092 call setline(1, 'some text') |
12b446696927
patch 8.2.2471: popup_setoptions() does not set textprop in other tab
Bram Moolenaar <Bram@vim.org>
parents:
23857
diff
changeset
|
4093 call prop_type_add('textprop', {}) |
12b446696927
patch 8.2.2471: popup_setoptions() does not set textprop in other tab
Bram Moolenaar <Bram@vim.org>
parents:
23857
diff
changeset
|
4094 call prop_add(1, 1, #{type: 'textprop', length: 1}) |
12b446696927
patch 8.2.2471: popup_setoptions() does not set textprop in other tab
Bram Moolenaar <Bram@vim.org>
parents:
23857
diff
changeset
|
4095 let id = popup_create('TEST', #{textprop: 'textprop'}) |
12b446696927
patch 8.2.2471: popup_setoptions() does not set textprop in other tab
Bram Moolenaar <Bram@vim.org>
parents:
23857
diff
changeset
|
4096 tab sp |
12b446696927
patch 8.2.2471: popup_setoptions() does not set textprop in other tab
Bram Moolenaar <Bram@vim.org>
parents:
23857
diff
changeset
|
4097 call popup_setoptions(id, #{textprop: 'textprop', textpropwin: winid}) |
12b446696927
patch 8.2.2471: popup_setoptions() does not set textprop in other tab
Bram Moolenaar <Bram@vim.org>
parents:
23857
diff
changeset
|
4098 call assert_equal(winid, popup_getoptions(id).textpropwin) |
12b446696927
patch 8.2.2471: popup_setoptions() does not set textprop in other tab
Bram Moolenaar <Bram@vim.org>
parents:
23857
diff
changeset
|
4099 |
12b446696927
patch 8.2.2471: popup_setoptions() does not set textprop in other tab
Bram Moolenaar <Bram@vim.org>
parents:
23857
diff
changeset
|
4100 tabclose |
12b446696927
patch 8.2.2471: popup_setoptions() does not set textprop in other tab
Bram Moolenaar <Bram@vim.org>
parents:
23857
diff
changeset
|
4101 call popup_close(id) |
30051
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29994
diff
changeset
|
4102 bwipe! Xpotfile |
23859
12b446696927
patch 8.2.2471: popup_setoptions() does not set textprop in other tab
Bram Moolenaar <Bram@vim.org>
parents:
23857
diff
changeset
|
4103 call prop_type_delete('textprop') |
12b446696927
patch 8.2.2471: popup_setoptions() does not set textprop in other tab
Bram Moolenaar <Bram@vim.org>
parents:
23857
diff
changeset
|
4104 endfunc |
12b446696927
patch 8.2.2471: popup_setoptions() does not set textprop in other tab
Bram Moolenaar <Bram@vim.org>
parents:
23857
diff
changeset
|
4105 |
23897
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4106 func Test_popup_prop_not_visible() |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4107 CheckScreendump |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4108 |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4109 let lines =<< trim END |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4110 vim9script |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4111 set nowrap stal=2 |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4112 rightbelow :31vnew |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4113 setline(1, ['', 'some text', '', 'other text']) |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4114 prop_type_add('someprop', {}) |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4115 prop_add(2, 9, {type: 'someprop', length: 5}) |
28778
a8c2bd5fc727
patch 8.2.4913: popup_hide() does not always have effect
Bram Moolenaar <Bram@vim.org>
parents:
28550
diff
changeset
|
4116 g:some_id = popup_create('attached to "some"', { |
23897
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4117 textprop: 'someprop', |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4118 highlight: 'ErrorMsg', |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4119 line: -1, |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4120 wrap: false, |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4121 fixed: true, |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4122 }) |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4123 prop_type_add('otherprop', {}) |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4124 prop_add(4, 10, {type: 'otherprop', length: 5}) |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4125 popup_create('attached to "other"', { |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4126 textprop: 'otherprop', |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4127 highlight: 'ErrorMsg', |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4128 line: -1, |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4129 wrap: false, |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4130 fixed: false, |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4131 }) |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4132 END |
30986
360f286b5869
patch 9.0.0828: various typos
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
4133 call writefile(lines, 'XtestPropNotVisible', 'D') |
360f286b5869
patch 9.0.0828: various typos
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
4134 let buf = RunVimInTerminal('-S XtestPropNotVisible', #{rows: 10}) |
23897
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4135 call VerifyScreenDump(buf, 'Test_popup_prop_not_visible_01', {}) |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4136 |
28778
a8c2bd5fc727
patch 8.2.4913: popup_hide() does not always have effect
Bram Moolenaar <Bram@vim.org>
parents:
28550
diff
changeset
|
4137 " check that hiding and unhiding the popup works |
a8c2bd5fc727
patch 8.2.4913: popup_hide() does not always have effect
Bram Moolenaar <Bram@vim.org>
parents:
28550
diff
changeset
|
4138 call term_sendkeys(buf, ":call popup_hide(g:some_id)\<CR>") |
a8c2bd5fc727
patch 8.2.4913: popup_hide() does not always have effect
Bram Moolenaar <Bram@vim.org>
parents:
28550
diff
changeset
|
4139 call VerifyScreenDump(buf, 'Test_popup_prop_not_visible_01a', {}) |
a8c2bd5fc727
patch 8.2.4913: popup_hide() does not always have effect
Bram Moolenaar <Bram@vim.org>
parents:
28550
diff
changeset
|
4140 call term_sendkeys(buf, ":call popup_show(g:some_id)\<CR>") |
a8c2bd5fc727
patch 8.2.4913: popup_hide() does not always have effect
Bram Moolenaar <Bram@vim.org>
parents:
28550
diff
changeset
|
4141 call VerifyScreenDump(buf, 'Test_popup_prop_not_visible_01b', {}) |
a8c2bd5fc727
patch 8.2.4913: popup_hide() does not always have effect
Bram Moolenaar <Bram@vim.org>
parents:
28550
diff
changeset
|
4142 |
23897
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4143 call term_sendkeys(buf, ":vert resize -14\<CR>") |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4144 call VerifyScreenDump(buf, 'Test_popup_prop_not_visible_02', {}) |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4145 |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4146 call term_sendkeys(buf, ":vert resize -8\<CR>") |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4147 call VerifyScreenDump(buf, 'Test_popup_prop_not_visible_03', {}) |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4148 |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4149 " clean up |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4150 call StopVimInTerminal(buf) |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4151 endfunction |
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4152 |
24868
e8451dc0d643
patch 8.2.2972: "%bd" tries to delete popup window buffers, which fails
Bram Moolenaar <Bram@vim.org>
parents:
24709
diff
changeset
|
4153 func Test_bufdel_skips_popupwin_buffer() |
e8451dc0d643
patch 8.2.2972: "%bd" tries to delete popup window buffers, which fails
Bram Moolenaar <Bram@vim.org>
parents:
24709
diff
changeset
|
4154 let id = popup_create("Some text", {}) |
e8451dc0d643
patch 8.2.2972: "%bd" tries to delete popup window buffers, which fails
Bram Moolenaar <Bram@vim.org>
parents:
24709
diff
changeset
|
4155 %bd |
e8451dc0d643
patch 8.2.2972: "%bd" tries to delete popup window buffers, which fails
Bram Moolenaar <Bram@vim.org>
parents:
24709
diff
changeset
|
4156 call popup_close(id) |
e8451dc0d643
patch 8.2.2972: "%bd" tries to delete popup window buffers, which fails
Bram Moolenaar <Bram@vim.org>
parents:
24709
diff
changeset
|
4157 endfunc |
e8451dc0d643
patch 8.2.2972: "%bd" tries to delete popup window buffers, which fails
Bram Moolenaar <Bram@vim.org>
parents:
24709
diff
changeset
|
4158 |
30160
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4159 func Test_term_popup_bufline() |
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4160 " very specific situation where a non-existing buffer line is used, leading |
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4161 " to an ml_get error |
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4162 CheckScreendump |
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4163 |
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4164 let lines =<< trim END |
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4165 vim9script |
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4166 &scrolloff = 5 |
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4167 term_start('seq 1 5', {term_finish: 'open'}) |
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4168 timer_start(50, (_) => { |
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4169 set cpoptions&vim |
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4170 var buf = popup_create([], {})->winbufnr() |
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4171 appendbufline(buf, 0, range(5)) |
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4172 }) |
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4173 END |
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4174 call writefile(lines, 'XtestTermPopup', 'D') |
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4175 let buf = RunVimInTerminal('-S XtestTermPopup', #{rows: 15}) |
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4176 call VerifyScreenDump(buf, 'Test_term_popup_bufline', {}) |
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4177 |
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4178 " clean up |
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4179 call StopVimInTerminal(buf) |
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4180 endfunc |
fbf6084346cc
patch 9.0.0416: ml_get error when appending lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
4181 |
23897
3033dade50ca
patch 8.2.2491: popup window for text property may show in first screen line
Bram Moolenaar <Bram@vim.org>
parents:
23859
diff
changeset
|
4182 |
17442
57b9fca8c7d2
patch 8.1.1719: popup too wide when 'showbreak' is set
Bram Moolenaar <Bram@vim.org>
parents:
17438
diff
changeset
|
4183 " vim: shiftwidth=2 sts=2 |