Mercurial > vim
annotate runtime/doc/popup.txt @ 17417:aa4532c1d001 v8.1.1707
patch 8.1.1707: Coverity warns for possibly using a NULL pointer
commit https://github.com/vim/vim/commit/cfdbc5adde49cbab939e8164555ed0b8d9ce000b
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jul 17 21:27:52 2019 +0200
patch 8.1.1707: Coverity warns for possibly using a NULL pointer
Problem: Coverity warns for possibly using a NULL pointer.
Solution: Change the logic to make sure no NULL pointer is used.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 17 Jul 2019 21:30:04 +0200 |
parents | 40417757dffd |
children | 6e756ad5ef1a |
rev | line source |
---|---|
17383
b18fd36fdf46
patch 8.1.1690: default padding for popup window menu is too much
Bram Moolenaar <Bram@vim.org>
parents:
17372
diff
changeset
|
1 *popup.txt* For Vim version 8.1. Last change: 2019 Jul 14 |
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 |
17257
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
7 Displaying text in a floating window. *popup* *popup-window* |
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| |
16654
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 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
|
15 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
|
16 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
|
17 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
|
18 Popup text properties |popup-props| |
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
19 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
|
20 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
|
21 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
|
22 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
|
23 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
|
24 |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 |
16871 | 26 {not available if the |+textprop| 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
|
27 |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 ============================================================================== |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 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
|
30 |
16724
6030631a1541
patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents:
16654
diff
changeset
|
31 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
|
32 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
|
33 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
|
34 |
6030631a1541
patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents:
16654
diff
changeset
|
35 A popup window can be used for such things as: |
16808 | 36 - 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
|
37 - 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
|
38 - 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
|
39 - 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
|
40 |
6030631a1541
patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents:
16654
diff
changeset
|
41 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
|
42 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
|
43 |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16724
diff
changeset
|
44 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
|
45 "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
|
46 hi MyPopupColor ctermbg=lightblue guibg=lightblue |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16724
diff
changeset
|
47 call setwinvar(winid, '&wincolor', 'MyPopupColor') |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16724
diff
changeset
|
48 |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17036
diff
changeset
|
49 '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
|
50 |
16724
6030631a1541
patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents:
16654
diff
changeset
|
51 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
|
52 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
|
53 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
|
54 what goes on top of what. |
16808 | 55 |
56 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
|
57 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
|
58 does not get keyboard focus. You can use functions like `setbufline()` to |
16808 | 59 change the text in the buffer. There are more differences from how this |
60 window and buffer behave compared to regular windows and buffers, see | |
61 |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
|
62 |
6030631a1541
patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents:
16654
diff
changeset
|
63 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
|
64 - 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
|
65 - 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
|
66 |
16724
6030631a1541
patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents:
16654
diff
changeset
|
67 |
17257
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
68 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
|
69 |
16808 | 70 The height of the window is normally equal to the number of, possibly |
71 wrapping, lines in the buffer. It can be limited with the "maxheight" | |
16871 | 72 property. You can use empty lines to increase the height or the "minheight" |
73 property. | |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16724
diff
changeset
|
74 |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16724
diff
changeset
|
75 The width of the window is normally equal to the longest line in the buffer. |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16724
diff
changeset
|
76 It can be limited with the "maxwidth" property. You can use spaces to |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17036
diff
changeset
|
77 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
|
78 |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
79 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
|
80 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
|
81 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
|
82 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
|
83 |
16871 | 84 Vim tries to show the popup in the location you specify. In some cases, e.g. |
85 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
|
86 nearby. E.g. if you use `popup_atcursor()` the popup normally shows just above |
16871 | 87 the current cursor position, but if the cursor is close to the top of the Vim |
88 window it will be placed below the cursor position. | |
89 | |
17036 | 90 When the screen scrolls up for output of an Ex command, popups move too, so |
91 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
|
92 |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17036
diff
changeset
|
93 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
|
94 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
|
95 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
|
96 |
16724
6030631a1541
patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents:
16654
diff
changeset
|
97 |
17257
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
98 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
|
99 |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
100 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
|
101 it. If somehow a popup hangs around, you can close all of them with: > |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
102 call popup_clear() |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
103 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
|
104 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
|
105 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
|
106 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
|
107 "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
|
108 |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
109 |
17257
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
110 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
|
111 |
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
112 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
|
113 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
|
114 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
|
115 - 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
|
116 - '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
|
117 - '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
|
118 - '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
|
119 - '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
|
120 - '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
|
121 - 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
|
122 value. |
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
123 |
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
124 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
|
125 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
|
126 |
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
127 The window does have a cursor position, but the cursor is not displayed. |
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
128 |
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
129 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
|
130 `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
|
131 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
|
132 |
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
133 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
|
134 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
|
135 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
|
136 call setbufvar(winbufnr(winid), '&filetype', 'java') |
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
137 Note that this does not trigger autocommands. Use `win_execute()` if you do |
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
138 need them. |
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
139 |
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
140 |
16654
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
141 |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
142 ============================================================================== |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
143 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
|
144 |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17036
diff
changeset
|
145 Creating a popup window: |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17036
diff
changeset
|
146 |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
|
147 |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
|
148 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
|
149 |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
|
150 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
|
151 |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
|
152 |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
|
153 |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
|
154 |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17036
diff
changeset
|
155 Manipulating a popup window: |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17036
diff
changeset
|
156 |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
|
157 |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
|
158 |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
|
159 |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
|
160 |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
|
161 |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17036
diff
changeset
|
162 Closing popup windows: |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17036
diff
changeset
|
163 |popup_close()| close one popup |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17036
diff
changeset
|
164 |popup_clear()| close all popups |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17036
diff
changeset
|
165 |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17036
diff
changeset
|
166 Filter functions: |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17036
diff
changeset
|
167 |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
|
168 |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
|
169 |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17036
diff
changeset
|
170 Other: |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17036
diff
changeset
|
171 |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
|
172 |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
|
173 |popup_locate()| find popup window at a screen position |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17036
diff
changeset
|
174 |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17036
diff
changeset
|
175 |
17257
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
176 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
|
177 |
17257
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
178 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
|
179 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
|
180 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
|
181 call popup_create({what}, #{ |
17372 | 182 \ pos: 'botleft', |
183 \ line: 'cursor-1', | |
184 \ col: 'cursor', | |
185 \ 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
|
186 \ }) |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
187 < Use {options} to change the properties. |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
188 |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
189 |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
190 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
|
191 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
|
192 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
|
193 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
|
194 call popup_create({what}, #{ |
17372 | 195 \ pos: 'botleft', |
196 \ line: pos.row - 1, | |
197 \ col: pos.col, | |
198 \ 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
|
199 \ }) |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
200 < Use {options} to change the properties. |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
201 See |popup_beval_example| for an example use. |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
202 |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
203 |
17026
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
204 *popup_clear()* |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
205 popup_clear() 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
|
206 windows for the current tab and global popups. |
17026
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
207 |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
208 |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
209 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
|
210 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
|
211 be deleted. |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
212 |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
213 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
|
214 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
|
215 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
|
216 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
|
217 |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
218 |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
219 popup_create({what}, {options}) *popup_create()* |
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
220 Open a popup window showing {what}, which is either: |
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
221 - 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
|
222 - a string |
6030631a1541
patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents:
16654
diff
changeset
|
223 - 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
|
224 - 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
|
225 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
|
226 '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
|
227 the popup closes. |
16871 | 228 |
16654
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
229 {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
|
230 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
|
231 |
16724
6030631a1541
patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents:
16654
diff
changeset
|
232 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
|
233 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
|
234 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
|
235 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
|
236 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
|
237 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
|
238 < 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
|
239 |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16724
diff
changeset
|
240 |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
241 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
|
242 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
|
243 call popup_create({what}, #{ |
17372 | 244 \ pos: 'center', |
245 \ zindex: 200, | |
246 \ drag: 1, | |
247 \ border: [], | |
248 \ padding: [], | |
16724
6030631a1541
patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents:
16654
diff
changeset
|
249 \}) |
17045
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17036
diff
changeset
|
250 < 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
|
251 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
|
252 call popup_create('do you want to quit (Yes/no)?', #{ |
17372 | 253 \ filter: 'popup_filter_yesno', |
254 \ callback: 'QuitCallback', | |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
255 \ }) |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
256 |
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
257 < 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
|
258 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
|
259 |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
260 |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
261 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
|
262 Filter that can be used for a popup. These keys can be used: |
17149
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
263 j <Down> select item below |
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
|
264 k <Up> select item above |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17107
diff
changeset
|
265 <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
|
266 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
|
267 Other keys are ignored. |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17107
diff
changeset
|
268 |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17107
diff
changeset
|
269 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
|
270 |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
|
271 |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17107
diff
changeset
|
272 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
|
273 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
|
274 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
|
275 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
|
276 |
17149
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
277 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
|
278 |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
|
279 |
16654
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
280 |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
281 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
|
282 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
|
283 '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
|
284 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
|
285 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
|
286 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
|
287 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
|
288 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
|
289 |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
290 |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
291 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
|
292 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
|
293 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
|
294 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
|
295 |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
296 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
|
297 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
|
298 |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
299 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
|
300 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
|
301 |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
302 "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
|
303 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
|
304 |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
305 "borderhighlight" is not included when all values are empty. |
17216
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17196
diff
changeset
|
306 "scrollbarhighlight" and "thumbhighlight" are onlu included |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17196
diff
changeset
|
307 when set. |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
308 |
17149
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
309 "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
|
310 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
|
311 another tabpage. |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
312 |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
313 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
|
314 |
17026
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
315 |
16855
19162ff4eacd
patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents:
16853
diff
changeset
|
316 popup_getpos({id}) *popup_getpos()* |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16724
diff
changeset
|
317 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
|
318 with these entries: |
16841
cf630fab9fb6
patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16833
diff
changeset
|
319 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
|
320 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
|
321 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
|
322 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
|
323 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
|
324 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
|
325 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
|
326 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
|
327 firstline line of the buffer at top (1 unless scrolled) |
983950357c40
patch 8.1.1597: cannot scroll a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17180
diff
changeset
|
328 scrollbar non-zero if a scrollbar is displayed |
17036 | 329 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
|
330 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
|
331 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
|
332 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
|
333 |
59e4148c0c73
patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
334 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
|
335 |
16829
5cebaecad422
patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
336 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
|
337 |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
338 |
17026
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
339 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
|
340 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
|
341 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
|
342 hidden. |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
343 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
|
344 exists but is not a popup window an error is given. *E993* |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
345 |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
346 |
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
|
347 popup_locate({row}, {col}) *popup_locate()* |
d82b0cfb1e82
patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents:
17320
diff
changeset
|
348 Return the |window-ID| of the popup at screen positoin {row} |
d82b0cfb1e82
patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents:
17320
diff
changeset
|
349 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
|
350 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
|
351 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
|
352 |
d82b0cfb1e82
patch 8.1.1673: cannot easily find the popup window at a certain position
Bram Moolenaar <Bram@vim.org>
parents:
17320
diff
changeset
|
353 |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
354 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
|
355 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
|
356 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
|
357 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
|
358 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
|
359 call popup_create({what}, #{ |
17372 | 360 \ pos: 'center', |
361 \ zindex: 200, | |
362 \ drag: 1, | |
363 \ wrap: 0, | |
364 \ border: [], | |
17383
b18fd36fdf46
patch 8.1.1690: default padding for popup window menu is too much
Bram Moolenaar <Bram@vim.org>
parents:
17372
diff
changeset
|
365 \ padding: [0,1,0,1], |
17372 | 366 \ filter: 'popup_filter_menu', |
17026
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
367 \ }) |
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
|
368 < The current line is highlighted with a match using |
17161 | 369 "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
|
370 |
7ef5283ace3c
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17107
diff
changeset
|
371 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
|
372 "callback" to a function that handles the selected item. |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
373 |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
374 |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
375 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
|
376 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
|
377 {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
|
378 specify the popup position: |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
379 line |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
380 col |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
381 pos |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
382 maxheight |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
383 minheight |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
384 maxwidth |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
385 minwidth |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
386 fixed |
17026
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
387 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
|
388 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
|
389 |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
390 |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
391 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
|
392 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
|
393 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
|
394 call popup_create({what}, #{ |
17372 | 395 \ line: 1, |
396 \ col: 10, | |
397 \ minwidth: 20, | |
398 \ time: 3000, | |
399 \ tabpage: -1, | |
400 \ zindex: 300, | |
401 \ drag: 1, | |
402 \ highlight: 'WarningMsg', | |
403 \ border: [], | |
404 \ close: 'click', | |
405 \ 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
|
406 \ }) |
17077
2546930657a9
patch 8.1.1538: cannot specify highlighting for notifications
Bram Moolenaar <Bram@vim.org>
parents:
17075
diff
changeset
|
407 < 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
|
408 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
|
409 |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
410 Without the |+timers| feature the poup will not disappear |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
411 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
|
412 |
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
|
413 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
|
414 notifications. |
7fe328ad5573
patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17036
diff
changeset
|
415 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
|
416 |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
417 |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
418 popup_show({id}) *popup_show()* |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
419 If {id} is a hidden popup, show it now. |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
420 For {id} see `popup_hide()`. |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
421 |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
422 |
905e1b154058
patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents:
16944
diff
changeset
|
423 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
|
424 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
|
425 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
|
426 border |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
427 borderchars |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
428 borderhighlight |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
429 callback |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
430 close |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
431 drag |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
432 filter |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
433 firstline |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
434 flip |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
435 highlight |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
436 mask |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
437 moved |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
438 padding |
17180
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
439 scrollbar |
17216
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17196
diff
changeset
|
440 scrollbarhighlight |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17196
diff
changeset
|
441 thumbhighlight |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
442 time |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
443 title |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
444 wrap |
17123
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
445 zindex |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
446 The options from |popup_move()| can also be used. |
efc6f5e3b543
patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
17119
diff
changeset
|
447 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
|
448 "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
|
449 |
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
|
450 popup_settext({id}, {text}) *popup_settext()* |
0001d10a7661
patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17097
diff
changeset
|
451 Set the text of the buffer in poup 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
|
452 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
|
453 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
|
454 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
|
455 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
|
456 |
16724
6030631a1541
patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents:
16654
diff
changeset
|
457 |
17257
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
458 ============================================================================== |
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
459 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
|
460 |
17257
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
461 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
|
462 |
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
|
463 The first argument of |popup_create()| (and the second argument to |
17161 | 464 |popup_settext()|) specifies the text to be displayed, and optionally text |
17225
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
465 properties. It is in one of four forms: |
09fa437d33d8
patch 8.1.1612: cannot show an existing buffer in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17219
diff
changeset
|
466 - 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
|
467 - a string |
6030631a1541
patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents:
16654
diff
changeset
|
468 - 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
|
469 - 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
|
470 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
|
471 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
|
472 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
|
473 |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
|
474 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
|
475 |popup-props|. |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
476 |
16724
6030631a1541
patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents:
16654
diff
changeset
|
477 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
|
478 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
|
479 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
|
480 the line of the cursor and add or subtract a number of |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
481 lines. If omitted the popup is vertically centered. |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
482 The first line is 1. |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
483 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
|
484 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
|
485 "cursor+9" or "cursor-9" to add or subtract a number |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
486 of columns. If omitted the popup is horizontally |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
487 centered. The first column is 1. |
16654
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
488 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
|
489 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
|
490 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
|
491 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
|
492 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
|
493 "line" and "col" are ignored. |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
494 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
|
495 - "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
|
496 - "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
|
497 - 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
|
498 the screen, then |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
499 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
|
500 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
|
501 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
|
502 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
|
503 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
|
504 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
|
505 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
|
506 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
|
507 {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
|
508 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
|
509 padding. |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
510 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
|
511 padding. |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
512 maxwidth Maximum width 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
|
513 padding. |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
514 minwidth Minimum width 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
|
515 padding. |
17047
6400d1ad5e4b
patch 8.1.1523: cannot show range of buffer lines in popup window
Bram Moolenaar <Bram@vim.org>
parents:
17045
diff
changeset
|
516 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
|
517 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
|
518 the last buffer line will at the top of the window. |
17180
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
519 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
|
520 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
|
521 `popup_show()` to unhide it. |
17161 | 522 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
|
523 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
|
524 tab page. |
16896
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
525 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
|
526 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
|
527 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
|
528 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
|
529 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
|
530 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
|
531 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
|
532 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
|
533 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
|
534 drag TRUE to allow the popup to be dragged with the mouse |
221d4b82bc0b
patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
17047
diff
changeset
|
535 by grabbing at 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
|
536 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
|
537 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
|
538 "topleft". |
17219
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
539 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
|
540 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
|
541 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
|
542 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
|
543 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
|
544 it. |
5169811b3044
patch 8.1.1609: the user cannot easily close a popup window
Bram Moolenaar <Bram@vim.org>
parents:
17216
diff
changeset
|
545 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
|
546 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
|
547 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
|
548 the 'wincolor' option. |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
549 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
|
550 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
|
551 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
|
552 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
|
553 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
|
554 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
|
555 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
|
556 the left. |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
557 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
|
558 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
|
559 Only values of zero and non-zero are recognized. |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
560 An empty list uses a border all around. |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
561 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
|
562 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
|
563 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
|
564 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
|
565 'LeftColor'] |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
566 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
|
567 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
|
568 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
|
569 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
|
570 Example: ['-', '|', '-', '|', '┌', '┐', '┘', '└'] |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
571 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
|
572 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
|
573 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
|
574 By default a double line is used all around when |
17161 | 575 '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
|
576 otherwise ASCII characters are used. |
17180
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
577 scrollbar non-zero: show a scrollbar when the text doesn't fit. |
8581779aa16f
patch 8.1.1589: popup window does not indicate scroll position
Bram Moolenaar <Bram@vim.org>
parents:
17174
diff
changeset
|
578 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
|
579 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
|
580 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
|
581 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
|
582 PmenuSbar is used. |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17196
diff
changeset
|
583 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
|
584 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
|
585 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
|
586 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
|
587 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
|
588 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
|
589 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
|
590 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
|
591 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
|
592 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
|
593 - "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
|
594 - "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
|
595 - "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
|
596 - "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
|
597 - [{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
|
598 {start} or after {end} |
9138e2c60bf1
patch 8.1.1453: popup window "moved" property not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16896
diff
changeset
|
599 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
|
600 line or to another window. |
17036 | 601 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
|
602 |popup-filter|. |
52fc577a087d
patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
603 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
|
604 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
|
605 |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
606 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
|
607 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
|
608 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
|
609 |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
610 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
|
611 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
|
612 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
|
613 |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
614 |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
615 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
|
616 |
16811
0457d49eb2d9
patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents:
16809
diff
changeset
|
617 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
|
618 - "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
|
619 - "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
|
620 - "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
|
621 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
|
622 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
|
623 first column. |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
624 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
|
625 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
|
626 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
|
627 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
|
628 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
|
629 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
|
630 used |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
631 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
|
632 |prop_type_add()| |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
633 |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
634 |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
635 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
|
636 |
16724
6030631a1541
patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents:
16654
diff
changeset
|
637 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
|
638 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
|
639 |
6030631a1541
patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents:
16654
diff
changeset
|
640 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
|
641 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
|
642 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
|
643 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
|
644 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
|
645 |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
646 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
|
647 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
|
648 func MyFilter(winid, key) |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
649 if a:key == "\<F2>" |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
650 " do something |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
651 return 1 |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
652 endif |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
653 if a:key == 'x' |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
654 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
|
655 return 1 |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
656 endif |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
657 return 0 |
17036 | 658 endfunc |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
659 |
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
660 Currently the key is what results after any mapping. This may change... |
16654
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
661 |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
662 Some common key actions: |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
663 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
|
664 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
|
665 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
|
666 |
16724
6030631a1541
patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents:
16654
diff
changeset
|
667 A mouse click arrives as <LeftMouse>. The coordinates are in |
6030631a1541
patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents:
16654
diff
changeset
|
668 v:mouse_popup_col and v:mouse_popup_row. The top-left screen cell of the |
6030631a1541
patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents:
16654
diff
changeset
|
669 popup is col 1, row 1 (not counting the border). |
6030631a1541
patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents:
16654
diff
changeset
|
670 |
16654
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
671 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
|
672 |popup_filter_yesno()|. |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
673 |
16880
998603a243d7
patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents:
16871
diff
changeset
|
674 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
|
675 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
|
676 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
|
677 '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
|
678 |
16654
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
679 |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
680 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
|
681 |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
682 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
|
683 |
5131023c5728
patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16888
diff
changeset
|
684 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
|
685 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
|
686 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
|
687 |
17097
94007c802045
patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents:
17077
diff
changeset
|
688 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
|
689 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
|
690 |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17161
diff
changeset
|
691 |
17216
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17196
diff
changeset
|
692 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
|
693 |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17196
diff
changeset
|
694 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
|
695 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
|
696 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
|
697 is on the popup, will cause the text to scroll up or down as you would expect. |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17196
diff
changeset
|
698 A click in the upper halve of the scrollbar will scroll the text one line |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17196
diff
changeset
|
699 down. A click in the lower halve wil scroll the text one line up. However, |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17196
diff
changeset
|
700 this is limited so that the popup does not get smaller. |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17196
diff
changeset
|
701 |
11f3cf51d43b
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17196
diff
changeset
|
702 |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17161
diff
changeset
|
703 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
|
704 |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17161
diff
changeset
|
705 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
|
706 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
|
707 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
|
708 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
|
709 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
|
710 rightmost |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17161
diff
changeset
|
711 endcol last column, like "col" |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17161
diff
changeset
|
712 line start line, positive for conting from the top, 1 for top, |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17161
diff
changeset
|
713 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
|
714 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
|
715 |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17161
diff
changeset
|
716 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
|
717 [[-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
|
718 |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17161
diff
changeset
|
719 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
|
720 [[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
|
721 |
16654
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
722 ============================================================================== |
17257
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
723 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
|
724 |
17257
cb0ca75f0c26
patch 8.1.1628: popup window functions not in list of functions
Bram Moolenaar <Bram@vim.org>
parents:
17225
diff
changeset
|
725 TODO: more interesting examples |
17149
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
726 *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
|
727 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
|
728 |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
729 func MyDialogHandler(id, result) |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
730 if a:result |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
731 " ... 'y' or 'Y' was pressed |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
732 endif |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
733 endfunc |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
734 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
735 call popup_dialog('Continue? y/n', #{ |
17372 | 736 \ filter: 'popup_filter_yesno', |
737 \ callback: 'MyDialogHandler', | |
16654
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
738 \ }) |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
739 < |
17149
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
740 *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
|
741 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
|
742 |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
743 call popup_menu(['Save', 'Cancel', 'Discard'], #{ |
17372 | 744 \ filter: 'MyMenuFilter', |
745 \ callback: 'MyMenuHandler', | |
17149
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
746 \ }) |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
747 |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
748 func MyMenuFilter(id, key) |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
749 " Handle shortcuts |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
750 if a:key == 'S' |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
751 call popup_close(a:id, 1) |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
752 return 1 |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
753 endif |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
754 if a:key == 'C' |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
755 call popup_close(a:id, 2) |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
756 return 1 |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
757 endif |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
758 if a:key == 'D' |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
759 call popup_close(a:id, 3) |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
760 return 1 |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
761 endif |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
762 |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
763 " No shortcut, pass to generic filter |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
764 return popup_filter_menu(a:id, a:key) |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
765 endfunc |
c90fdb999393
patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
766 < |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
767 *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
|
768 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
|
769 |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
770 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
|
771 set balloonexpr=BalloonExpr() |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
772 let s:winid = 0 |
17320
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
773 let s:last_text = '' |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
774 |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
775 func BalloonExpr() |
17320
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
776 if s:winid && popup_getpos(s:winid) != {} |
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
777 " previous popup window still shows |
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
778 if v:beval_text == s:last_text |
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
779 " Still the same text, keep the existing popup |
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
780 return '' |
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
781 endif |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
782 call popup_close(s:winid) |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
783 endif |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
784 let s:winid = popup_beval(v:beval_text, #{mousemoved: 'word'}) |
17320
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
785 let s:last_text = v:beval_text |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
786 return '' |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
787 endfunc |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
788 < |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
789 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
|
790 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
|
791 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
|
792 |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
793 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
|
794 set balloonexpr=BalloonExpr() |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
795 let s:winid = 0 |
17320
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
796 let s:balloonText = '' |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
797 |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
798 func BalloonExpr() |
17320
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
799 if s:winid && popup_getpos(s:winid) != {} |
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
800 " previous popup window still shows |
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
801 if v:beval_text == s:balloonText |
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
802 " Still the same text, keep the existing popup |
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
803 return '' |
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
804 endif |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
805 call popup_close(s:winid) |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
806 let s:winid = 0 |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
807 endif |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
808 " simulate an asynchronous loopup for the text to display |
17320
33dccaafb214
patch 8.1.1659: popup window "mousemoved" values not correct
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
809 let s:balloonText = v:beval_text |
17292
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
810 call timer_start(100, 'ShowPopup') |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
811 return '' |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
812 endfunc |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
813 |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
814 func ShowPopup(id) |
17413
40417757dffd
patch 8.1.1705: using ~{} for a literal dict is not nice
Bram Moolenaar <Bram@vim.org>
parents:
17387
diff
changeset
|
815 let s:winid = popup_beval(s:balloonText, #{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
|
816 endfunc |
8a095d343c59
patch 8.1.1645: cannot use a popup window for a balloon
Bram Moolenaar <Bram@vim.org>
parents:
17257
diff
changeset
|
817 < |
16654
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
818 |
7d54a66c95d7
patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
819 vim:tw=78:ts=8:noet:ft=help:norl: |