annotate runtime/doc/popup.txt @ 35075:43739470fe40 default tip

runtime(asm): missing setlocal in indent plugin (#14658) Commit: https://github.com/vim/vim/commit/2e9b9e9a9ebf3fd40437260ecd6b1e23b02c636b Author: Marc Sven Schulte <167623652+msschulte@users.noreply.github.com> Date: Sun Apr 28 21:43:03 2024 +0200 runtime(asm): missing setlocal in indent plugin (https://github.com/vim/vim/issues/14658) Signed-off-by: Marc Sven Schulte <167623652+msschulte@users.noreply.github.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sun, 28 Apr 2024 21:45:03 +0200
parents 4635e43f2c6f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
34057
4635e43f2c6f patch 9.1.0000: Vim 9.1 release
Christian Brabandt <cb@256bit.org>
parents: 32004
diff changeset
1 *popup.txt* For Vim version 9.1. Last change: 2022 Oct 07
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 VIM REFERENCE MANUAL by Bram Moolenaar
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6
18750
82a28df1e2d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18639
diff changeset
7 Displaying text in a floating window. *popup* *popup-window* *popupwin*
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 1. Introduction |popup-intro|
17257
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
11 Window position and size |popup-position|
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
12 Closing the popup window |popup-close|
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
13 Popup buffer and window |popup-buffer|
19303
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
14 Terminal in popup window |popup-terminal|
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 2. Functions |popup-functions|
17257
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
16 Details |popup-function-details|
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
17 3. Usage |popup-usage|
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
18 popup_create() arguments |popup_create-arguments|
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
19 Popup text properties |popup-props|
17863
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
20 Position popup with textprop |popup-textprop-pos|
17257
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
21 Popup filter |popup-filter|
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
22 Popup callback |popup-callback|
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
23 Popup scrollbar |popup-scrollbar|
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
24 Popup mask |popup-mask|
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
25 4. Examples |popup-examples|
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27
18790
8dde7ced3344 Update a few runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18750
diff changeset
28 {not available if the |+popupwin| feature was disabled at compile time}
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 ==============================================================================
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 1. Introduction *popup-intro*
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
33 We are talking about popup windows here, text that goes on top of the regular
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
34 windows and is under control of a plugin. You cannot edit the text in the
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
35 popup window like with regular windows.
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
36
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
37 A popup window can be used for such things as:
16808
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
38 - briefly show a message without overwriting the command line
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
39 - prompt the user with a dialog
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
40 - display contextual information while typing
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
41 - give extra information for auto-completion
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
42
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
43 The text in the popup window can be colored with |text-properties|. It is
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
44 also possible to use syntax highlighting.
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
45
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
46 The default color used is "Pmenu". If you prefer something else use the
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
47 "highlight" argument or the 'wincolor' option, e.g.: >
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
48 hi MyPopupColor ctermbg=lightblue guibg=lightblue
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
49 call setwinvar(winid, '&wincolor', 'MyPopupColor')
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
50
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
51 'hlsearch' highlighting is not displayed in a popup window.
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
52
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
53 A popup window has a window-ID like other windows, but behaves differently.
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
54 The size can be up to the whole Vim window and it overlaps other windows.
17075
dacd46fbaa90 patch 8.1.1537: using "tab" for popup window can be confusing
Bram Moolenaar <Bram@vim.org>
parents: 17051
diff changeset
55 Popup windows can also overlap each other. The "zindex" property specifies
dacd46fbaa90 patch 8.1.1537: using "tab" for popup window can be confusing
Bram Moolenaar <Bram@vim.org>
parents: 17051
diff changeset
56 what goes on top of what.
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
57 *E366*
16808
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
58 The popup window contains a buffer, and that buffer is always associated with
17075
dacd46fbaa90 patch 8.1.1537: using "tab" for popup window can be confusing
Bram Moolenaar <Bram@vim.org>
parents: 17051
diff changeset
59 the popup window. The window cannot be in Normal, Visual or Insert mode, it
dacd46fbaa90 patch 8.1.1537: using "tab" for popup window can be confusing
Bram Moolenaar <Bram@vim.org>
parents: 17051
diff changeset
60 does not get keyboard focus. You can use functions like `setbufline()` to
16808
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
61 change the text in the buffer. There are more differences from how this
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
62 window and buffer behave compared to regular windows and buffers, see
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
63 |popup-buffer|.
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
64
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
65 If this is not what you are looking for, check out other popup functionality:
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 - popup menu, see |popup-menu|
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 - balloon, see |balloon-eval|
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
69
17257
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
70 WINDOW POSITION AND SIZE *popup-position*
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
71
16808
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
72 The height of the window is normally equal to the number of, possibly
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
73 wrapping, lines in the buffer. It can be limited with the "maxheight"
16871
e5dab34ded73 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
74 property. You can use empty lines to increase the height or the "minheight"
e5dab34ded73 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
75 property.
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
76
21676
1b345fb68ae3 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 20552
diff changeset
77 The width of the window is normally equal to the longest visible line in the
1b345fb68ae3 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 20552
diff changeset
78 buffer. It can be limited with the "maxwidth" property. You can use spaces
1b345fb68ae3 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 20552
diff changeset
79 to increase the width or use the "minwidth" property.
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
80
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
81 By default the 'wrap' option is set, so that no text disappears. Otherwise,
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
82 if there is not enough space then the window is shifted left in order to
17219
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
83 display more text. When right-aligned the window is shifted right to display
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
84 more text. The shifting can be disabled with the "fixed" property.
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
85
16871
e5dab34ded73 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
86 Vim tries to show the popup in the location you specify. In some cases, e.g.
e5dab34ded73 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
87 when the popup would go outside of the Vim window, it will show it somewhere
17219
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
88 nearby. E.g. if you use `popup_atcursor()` the popup normally shows just above
16871
e5dab34ded73 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
89 the current cursor position, but if the cursor is close to the top of the Vim
e5dab34ded73 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
90 window it will be placed below the cursor position.
e5dab34ded73 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
91
17036
235cbf491430 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17026
diff changeset
92 When the screen scrolls up for output of an Ex command, popups move too, so
235cbf491430 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17026
diff changeset
93 that they will not cover the output.
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
94
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
95 The current cursor position is displayed even when it is under a popup window.
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
96 That way you can still see where it is, even though you cannot see the text
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
97 that it is in.
16833
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
98
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
99
17257
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
100 CLOSING THE POPUP WINDOW *popup-close*
17219
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
101
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
102 Normally the plugin that created the popup window is also in charge of closing
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
103 it. If somehow a popup hangs around, you can close all of them with: >
22958
e7c125224b1a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
104 call popup_clear(1)
17219
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
105 Some popups, such as notifications, close after a specified time. This can be
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
106 set with the "time" property on `popup_create()`.
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
107 Otherwise, a popup can be closed by clicking on the X in the top-right corner
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
108 or by clicking anywhere inside the popup. This must be enabled with the
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
109 "close" property. It is set by default for notifications.
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
110
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
111
17257
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
112 POPUP BUFFER AND WINDOW *popup-buffer*
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
113
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
114 If a popup function is called to create a popup from text, a new buffer is
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
115 created to hold the text and text properties of the popup window. The buffer
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
116 is always associated with the popup window and manipulation is restricted:
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
117 - the buffer has no name
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
118 - 'buftype' is "popup"
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
119 - 'swapfile' is off
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
120 - 'bufhidden' is "hide"
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
121 - 'buflisted' is off
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
122 - 'undolevels' is -1: no undo at all
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
123 - all other buffer-local and window-local options are set to their Vim default
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
124 value.
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
125
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
126 It is possible to change the specifically mentioned options, but anything
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
127 might break then, so better leave them alone.
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
128
17909
cc953757ed2a Runtime files update.
Bram Moolenaar <Bram@vim.org>
parents: 17863
diff changeset
129 The window does have a cursor position, but the cursor is not displayed. In
cc953757ed2a Runtime files update.
Bram Moolenaar <Bram@vim.org>
parents: 17863
diff changeset
130 fact, the cursor in the underlying window is displayed, as if it peeks through
cc953757ed2a Runtime files update.
Bram Moolenaar <Bram@vim.org>
parents: 17863
diff changeset
131 the popup, so you can see where it is.
17257
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
132
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
133 To execute a command in the context of the popup window and buffer use
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
134 `win_execute()`. Example: >
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
135 call win_execute(winid, 'syntax enable')
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
136
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
137 Options can be set on the window with `setwinvar()`, e.g.: >
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
138 call setwinvar(winid, '&wrap', 0)
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
139 And options can be set on the buffer with `setbufvar()`, e.g.: >
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
140 call setbufvar(winbufnr(winid), '&filetype', 'java')
18162
9c3347b21b89 patch 8.1.2076: crash when trying to put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 18053
diff changeset
141 You can also use `win_execute()` with a ":setlocal" command.
17257
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
142
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143
19303
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
144 TERMINAL IN POPUP WINDOW *popup-terminal*
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
145
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
146 A special case is running a terminal in a popup window. Many rules are then
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
147 different: *E863*
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
148 - The popup window always has focus, it is not possible to switch to another
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
149 window.
29066
f8e9d5023bf6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28379
diff changeset
150 - When the job ends, the popup window shows the buffer in Terminal-Normal
f8e9d5023bf6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28379
diff changeset
151 mode. Use `:q` to close it or use "term_finish" value "close".
19457
b70fbf3f0e0b patch 8.2.0286: cannot use popup_close() for a terminal popup
Bram Moolenaar <Bram@vim.org>
parents: 19404
diff changeset
152 - The popup window can be closed with `popup_close()`, the terminal buffer
b70fbf3f0e0b patch 8.2.0286: cannot use popup_close() for a terminal popup
Bram Moolenaar <Bram@vim.org>
parents: 19404
diff changeset
153 then becomes hidden.
20474
3fe45aa3bbc5 patch 8.2.0791: a second popup window with terminal causes trouble
Bram Moolenaar <Bram@vim.org>
parents: 20386
diff changeset
154 - It is not possible to open a second popup window with a terminal. *E861*
19303
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
155 - The default Pmenu color is only used for the border and padding. To change
19813
350e1d3131d8 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19721
diff changeset
156 the color of the terminal itself set the Terminal highlight group before
350e1d3131d8 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19721
diff changeset
157 creating the terminal. Setting 'wincolor' later can work but requires the
350e1d3131d8 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19721
diff changeset
158 program in the terminal to redraw everything.
19721
bceeded72898 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19457
diff changeset
159 - The default minimal size is 5 lines of 20 characters; Use the "minwidth" and
bceeded72898 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19457
diff changeset
160 "minheight" parameters to set a different value.
19813
350e1d3131d8 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19721
diff changeset
161 - The terminal size will grow if the program running in the terminal writes
350e1d3131d8 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19721
diff changeset
162 text. Set "maxheight" and "maxwidth" to restrict the size.
19303
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
163
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
164 To run a terminal in a popup window, first create the terminal hidden. Then
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
165 pass the buffer number to popup_create(). Example: >
19813
350e1d3131d8 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19721
diff changeset
166 hi link Terminal Search
19303
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
167 let buf = term_start(['picker', 'Something'], #{hidden: 1, term_finish: 'close'})
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
168 let winid = popup_create(buf, #{minwidth: 50, minheight: 20})
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18879
diff changeset
169
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
170 ==============================================================================
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
171 2. Functions *popup-functions*
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
172
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
173 Creating a popup window:
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
174 |popup_create()| centered in the screen
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
175 |popup_atcursor()| just above the cursor position, closes when
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
176 the cursor moves away
17292
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
177 |popup_beval()| at the position indicated by v:beval_
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
178 variables, closes when the mouse moves away
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
179 |popup_notification()| show a notification for three seconds
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
180 |popup_dialog()| centered with padding and border
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
181 |popup_menu()| prompt for selecting an item from a list
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
182
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
183 Manipulating a popup window:
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
184 |popup_hide()| hide a popup temporarily
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
185 |popup_show()| show a previously hidden popup
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
186 |popup_move()| change the position and size of a popup
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
187 |popup_setoptions()| override options of a popup
17107
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17097
diff changeset
188 |popup_settext()| replace the popup buffer contents
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
189
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
190 Closing popup windows:
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
191 |popup_close()| close one popup
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
192 |popup_clear()| close all popups
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
193
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
194 Filter functions:
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
195 |popup_filter_menu()| select from a list of items
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
196 |popup_filter_yesno()| blocks until 'y' or 'n' is pressed
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
197
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
198 Other:
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
199 |popup_getoptions()| get current options for a popup
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
200 |popup_getpos()| get actual position and size of a popup
17348
d82b0cfb1e82 patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents: 17320
diff changeset
201 |popup_locate()| find popup window at a screen position
20386
3b3589275ab9 patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents: 20384
diff changeset
202 |popup_list()| get list of all popups
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
203
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
204
17257
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
205 DETAILS *popup-function-details*
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
206
17257
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
207 popup_atcursor({what}, {options}) *popup_atcursor()*
17225
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
208 Show the {what} above the cursor, and close it when the cursor
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
209 moves. This works like: >
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
210 call popup_create({what}, #{
17372
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
211 \ pos: 'botleft',
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
212 \ line: 'cursor-1',
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
213 \ col: 'cursor',
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
214 \ moved: 'WORD',
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
215 \ })
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
216 < Use {options} to change the properties.
18558
e5ef5d820b5b patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents: 18512
diff changeset
217 If "pos" is passed as "topleft" then the default for "line"
e5ef5d820b5b patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents: 18512
diff changeset
218 becomes "cursor+1".
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
219
17972
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
220 Can also be used as a |method|: >
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
221 GetText()->popup_atcursor({})
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
222
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
223
17292
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
224 popup_beval({what}, {options}) *popup_beval()*
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
225 Show the {what} above the position from 'ballooneval' and
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
226 close it when the mouse moves. This works like: >
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
227 let pos = screenpos(v:beval_winnr, v:beval_lnum, v:beval_col)
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
228 call popup_create({what}, #{
17372
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
229 \ pos: 'botleft',
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
230 \ line: pos.row - 1,
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
231 \ col: pos.col,
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
232 \ mousemoved: 'WORD',
17292
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
233 \ })
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
234 < Use {options} to change the properties.
18053
8ac85adee561 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18016
diff changeset
235 See |popup_beval_example| for an example.
17292
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
236
17972
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
237 Can also be used as a |method|: >
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
238 GetText()->popup_beval({})
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
239 <
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
240 *popup_clear()*
20384
42ab4d40e78f patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents: 20379
diff changeset
241 popup_clear([{force}])
42ab4d40e78f patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents: 20379
diff changeset
242 Emergency solution to a misbehaving plugin: close all popup
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
243 windows for the current tab and global popups.
20384
42ab4d40e78f patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents: 20379
diff changeset
244 Close callbacks are not invoked.
42ab4d40e78f patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents: 20379
diff changeset
245 When {force} is not present this will fail if the current
42ab4d40e78f patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents: 20379
diff changeset
246 window is a popup.
42ab4d40e78f patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents: 20379
diff changeset
247 When {force} is present and |TRUE| the popup is also closed
42ab4d40e78f patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents: 20379
diff changeset
248 when it is the current window. If a terminal is running in a
42ab4d40e78f patch 8.2.0747: cannot forcefully close all popups
Bram Moolenaar <Bram@vim.org>
parents: 20379
diff changeset
249 popup it is killed.
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
250
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
251
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
252 popup_close({id} [, {result}]) *popup_close()*
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
253 Close popup {id}. The window and the associated buffer will
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
254 be deleted.
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
255
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
256 If the popup has a callback it will be called just before the
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
257 popup window is deleted. If the optional {result} is present
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
258 it will be passed as the second argument of the callback.
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
259 Otherwise zero is passed to the callback.
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
260
17972
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
261 Can also be used as a |method|: >
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
262 GetPopup()->popup_close()
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
263
25700
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
264
17225
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
265 popup_create({what}, {options}) *popup_create()*
27036
3e661b0cf500 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
266 Open a popup window showing {what}, which is either: *E450*
17225
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
267 - a buffer number
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
268 - a string
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
269 - a list of strings
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
270 - a list of text lines with text properties
17225
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
271 When {what} is not a buffer number, a buffer is created with
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
272 'buftype' set to "popup". That buffer will be wiped out once
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
273 the popup closes.
16871
e5dab34ded73 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
274
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: 27036
diff changeset
275 if {what} is a buffer number and loading the buffer runs into
427600f3b1c5 patch 8.2.4685: when a swap file is found for a popup there is no dialog
Bram Moolenaar <Bram@vim.org>
parents: 27036
diff changeset
276 an existing swap file, it is silently opened read-only, as if
427600f3b1c5 patch 8.2.4685: when a swap file is found for a popup there is no dialog
Bram Moolenaar <Bram@vim.org>
parents: 27036
diff changeset
277 a |SwapExists| autocommand had set |v:swapchoice| to 'o'.
427600f3b1c5 patch 8.2.4685: when a swap file is found for a popup there is no dialog
Bram Moolenaar <Bram@vim.org>
parents: 27036
diff changeset
278 This is because we assume the buffer is only used for viewing.
427600f3b1c5 patch 8.2.4685: when a swap file is found for a popup there is no dialog
Bram Moolenaar <Bram@vim.org>
parents: 27036
diff changeset
279
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
280 {options} is a dictionary with many possible entries.
17257
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
281 See |popup_create-arguments| for details.
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
282
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
283 Returns a window-ID, which can be used with other popup
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
284 functions. Use `winbufnr()` to get the number of the buffer
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
285 in the window: >
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
286 let winid = popup_create('hello', {})
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
287 let bufnr = winbufnr(winid)
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
288 call setbufline(bufnr, 2, 'second line')
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
289 < In case of failure zero is returned.
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
290
17972
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
291 Can also be used as a |method|: >
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
292 GetText()->popup_create({})
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
293
25700
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
294
17225
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
295 popup_dialog({what}, {options}) *popup_dialog()*
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
296 Just like |popup_create()| but with these default options: >
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
297 call popup_create({what}, #{
17372
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
298 \ pos: 'center',
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
299 \ zindex: 200,
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
300 \ drag: 1,
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
301 \ border: [],
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
302 \ padding: [],
17604
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
303 \ mapping: 0,
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
304 \})
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
305 < Use {options} to change the properties. E.g. add a 'filter'
17097
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
306 option with value 'popup_filter_yesno'. Example: >
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
307 call popup_create('do you want to quit (Yes/no)?', #{
17372
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
308 \ filter: 'popup_filter_yesno',
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
309 \ callback: 'QuitCallback',
17097
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
310 \ })
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
311
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
312 < By default the dialog can be dragged, so that text below it
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
313 can be read if needed.
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
314
17972
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
315 Can also be used as a |method|: >
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
316 GetText()->popup_dialog({})
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
317
25700
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
318
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
319 popup_filter_menu({id}, {key}) *popup_filter_menu()*
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
320 Filter that can be used for a popup. These keys can be used:
23507
88a7e3bbb594 patch 8.2.2296: cannot use CTRL-N and CTRL-P in a popup menu
Bram Moolenaar <Bram@vim.org>
parents: 22958
diff changeset
321 j <Down> <C-N> select item below
88a7e3bbb594 patch 8.2.2296: cannot use CTRL-N and CTRL-P in a popup menu
Bram Moolenaar <Bram@vim.org>
parents: 22958
diff changeset
322 k <Up> <C-P> select item above
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
323 <Space> <Enter> accept current selection
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
324 x Esc CTRL-C cancel the 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
325 Other keys are ignored.
22723
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22442
diff changeset
326 Always returns |v:true|.
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
327
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
328 A match is set on that line to highlight it, see
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
329 |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
330
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
331 When the current selection is accepted the "callback" of the
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
332 popup menu is invoked with the index of the selected line as
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
333 the second argument. The first entry has index one.
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
334 Cancelling the menu invokes the callback with -1.
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
335
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
336 To add shortcut keys, see the example here:
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
337 |popup_menu-shortcut-example|
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
338
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
339
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
340 popup_filter_yesno({id}, {key}) *popup_filter_yesno()*
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
341 Filter that can be used for a popup. It handles only the keys
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
342 'y', 'Y' and 'n' or 'N'. Invokes the "callback" of the
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
343 popup menu with the 1 for 'y' or 'Y' and zero for 'n' or 'N'
17097
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
344 as the second argument. Pressing Esc and 'x' works like
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
345 pressing 'n'. CTRL-C invokes the callback with -1. Other
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
346 keys are ignored.
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
347 See the example here: |popup_dialog-example|
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
348
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
349
30697
d914a3812d5b patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents: 29533
diff changeset
350 popup_findecho() *popup_findecho()*
d914a3812d5b patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents: 29533
diff changeset
351 Get the |window-ID| for the popup that shows messages for the
d914a3812d5b patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents: 29533
diff changeset
352 `:echowindow` command. Return zero if there is none.
d914a3812d5b patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents: 29533
diff changeset
353 Mainly useful to hide the popup.
d914a3812d5b patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents: 29533
diff changeset
354
d914a3812d5b patch 9.0.0683: cannot specify a time for :echowindow
Bram Moolenaar <Bram@vim.org>
parents: 29533
diff changeset
355
17817
e8a7029efa40 patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents: 17667
diff changeset
356 popup_findinfo() *popup_findinfo()*
e8a7029efa40 patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents: 17667
diff changeset
357 Get the |window-ID| for the popup info window, as it used by
e8a7029efa40 patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents: 17667
diff changeset
358 the popup menu. See |complete-popup|. The info popup is
e8a7029efa40 patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents: 17667
diff changeset
359 hidden when not used, it can be deleted with |popup_clear()|
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18398
diff changeset
360 and |popup_close()|. Use |popup_show()| to reposition it to
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18398
diff changeset
361 the item in the popup menu.
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18398
diff changeset
362 Returns zero if there is none.
17817
e8a7029efa40 patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents: 17667
diff changeset
363
e8a7029efa40 patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents: 17667
diff changeset
364
e8a7029efa40 patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents: 17667
diff changeset
365 popup_findpreview() *popup_findpreview()*
e8a7029efa40 patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents: 17667
diff changeset
366 Get the |window-ID| for the popup preview window.
e8a7029efa40 patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents: 17667
diff changeset
367 Return zero if there is none.
e8a7029efa40 patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents: 17667
diff changeset
368
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
369 popup_getoptions({id}) *popup_getoptions()*
16841
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16833
diff changeset
370 Return the {options} for popup {id} in a Dict.
16855
19162ff4eacd patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
371 A zero value means the option was not set. For "zindex" the
19162ff4eacd patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
372 default value is returned, not zero.
16841
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16833
diff changeset
373
17292
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
374 The "moved" entry is a list with line number, minimum and
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
375 maximum column, [0, 0, 0] when not set.
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
376
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
377 The "mousemoved" entry is a list with screen row, minimum and
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
378 maximum screen column, [0, 0, 0] when not set.
16841
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16833
diff changeset
379
17909
cc953757ed2a Runtime files update.
Bram Moolenaar <Bram@vim.org>
parents: 17863
diff changeset
380 "firstline" is the property set on the popup, unlike the
cc953757ed2a Runtime files update.
Bram Moolenaar <Bram@vim.org>
parents: 17863
diff changeset
381 "firstline" obtained with |popup_getpos()| which is the actual
cc953757ed2a Runtime files update.
Bram Moolenaar <Bram@vim.org>
parents: 17863
diff changeset
382 buffer line at the top of the popup window.
cc953757ed2a Runtime files update.
Bram Moolenaar <Bram@vim.org>
parents: 17863
diff changeset
383
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
384 "border" and "padding" are not included when all values are
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
385 zero. When all values are one then an empty list is included.
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
386
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
387 "borderhighlight" is not included when all values are empty.
17429
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17413
diff changeset
388 "scrollbarhighlight" and "thumbhighlight" are only included
17216
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17196
diff changeset
389 when set.
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
390
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
391 "tabpage" will be -1 for a global popup, zero for a popup on
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
392 the current tabpage and a positive number for a popup on
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
393 another tabpage.
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
394
17863
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
395 "textprop", "textpropid" and "textpropwin" are only present
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
396 when "textprop" was set.
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
397
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
398 If popup window {id} is not found an empty Dict is returned.
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
399
17972
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
400 Can also be used as a |method|: >
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
401 GetPopup()->popup_getoptions()
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
402
25700
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
403
16855
19162ff4eacd patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
404 popup_getpos({id}) *popup_getpos()*
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
405 Return the position and size of popup {id}. Returns a Dict
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
406 with these entries:
16841
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16833
diff changeset
407 col screen column of the popup, one-based
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16833
diff changeset
408 line screen line of the popup, one-based
16884
59e4148c0c73 patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16880
diff changeset
409 width width of the whole popup in screen cells
59e4148c0c73 patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16880
diff changeset
410 height height of the whole popup in screen cells
59e4148c0c73 patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16880
diff changeset
411 core_col screen column of the text box
59e4148c0c73 patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16880
diff changeset
412 core_line screen line of the text box
59e4148c0c73 patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16880
diff changeset
413 core_width width of the text box in screen cells
59e4148c0c73 patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16880
diff changeset
414 core_height height of the text box in screen cells
17196
983950357c40 patch 8.1.1597: cannot scroll a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents: 17180
diff changeset
415 firstline line of the buffer at top (1 unless scrolled)
18343
375a7ecdb351 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18162
diff changeset
416 (not the value of the "firstline" property)
18558
e5ef5d820b5b patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents: 18512
diff changeset
417 lastline line of the buffer at the bottom (updated when
e5ef5d820b5b patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents: 18512
diff changeset
418 the popup is redrawn)
17196
983950357c40 patch 8.1.1597: cannot scroll a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents: 17180
diff changeset
419 scrollbar non-zero if a scrollbar is displayed
17036
235cbf491430 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17026
diff changeset
420 visible one if the popup is displayed, zero if hidden
16829
5cebaecad422 patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16817
diff changeset
421 Note that these are the actual screen positions. They differ
5cebaecad422 patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16817
diff changeset
422 from the values in `popup_getoptions()` for the sizing and
5cebaecad422 patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16817
diff changeset
423 positioning mechanism applied.
16884
59e4148c0c73 patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16880
diff changeset
424
59e4148c0c73 patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16880
diff changeset
425 The "core_" values exclude the padding and border.
59e4148c0c73 patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16880
diff changeset
426
16829
5cebaecad422 patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16817
diff changeset
427 If popup window {id} is not found an empty Dict is returned.
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
428
17972
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
429 Can also be used as a |method|: >
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
430 GetPopup()->popup_getpos()
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
431
25700
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
432
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
433 popup_hide({id}) *popup_hide()*
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
434 If {id} is a displayed popup, hide it now. If the popup has a
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
435 filter it will not be invoked for so long as the popup is
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
436 hidden.
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
437 If window {id} does not exist nothing happens. If window {id}
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
438 exists but is not a popup window an error is given. *E993*
19404
7be3663e2f2b Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 19303
diff changeset
439 If popup window {id} contains a terminal an error is given.
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
440
17972
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
441 Can also be used as a |method|: >
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
442 GetPopup()->popup_hide()
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
443
25700
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
444
20386
3b3589275ab9 patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents: 20384
diff changeset
445 popup_list() *popup_list()*
3b3589275ab9 patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents: 20384
diff changeset
446 Return a List with the |window-ID| of all existing popups.
3b3589275ab9 patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents: 20384
diff changeset
447
3b3589275ab9 patch 8.2.0748: cannot get a list of all popups
Bram Moolenaar <Bram@vim.org>
parents: 20384
diff changeset
448
17348
d82b0cfb1e82 patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents: 17320
diff changeset
449 popup_locate({row}, {col}) *popup_locate()*
17429
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17413
diff changeset
450 Return the |window-ID| of the popup at screen position {row}
17348
d82b0cfb1e82 patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents: 17320
diff changeset
451 and {col}. If there are multiple popups the one with the
d82b0cfb1e82 patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents: 17320
diff changeset
452 highest zindex is returned. If there are no popups at this
d82b0cfb1e82 patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents: 17320
diff changeset
453 position then zero is returned.
d82b0cfb1e82 patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents: 17320
diff changeset
454
d82b0cfb1e82 patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents: 17320
diff changeset
455
17225
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
456 popup_menu({what}, {options}) *popup_menu()*
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
457 Show the {what} near the cursor, handle selecting one of the
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
458 items with cursorkeys, and close it an item is selected with
17225
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
459 Space or Enter. {what} should have multiple lines to make this
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
460 useful. This works like: >
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
461 call popup_create({what}, #{
17372
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
462 \ pos: 'center',
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
463 \ zindex: 200,
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
464 \ drag: 1,
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
465 \ wrap: 0,
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
466 \ border: [],
17429
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17413
diff changeset
467 \ cursorline: 1,
17383
b18fd36fdf46 patch 8.1.1690: default padding for popup window menu is too much
Bram Moolenaar <Bram@vim.org>
parents: 17372
diff changeset
468 \ padding: [0,1,0,1],
17372
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
469 \ filter: 'popup_filter_menu',
17604
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
470 \ mapping: 0,
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
471 \ })
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
472 < The current line is highlighted with a match using
17161
9ccb1ea9b2fc Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
473 "PopupSelected", or "PmenuSel" if that is not defined.
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
474
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
475 Use {options} to change the properties. Should at least set
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
476 "callback" to a function that handles the selected item.
17604
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
477 Example: >
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
478 func ColorSelected(id, result)
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
479 " use a:result
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
480 endfunc
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
481 call popup_menu(['red', 'green', 'blue'], #{
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
482 \ callback: 'ColorSelected',
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
483 \ })
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
484
17972
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
485 < Can also be used as a |method|: >
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
486 GetChoices()->popup_menu({})
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
487
25700
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
488
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
489 popup_move({id}, {options}) *popup_move()*
17051
221d4b82bc0b patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
490 Move popup {id} to the position specified with {options}.
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
491 {options} may contain the items from |popup_create()| that
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
492 specify the popup position:
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
493 line
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
494 col
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
495 pos
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
496 maxheight
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
497 minheight
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
498 maxwidth
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
499 minwidth
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
500 fixed
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
501 For {id} see `popup_hide()`.
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
502 For other options see |popup_setoptions()|.
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
503
17972
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
504 Can also be used as a |method|: >
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
505 GetPopup()->popup_move(options)
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
506
25700
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
507
17225
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
508 popup_notification({what}, {options}) *popup_notification()*
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
509 Show the {what} for 3 seconds at the top of the Vim window.
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
510 This works like: >
17413
40417757dffd patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents: 17387
diff changeset
511 call popup_create({what}, #{
17372
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
512 \ line: 1,
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
513 \ col: 10,
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
514 \ minwidth: 20,
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
515 \ time: 3000,
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
516 \ tabpage: -1,
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
517 \ zindex: 300,
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
518 \ drag: 1,
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
519 \ highlight: 'WarningMsg',
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
520 \ border: [],
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
521 \ close: 'click',
b9bc47742df6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17348
diff changeset
522 \ padding: [0,1,0,1],
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
523 \ })
17077
2546930657a9 patch 8.1.1538: cannot specify highlighting for notifications
Bram Moolenaar <Bram@vim.org>
parents: 17075
diff changeset
524 < The PopupNotification highlight group is used instead of
2546930657a9 patch 8.1.1538: cannot specify highlighting for notifications
Bram Moolenaar <Bram@vim.org>
parents: 17075
diff changeset
525 WarningMsg if it is defined.
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
526
17946
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
527 Without the |+timers| feature the popup will not disappear
17219
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
528 automatically, the user has to click in it.
17180
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17174
diff changeset
529
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
530 The position will be adjusted to avoid overlap with other
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
531 notifications.
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
532 Use {options} to change the properties.
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
533
17972
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
534 Can also be used as a |method|: >
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
535 GetText()->popup_notification({})
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
536
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
537
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
538 popup_setoptions({id}, {options}) *popup_setoptions()*
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
539 Override options in popup {id} with entries in {options}.
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
540 These options can be set:
17219
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
541 border
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
542 borderchars
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
543 borderhighlight
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
544 callback
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
545 close
17604
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
546 cursorline
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
547 drag
17219
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
548 filter
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
549 firstline
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
550 flip
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
551 highlight
17604
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
552 mapping
17219
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
553 mask
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
554 moved
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
555 padding
17604
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
556 resize
17180
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17174
diff changeset
557 scrollbar
17216
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17196
diff changeset
558 scrollbarhighlight
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17196
diff changeset
559 thumbhighlight
17219
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
560 time
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
561 title
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
562 wrap
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
563 zindex
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
564 The options from |popup_move()| can also be used.
20115
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19813
diff changeset
565 Generally, setting an option to zero or an empty string resets
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19813
diff changeset
566 it to the default value, but there are exceptions.
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
567 For "hidden" use |popup_hide()| and |popup_show()|.
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
568 "tabpage" cannot be changed.
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
569
17972
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
570 Can also be used as a |method|: >
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
571 GetPopup()->popup_setoptions(options)
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
572
25700
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
573
17107
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17097
diff changeset
574 popup_settext({id}, {text}) *popup_settext()*
17946
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
575 Set the text of the buffer in popup win {id}. {text} is the
17225
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
576 same as supplied to |popup_create()|, except that a buffer
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
577 number is not allowed.
17107
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17097
diff changeset
578 Does not change the window size or position, other than caused
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17097
diff changeset
579 by the different text.
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
580
17972
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
581 Can also be used as a |method|: >
a170c48e0f91 patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17946
diff changeset
582 GetPopup()->popup_settext('hello')
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
583
25700
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
584
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
585 popup_show({id}) *popup_show()*
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
586 If {id} is a hidden popup, show it now.
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
587 For {id} see `popup_hide()`.
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
588 If {id} is the info popup it will be positioned next to the
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
589 current popup menu item.
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
590
d4faa2c5211b Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25619
diff changeset
591
17257
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
592 ==============================================================================
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
593 3. Usage *popup-usage*
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
594
17257
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
595 POPUP_CREATE() ARGUMENTS *popup_create-arguments*
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
596
17107
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17097
diff changeset
597 The first argument of |popup_create()| (and the second argument to
17161
9ccb1ea9b2fc Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
598 |popup_settext()|) specifies the text to be displayed, and optionally text
29533
34c1f4cd0c18 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29314
diff changeset
599 properties. It is in one of four forms: *E1284*
17225
09fa437d33d8 patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17219
diff changeset
600 - a buffer number
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
601 - a string
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
602 - a list of strings
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
603 - a list of dictionaries, where each dictionary has these entries:
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
604 text String with the text to display.
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
605 props A list of text properties. Optional.
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
606 Each entry is a dictionary, like the third argument of
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
607 |prop_add()|, but specifying the column in the
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
608 dictionary with a "col" entry, see below:
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
609 |popup-props|.
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
610
18162
9c3347b21b89 patch 8.1.2076: crash when trying to put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 18053
diff changeset
611 If you want to create a new buffer yourself use |bufadd()| and pass the buffer
9c3347b21b89 patch 8.1.2076: crash when trying to put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 18053
diff changeset
612 number to popup_create().
9c3347b21b89 patch 8.1.2076: crash when trying to put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 18053
diff changeset
613
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
614 The second argument of |popup_create()| is a dictionary with options:
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
615 line Screen line where to position the popup. Can use a
16855
19162ff4eacd patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
616 number or "cursor", "cursor+1" or "cursor-1" to use
19162ff4eacd patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
617 the line of the cursor and add or subtract a number of
20115
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19813
diff changeset
618 lines. If omitted or zero the popup is vertically
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19813
diff changeset
619 centered. The first line is 1.
17863
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
620 When using "textprop" the number is relative to the
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
621 text property and can be negative.
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
622 col Screen column where to position the popup. Can use a
16855
19162ff4eacd patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
623 number or "cursor" to use the column of the cursor,
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
624 "cursor+9" or "cursor-9" to add or subtract a number
20115
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19813
diff changeset
625 of columns. If omitted or zero the popup is
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19813
diff changeset
626 horizontally centered. The first column is 1.
17863
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
627 When using "textprop" the number is relative to the
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
628 text property and can be negative.
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
629 pos "topleft", "topright", "botleft" or "botright":
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
630 defines what corner of the popup "line" and "col" are
16841
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16833
diff changeset
631 used for. When not set "topleft" is used.
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16833
diff changeset
632 Alternatively "center" can be used to position the
16855
19162ff4eacd patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
633 popup in the center of the Vim window, in which case
19162ff4eacd patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
634 "line" and "col" are ignored.
18558
e5ef5d820b5b patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents: 18512
diff changeset
635 posinvert When FALSE the value of "pos" is always used. When
e5ef5d820b5b patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents: 18512
diff changeset
636 TRUE (the default) and the popup does not fit
e5ef5d820b5b patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents: 18512
diff changeset
637 vertically and there is more space on the other side
e5ef5d820b5b patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents: 18512
diff changeset
638 then the popup is placed on the other side of the
e5ef5d820b5b patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents: 18512
diff changeset
639 position indicated by "line".
17863
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
640 textprop When present the popup is positioned next to a text
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
641 property with this name and will move when the text
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
642 property moves. Use an empty string to remove. See
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
643 |popup-textprop-pos|.
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
644 textpropwin What window to search for the text property. When
23931
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
645 omitted or invalid the current window is used. Used
5b37a0bf7e3a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23737
diff changeset
646 when "textprop" is present.
17863
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
647 textpropid Used to identify the text property when "textprop" is
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
648 present. Use zero to reset.
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
649 fixed When FALSE (the default), and:
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
650 - "pos" is "botleft" or "topleft", and
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
651 - "wrap" is off, and
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
652 - the popup would be truncated at the right edge of
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
653 the screen, then
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
654 the popup is moved to the left so as to fit the
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
655 contents on the screen. Set to TRUE to disable this.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
656 flip When TRUE (the default) and the position is relative
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
657 to the cursor, flip to below or above the cursor to
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
658 avoid overlap with the |popupmenu-completion| or
17107
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17097
diff changeset
659 another popup with a higher "zindex". When there is
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17097
diff changeset
660 no space above/below the cursor then show the popup to
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17097
diff changeset
661 the side of the popup or popup menu.
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
662 {not implemented yet}
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
663 maxheight Maximum height of the contents, excluding border and
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
664 padding.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
665 minheight Minimum height of the contents, excluding border and
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
666 padding.
17571
2704c4e3e20a Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17545
diff changeset
667 maxwidth Maximum width of the contents, excluding border,
2704c4e3e20a Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17545
diff changeset
668 padding and scrollbar.
2704c4e3e20a Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17545
diff changeset
669 minwidth Minimum width of the contents, excluding border,
2704c4e3e20a Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 17545
diff changeset
670 padding and scrollbar.
17047
6400d1ad5e4b patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents: 17045
diff changeset
671 firstline First buffer line to display. When larger than one it
6400d1ad5e4b patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents: 17045
diff changeset
672 looks like the text scrolled up. When out of range
6400d1ad5e4b patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents: 17045
diff changeset
673 the last buffer line will at the top of the window.
17909
cc953757ed2a Runtime files update.
Bram Moolenaar <Bram@vim.org>
parents: 17863
diff changeset
674 Set to zero to leave the position as set by commands.
17180
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17174
diff changeset
675 Also see "scrollbar".
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
676 hidden When TRUE the popup exists but is not displayed; use
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
677 `popup_show()` to unhide it.
17161
9ccb1ea9b2fc Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
678 tabpage When -1: display the popup on all tab pages.
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
679 When 0 (the default): display the popup on the current
17075
dacd46fbaa90 patch 8.1.1537: using "tab" for popup window can be confusing
Bram Moolenaar <Bram@vim.org>
parents: 17051
diff changeset
680 tab page.
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
681 Otherwise the number of the tab page the popup is
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
682 displayed on; when invalid the popup is not created
17174
23609a6d8cc7 patch 8.1.1586: error number used in two places
Bram Moolenaar <Bram@vim.org>
parents: 17162
diff changeset
683 and an error is given. *E997*
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
684 title Text to be displayed above the first item in the
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
685 popup, on top of any border. If there is no top
17051
221d4b82bc0b patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
686 border one line of padding is added to put the title
17119
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
687 on. You might want to add one or more spaces at the
b439e096a011 patch 8.1.1559: popup window title property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17117
diff changeset
688 start and end as padding.
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
689 wrap TRUE to make the lines wrap (default TRUE).
17051
221d4b82bc0b patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
690 drag TRUE to allow the popup to be dragged with the mouse
17946
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
691 by grabbing at the border. Has no effect if the
17107
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17097
diff changeset
692 popup does not have a border. As soon as dragging
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17097
diff changeset
693 starts and "pos" is "center" it is changed to
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17097
diff changeset
694 "topleft".
26332
8b7f01b39d79 patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents: 25700
diff changeset
695 dragall TRUE to allow the popup to be dragged from every
8b7f01b39d79 patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents: 25700
diff changeset
696 position. Makes it very difficult to select text in
8b7f01b39d79 patch 8.2.3697: cannot drag a popup without a border
Bram Moolenaar <Bram@vim.org>
parents: 25700
diff changeset
697 the popup.
17580
d5e5d0fc3fa8 patch 8.1.1787: cannot resize a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17571
diff changeset
698 resize TRUE to allow the popup to be resized with the mouse
17946
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
699 by grabbing at the bottom right corner. Has no effect
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
700 if the popup does not have a border.
17219
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
701 close When "button" an X is displayed in the top-right, on
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
702 top of any border, padding or text. When clicked on
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
703 the X the popup will close. Any callback is invoked
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
704 with the value -2.
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
705 When "click" any mouse click in the popup will close
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
706 it.
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
707 When "none" (the default) mouse clicks do not close
5169811b3044 patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17216
diff changeset
708 the popup window.
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
709 highlight Highlight group name to use for the text, stored in
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
710 the 'wincolor' option.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
711 padding List with numbers, defining the padding
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
712 above/right/below/left of the popup (similar to CSS).
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
713 An empty list uses a padding of 1 all around. The
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
714 padding goes around the text, inside any border.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
715 Padding uses the 'wincolor' highlight.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
716 Example: [1, 2, 1, 3] has 1 line of padding above, 2
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
717 columns on the right, 1 line below and 3 columns on
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
718 the left.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
719 border List with numbers, defining the border thickness
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
720 above/right/below/left of the popup (similar to CSS).
24024
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23931
diff changeset
721 Only values of zero and non-zero are currently
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23931
diff changeset
722 recognized. An empty list uses a border all around.
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
723 borderhighlight List of highlight group names to use for the border.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
724 When one entry it is used for all borders, otherwise
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
725 the highlight for the top/right/bottom/left border.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
726 Example: ['TopColor', 'RightColor', 'BottomColor,
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
727 'LeftColor']
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
728 borderchars List with characters, defining the character to use
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
729 for the top/right/bottom/left border. Optionally
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
730 followed by the character to use for the
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
731 topleft/topright/botright/botleft corner.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
732 Example: ['-', '|', '-', '|', '┌', '┐', '┘', '└']
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
733 When the list has one character it is used for all.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
734 When the list has two characters the first is used for
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
735 the border lines, the second for the corners.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
736 By default a double line is used all around when
17161
9ccb1ea9b2fc Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17149
diff changeset
737 'encoding' is "utf-8" and 'ambiwidth' is "single",
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
738 otherwise ASCII characters are used.
22441
a3bb84cd0f59 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22328
diff changeset
739 scrollbar 1 or true: show a scrollbar when the text doesn't fit.
17180
8581779aa16f patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents: 17174
diff changeset
740 zero: do not show a scrollbar. Default is non-zero.
17216
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17196
diff changeset
741 Also see |popup-scrollbar|.
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17196
diff changeset
742 scrollbarhighlight Highlight group name for the scrollbar. The
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17196
diff changeset
743 background color is what matters. When not given then
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17196
diff changeset
744 PmenuSbar is used.
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17196
diff changeset
745 thumbhighlight Highlight group name for the scrollbar thumb. The
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17196
diff changeset
746 background color is what matters. When not given then
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17196
diff changeset
747 PmenuThumb is used.
17051
221d4b82bc0b patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
748 zindex Priority for the popup, default 50. Minimum value is
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
749 1, maximum value is 32000.
17162
f16cee6adf29 patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents: 17161
diff changeset
750 mask A list of lists with coordinates, defining parts of
f16cee6adf29 patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents: 17161
diff changeset
751 the popup that are transparent. See |popup-mask|.
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
752 time Time in milliseconds after which the popup will close.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
753 When omitted |popup_close()| must be used.
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
754 moved Specifies to close the popup if the cursor moved:
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
755 - "any": if the cursor moved at all
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
756 - "word": if the cursor moved outside |<cword>|
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
757 - "WORD": if the cursor moved outside |<cWORD>|
17292
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
758 - "expr": if the cursor moved outside |<cexpr>|
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
759 - [{start}, {end}]: if the cursor moved before column
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
760 {start} or after {end}
18398
21c25bee9df8 patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents: 18343
diff changeset
761 - [{lnum}, {start}, {end}]: if the cursor moved away
21c25bee9df8 patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents: 18343
diff changeset
762 from line {lnum}, before column {start} or after
21c25bee9df8 patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents: 18343
diff changeset
763 {end}
18558
e5ef5d820b5b patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents: 18512
diff changeset
764 - [0, 0, 0] do not close the popup when the cursor
e5ef5d820b5b patch 8.1.2273: wrong default when "pos" is changed with popup_atcursor()
Bram Moolenaar <Bram@vim.org>
parents: 18512
diff changeset
765 moves
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
766 The popup also closes if the cursor moves to another
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
767 line or to another window.
18398
21c25bee9df8 patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents: 18343
diff changeset
768 mousemoved Like "moved" but referring to the mouse pointer
21c25bee9df8 patch 8.1.2193: popup_setoptions(popup_getoptions()) does not work
Bram Moolenaar <Bram@vim.org>
parents: 18343
diff changeset
769 position
24024
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23931
diff changeset
770 cursorline TRUE: Highlight the cursor line. Also scrolls the
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23931
diff changeset
771 text to show this line (only works properly
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23931
diff changeset
772 when 'wrap' is off).
32004
a9b5ffbc0428 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 30875
diff changeset
773 zero: Do not highlight the cursor line.
17429
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17413
diff changeset
774 Default is zero, except for |popup_menu()|.
17036
235cbf491430 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17026
diff changeset
775 filter A callback that can filter typed characters, see
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
776 |popup-filter|.
17604
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
777 mapping Allow for key mapping. When FALSE and the popup is
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
778 visible and has a filter callback key mapping is
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
779 disabled. Default value is TRUE.
17946
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
780 filtermode In which modes the filter is used (same flags as with
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
781 |hasmapto()| plus "a"):
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
782 n Normal mode
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
783 v Visual and Select mode
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
784 x Visual mode
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
785 s Select mode
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
786 o Operator-pending mode
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
787 i Insert mode
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
788 l Language-Argument ("r", "f", "t", etc.)
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
789 c Command-line mode
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
790 a all modes
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
791 The default value is "a".
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
792 callback A callback that is called when the popup closes, e.g.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
793 when using |popup_filter_menu()|, see |popup-callback|.
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
794
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
795 Depending on the "zindex" the popup goes under or above other popups. The
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
796 completion menu (|popup-menu|) has zindex 100. For messages that occur for a
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
797 short time the suggestion is to use zindex 1000.
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
798
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
799 By default text wraps, which causes a line in {lines} to occupy more than one
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
800 screen line. When "wrap" is FALSE then the text outside of the popup or
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
801 outside of the Vim window will not be displayed, thus truncated.
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
802
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
803
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
804 POPUP TEXT PROPERTIES *popup-props*
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
805
16811
0457d49eb2d9 patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents: 16809
diff changeset
806 These are similar to the third argument of |prop_add()| except:
0457d49eb2d9 patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents: 16809
diff changeset
807 - "lnum" is always the current line in the list
0457d49eb2d9 patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents: 16809
diff changeset
808 - "bufnr" is always the buffer of the popup
0457d49eb2d9 patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents: 16809
diff changeset
809 - "col" is in the Dict instead of a separate argument
0457d49eb2d9 patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents: 16809
diff changeset
810 So we get:
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
811 col starting column, counted in bytes, use one for the
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
812 first column.
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
813 length length of text in bytes; can be zero
16811
0457d49eb2d9 patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents: 16809
diff changeset
814 end_lnum line number for the end of the text
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
815 end_col column just after the text; not used when "length" is
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
816 present; when {col} and "end_col" are equal, this is a
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
817 zero-width text property
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
818 id user defined ID for the property; when omitted zero is
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
819 used
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
820 type name of the text property type, as added with
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
821 |prop_type_add()|
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
822
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
823
17863
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
824 POSITION POPUP WITH TEXTPROP *popup-textprop-pos*
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
825
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
826 Positioning a popup next to a text property causes the popup to move when text
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
827 is inserted or deleted. The popup functions like a tooltip.
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
828
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
829 These steps are needed to make this work:
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
830
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
831 - Define a text property type, it defines the name. >
18343
375a7ecdb351 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18162
diff changeset
832 call prop_type_add('popupMarker', {})
17863
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
833
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
834 - Place a text property at the desired text: >
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
835 let lnum = {line of the text}
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
836 let col = {start column of the text}
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
837 let len = {length of the text}
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
838 let propId = {arbitrary but unique number}
18343
375a7ecdb351 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18162
diff changeset
839 call prop_add(lnum, col, #{
17863
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
840 \ length: len,
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
841 \ type: 'popupMarker',
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
842 \ id: propId,
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
843 \ })
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
844
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
845 - Create a popup: >
18343
375a7ecdb351 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18162
diff changeset
846 let winid = popup_create('the text', #{
375a7ecdb351 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18162
diff changeset
847 \ pos: 'botleft',
17863
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
848 \ textprop: 'popupMarker',
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
849 \ textpropid: propId,
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
850 \ border: [],
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
851 \ padding: [0,1,0,1],
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
852 \ close: 'click',
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
853 \ })
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
854
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
855 By default the popup is positioned at the corner of the text, opposite of the
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
856 "pos" specified for the popup. Thus when the popup uses "botleft", the
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
857 bottom-left corner of the popup is positioned next to the top-right corner of
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
858 the text property:
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
859 +----------+
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
860 | the text |
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
861 +----------+
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
862 just some PROPERTY as an example
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
863
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
864 Here the text property is on "PROPERTY". Move the popup to the left by
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
865 passing a negative "col" value to popup_create(). With "col: -5" you get:
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
866
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
867 +----------+
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
868 | the text |
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
869 +----------+
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
870 just some PROPERTY as an example
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
871
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
872 If the text property moves out of view then the popup will be hidden.
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
873 If the window for which the popup was defined is closed, the popup is closed.
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
874
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
875 If the popup cannot fit in the desired position, it may show at a nearby
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
876 position.
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
877
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
878 Some hints:
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
879 - To avoid collision with other plugins the text property type name has to be
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
880 unique. You can also use the "bufnr" item to make it local to a buffer.
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
881 - You can leave out the text property ID if there is only ever one text
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
882 property visible.
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
883 - The popup may be in the way of what the user is doing, making it close with
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
884 a click, as in the example above, helps for that.
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
885 - If the text property is removed the popup is closed. Use something like
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
886 this: >
18343
375a7ecdb351 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18162
diff changeset
887 call prop_remove(#{type: 'popupMarker', id: propId})
17863
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
888
08f1dd29550e patch 8.1.1928: popup windows don't move with the text when making changes
Bram Moolenaar <Bram@vim.org>
parents: 17817
diff changeset
889
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
890 POPUP FILTER *popup-filter*
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
891
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
892 A callback that gets any typed keys while a popup is displayed. The filter is
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
893 not invoked when the popup is hidden.
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
894
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
895 The filter can return TRUE to indicate the key has been handled and is to be
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
896 discarded, or FALSE to let Vim handle the key as usual in the current state.
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
897 In case it returns FALSE and there is another popup window visible, that
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
898 filter is also called. The filter of the popup window with the highest zindex
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
899 is called first.
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
900
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
901 The filter function is called with two arguments: the ID of the popup and the
17097
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
902 key as a string, e.g.: >
16880
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
903 func MyFilter(winid, key)
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
904 if a:key == "\<F2>"
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
905 " do something
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
906 return 1
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
907 endif
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
908 if a:key == 'x'
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
909 call popup_close(a:winid)
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
910 return 1
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
911 endif
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
912 return 0
17036
235cbf491430 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17026
diff changeset
913 endfunc
17946
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
914 < *popup-filter-mode*
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
915 The "filtermode" property can be used to specify in what mode the filter is
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
916 invoked. The default is "a": all modes. When using "nvi" Command-line mode
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
917 is not included, so that any command typed on the command line is not
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
918 filtered. However, to get to Command-line mode the filter must not consume
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
919 ":". Just like it must not consume "v" to allow for entering Visual mode.
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
920
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
921 *popup-mapping*
17604
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
922 Normally the key is what results after any mapping, since the keys pass on as
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
923 normal input if the filter does not use it. If the filter consumes all the
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
924 keys, set the "mapping" property to zero so that mappings do not get in the
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
925 way. This is default for |popup_menu()| and |popup_dialog()|.
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
926
17946
ec4248c4b92c patch 8.1.1969: popup window filter is used in all modes
Bram Moolenaar <Bram@vim.org>
parents: 17909
diff changeset
927 Some recommended key actions:
16880
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
928 x close the popup (see note below)
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
929 cursor keys select another entry
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
930 Tab accept current suggestion
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
931
25619
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24024
diff changeset
932 When CTRL-C is pressed the popup is closed, the filter will not be invoked.
29ec2c198c8d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24024
diff changeset
933
18623
3089b422b9dc patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents: 18615
diff changeset
934 A mouse click arrives as <LeftMouse>. The coordinates can be obtained with
18639
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18623
diff changeset
935 |getmousepos()|.
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
936
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
937 Vim provides standard filters |popup_filter_menu()| and
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
938 |popup_filter_yesno()|.
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
939
22442
73be82f278c0 patch 8.2.1769: popup filter interferes with using :normal to move the cursor
Bram Moolenaar <Bram@vim.org>
parents: 22441
diff changeset
940 Keys coming from a `:normal` command do not pass through the filter. This can
73be82f278c0 patch 8.2.1769: popup filter interferes with using :normal to move the cursor
Bram Moolenaar <Bram@vim.org>
parents: 22441
diff changeset
941 be used to move the cursor in a popup where the "cursorline" option is set: >
73be82f278c0 patch 8.2.1769: popup filter interferes with using :normal to move the cursor
Bram Moolenaar <Bram@vim.org>
parents: 22441
diff changeset
942 call win_execute(winid, 'normal! 10Gzz')
73be82f278c0 patch 8.2.1769: popup filter interferes with using :normal to move the cursor
Bram Moolenaar <Bram@vim.org>
parents: 22441
diff changeset
943 Keys coming from `feedkeys()` are passed through the filter.
73be82f278c0 patch 8.2.1769: popup filter interferes with using :normal to move the cursor
Bram Moolenaar <Bram@vim.org>
parents: 22441
diff changeset
944
16880
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
945 Note that "x" is the normal way to close a popup. You may want to use Esc,
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
946 but since many keys start with an Esc character, there may be a delay before
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
947 Vim recognizes the Esc key. If you do use Esc, it is recommended to set the
16880
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
948 'ttimeoutlen' option to 100 and set 'timeout' and/or 'ttimeout'.
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
949
22328
75ff30a78189 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 21676
diff changeset
950 *popup-filter-errors*
75ff30a78189 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 21676
diff changeset
951 If the filter function can't be called, e.g. because the name is wrong, then
75ff30a78189 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 21676
diff changeset
952 the popup is closed. If the filter causes an error then it is assumed to
75ff30a78189 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 21676
diff changeset
953 return zero. If this happens three times in a row the popup is closed. If
75ff30a78189 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 21676
diff changeset
954 the popup gives errors fewer than 10% of the calls then it won't be closed.
75ff30a78189 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 21676
diff changeset
955
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
956
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
957 POPUP CALLBACK *popup-callback*
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
958
17097
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
959 A callback that is invoked when the popup closes.
16890
5131023c5728 patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16888
diff changeset
960
5131023c5728 patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16888
diff changeset
961 The callback is invoked with two arguments: the ID of the popup window and the
5131023c5728 patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16888
diff changeset
962 result, which could be an index in the popup lines, or whatever was passed as
5131023c5728 patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16888
diff changeset
963 the second argument of `popup_close()`.
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
964
17097
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
965 If the popup is force-closed, e.g. because the cursor moved or CTRL-C was
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
966 pressed, the number -1 is passed to the callback.
16904
9138e2c60bf1 patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16896
diff changeset
967
17604
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
968 Example: >
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
969 func SelectedColor(id, result)
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
970 echo 'choice made: ' .. a:result
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
971 endfunc
506dd2efcbb2 patch 8.1.1799: cannot avoid mapping for a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17580
diff changeset
972
17162
f16cee6adf29 patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents: 17161
diff changeset
973
17216
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17196
diff changeset
974 POPUP SCROLLBAR *popup-scrollbar*
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17196
diff changeset
975
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17196
diff changeset
976 If the text does not fit in the popup a scrollbar is displayed on the right of
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17196
diff changeset
977 the window. This can be disabled by setting the "scrollbar" option to zero.
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17196
diff changeset
978 When the scrollbar is displayed mouse scroll events, while the mouse pointer
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17196
diff changeset
979 is on the popup, will cause the text to scroll up or down as you would expect.
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
980 A click in the upper half of the scrollbar will scroll the text down one line.
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
981 A click in the lower half will scroll the text up one line. However, this is
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17429
diff changeset
982 limited so that the popup does not get smaller.
17216
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17196
diff changeset
983
11f3cf51d43b patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17196
diff changeset
984
17162
f16cee6adf29 patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents: 17161
diff changeset
985 POPUP MASK *popup-mask*
f16cee6adf29 patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents: 17161
diff changeset
986
f16cee6adf29 patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents: 17161
diff changeset
987 To minimize the text that the popup covers, parts of it can be made
f16cee6adf29 patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents: 17161
diff changeset
988 transparent. This is defined by a "mask" which is a list of lists, where each
f16cee6adf29 patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents: 17161
diff changeset
989 list has four numbers:
f16cee6adf29 patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents: 17161
diff changeset
990 col start column, positive for counting from the left, 1 for
f16cee6adf29 patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents: 17161
diff changeset
991 leftmost, negative for counting from the right, -1 for
f16cee6adf29 patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents: 17161
diff changeset
992 rightmost
f16cee6adf29 patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents: 17161
diff changeset
993 endcol last column, like "col"
17429
6e756ad5ef1a patch 8.1.1713: highlighting cursor line only works with popup_menu()
Bram Moolenaar <Bram@vim.org>
parents: 17413
diff changeset
994 line start line, positive for counting from the top, 1 for top,
17162
f16cee6adf29 patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents: 17161
diff changeset
995 negative for counting from the bottom, -1 for bottom
f16cee6adf29 patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents: 17161
diff changeset
996 endline end line, like "line"
f16cee6adf29 patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents: 17161
diff changeset
997
f16cee6adf29 patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents: 17161
diff changeset
998 For example, to make the last 10 columns of the last line transparent:
f16cee6adf29 patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents: 17161
diff changeset
999 [[-10, -1, -1, -1]]
f16cee6adf29 patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents: 17161
diff changeset
1000
f16cee6adf29 patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents: 17161
diff changeset
1001 To make the four corners transparent:
f16cee6adf29 patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents: 17161
diff changeset
1002 [[1, 1, 1, 1], [-1, -1, 1, 1], [1, 1, -1, -1], [-1, -1, -1, -1]]
f16cee6adf29 patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents: 17161
diff changeset
1003
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1004 ==============================================================================
17257
cb0ca75f0c26 patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents: 17225
diff changeset
1005 4. Examples *popup-examples*
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1006
29087
f3ec3c57e070 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 29066
diff changeset
1007 These examples use |Vim9| script.
29066
f8e9d5023bf6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28379
diff changeset
1008
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
1009 *popup_dialog-example*
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1010 Prompt the user to press y/Y or n/N: >
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1011
29066
f8e9d5023bf6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28379
diff changeset
1012 popup_dialog('Continue? y/n', {
f8e9d5023bf6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28379
diff changeset
1013 filter: 'popup_filter_yesno',
f8e9d5023bf6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28379
diff changeset
1014 callback: (id, result) => {
f8e9d5023bf6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28379
diff changeset
1015 if result == 1
f8e9d5023bf6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28379
diff changeset
1016 echomsg "'y' or 'Y' was pressed"
f8e9d5023bf6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28379
diff changeset
1017 else
f8e9d5023bf6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28379
diff changeset
1018 echomsg "'y' or 'Y' was NOT pressed"
f8e9d5023bf6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28379
diff changeset
1019 endif
f8e9d5023bf6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28379
diff changeset
1020 },
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1021 padding: [2, 4, 2, 4],
29066
f8e9d5023bf6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 28379
diff changeset
1022 })
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1023 <
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
1024 *popup_menu-shortcut-example*
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
1025 Extend popup_filter_menu() with shortcut keys: >
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
1026
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1027 popup_menu(['Save', 'Cancel', 'Discard'], {
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1028 callback: (_, result) => {
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1029 echo 'dialog result is' result
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1030 },
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1031 filter: (id, key) => {
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1032 # Handle shortcuts
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1033 if key == 'S' || key == 's'
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1034 popup_close(id, 1)
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1035 elseif key == 'C' || key == 'c'
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1036 popup_close(id, 2)
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1037 elseif key == 'D' || key == 'd'
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1038 popup_close(id, 3)
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1039 else
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1040 # No shortcut, pass to generic filter
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1041 return popup_filter_menu(id, key)
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1042 endif
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1043 return true
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1044 },
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1045 })
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
1046 <
17292
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
1047 *popup_beval_example*
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
1048 Example for using a popup window for 'ballooneval': >
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
1049
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
1050 set ballooneval balloonevalterm
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
1051 set balloonexpr=BalloonExpr()
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1052 var winid: number
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1053 var last_text: string
17292
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
1054
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1055 def BalloonExpr(): string
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1056 # here you would use "v:beval_text" to lookup something interesting
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1057 var text = v:beval_text
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1058 if winid > 0 && popup_getpos(winid) != null_dict
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1059 # previous popup window still shows
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1060 if text == last_text
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1061 # still the same text, keep the existing popup
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1062 return null_string
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1063 endif
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1064 popup_close(winid)
17320
33dccaafb214 patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents: 17292
diff changeset
1065 endif
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1066
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1067 winid = popup_beval(text, {})
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1068 last_text = text
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1069 return null_string
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1070 enddef
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1071
17292
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
1072 If the text has to be obtained asynchronously return an empty string from the
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
1073 expression function and call popup_beval() once the text is available. In
17320
33dccaafb214 patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents: 17292
diff changeset
1074 this example simulated with a timer callback: >
17292
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
1075
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
1076 set ballooneval balloonevalterm
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
1077 set balloonexpr=BalloonExpr()
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1078 var winid: number
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1079 var last_text: string
17292
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
1080
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1081 def BalloonExpr(): string
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1082 var text = v:beval_text
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1083 if winid > 0 && popup_getpos(winid) != null_dict
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1084 # previous popup window still shows
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1085 if text == last_text
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1086 # still the same text, keep the existing popup
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1087 return null_string
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1088 endif
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1089 popup_close(winid)
17320
33dccaafb214 patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents: 17292
diff changeset
1090 endif
17292
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
1091
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1092 # Simulate an asynchronous lookup that takes half a second for the
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1093 # text to display.
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1094 last_text = text
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1095 timer_start(500, 'ShowPopup')
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1096 return null_string
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1097 enddef
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1098
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1099 def ShowPopup(timerid: number)
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1100 winid = popup_beval('Result: ' .. last_text, {})
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29087
diff changeset
1101 enddef
17292
8a095d343c59 patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17257
diff changeset
1102 <
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1103
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1104 vim:tw=78:ts=8:noet:ft=help:norl: