annotate runtime/doc/popup.txt @ 17149:c90fdb999393 v8.1.1574

patch 8.1.1574: tabpage option not yet implemented for popup window commit https://github.com/vim/vim/commit/a3fce62c911c204ae144b55018f6dc9295088850 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 20 02:31:49 2019 +0200 patch 8.1.1574: tabpage option not yet implemented for popup window Problem: Tabpage option not yet implemented for popup window. Solution: Implement tabpage option, also for popup_getoptions().
author Bram Moolenaar <Bram@vim.org>
date Thu, 20 Jun 2019 02:45:05 +0200
parents efc6f5e3b543
children 9ccb1ea9b2fc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17077
2546930657a9 patch 8.1.1538: cannot specify highlighting for notifications
Bram Moolenaar <Bram@vim.org>
parents: 17075
diff changeset
1 *popup.txt* For Vim version 8.1. Last change: 2019 Jun 15
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
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
7 Displaying text in 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
17036
235cbf491430 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17026
diff changeset
9 THIS IS UNDER DESIGN - ANYTHING MAY STILL CHANGE
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 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
12 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
13 3. Examples |popup-examples|
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15
16871
e5dab34ded73 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
16 {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
17
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 ==============================================================================
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 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
20
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
21 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
22 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
23 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
24
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
25 A popup window can be used for such things as:
16808
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
26 - 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
27 - 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
28 - 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
29 - 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
30
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
31 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
32 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
33
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
34 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
35 "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
36 hi MyPopupColor ctermbg=lightblue guibg=lightblue
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
37 call setwinvar(winid, '&wincolor', 'MyPopupColor')
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
38
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
39 '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
40
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
41 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
42 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
43 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
44 what goes on top of what.
16808
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
45
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
46 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
47 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
48 does not get keyboard focus. You can use functions like `setbufline()` to
16808
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
49 change the text in the buffer. There are more differences from how this
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
50 window and buffer behave compared to regular windows and buffers, see
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
51 |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
52
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
53 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
54 - 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
55 - 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
56
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
57
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
58 WINDOW POSITION AND SIZE *popup-position*
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
59
16808
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
60 The height of the window is normally equal to the number of, possibly
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
61 wrapping, lines in the buffer. It can be limited with the "maxheight"
16871
e5dab34ded73 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
62 property. You can use empty lines to increase the height or the "minheight"
e5dab34ded73 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
63 property.
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
64
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
65 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
66 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
67 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
68
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
69 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
70 if there is not enough space then the window is shifted left in order to
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
71 display more text. This can be disabled with the "fixed" property. Also
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
72 disabled when right-aligned.
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
73
16871
e5dab34ded73 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
74 Vim tries to show the popup in the location you specify. In some cases, e.g.
e5dab34ded73 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
75 when the popup would go outside of the Vim window, it will show it somewhere
e5dab34ded73 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
76 else. E.g. if you use `popup_atcursor()` the popup normally shows just above
e5dab34ded73 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
77 the current cursor position, but if the cursor is close to the top of the Vim
e5dab34ded73 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
78 window it will be placed below the cursor position.
e5dab34ded73 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
79
17036
235cbf491430 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17026
diff changeset
80 When the screen scrolls up for output of an Ex command, popups move too, so
235cbf491430 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17026
diff changeset
81 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
82
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
83 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
84 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
85 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
86
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
87
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
88
17075
dacd46fbaa90 patch 8.1.1537: using "tab" for popup window can be confusing
Bram Moolenaar <Bram@vim.org>
parents: 17051
diff changeset
89 TODO:
16880
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
90 - Why does 'nrformats' leak from the popup window buffer???
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
91 - When the lines do not fit show a scrollbar (like in the popup menu).
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
92 Use the mouse wheel for scrolling.
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
93 - Disable commands, feedkeys(), CTRL-W, etc. in a popup window.
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
94 Use ERROR_IF_POPUP_WINDOW for more commands.
17036
235cbf491430 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17026
diff changeset
95 - Add 'balloonpopup': instead of showing text, let the callback open a popup
235cbf491430 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17026
diff changeset
96 window and return the window ID. The popup will then be closed when the
235cbf491430 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17026
diff changeset
97 mouse moves, except when it moves inside the popup.
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
98 - For the "moved" property also include mouse movement?
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
99 - Can the buffer be re-used, to avoid using up lots of buffer numbers?
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
100 - Have an option to attach the popup to a text position, like text properties
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
101 do. (#4560)
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
102 - Make redrawing more efficient and avoid flicker:
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
103 - put popup menu also put in popup_mask?
16884
59e4148c0c73 patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16880
diff changeset
104 - Invoke filter with character before mapping?
16841
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16833
diff changeset
105 - Figure out the size and position better.
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16833
diff changeset
106 if wrapping splits a double-wide character
16853
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
107 if wrapping inserts indent
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
108 - When drawing on top half a double-wide character, display ">" or "<" in the
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
109 incomplete cell.
17097
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
110 - Use a popup window for the "info" item of completion instead of using a
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
111 preview window. Ideas in issue #4544.
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17097
diff changeset
112 How to add highlighting?
17075
dacd46fbaa90 patch 8.1.1537: using "tab" for popup window can be confusing
Bram Moolenaar <Bram@vim.org>
parents: 17051
diff changeset
113 - Implement:
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
114 flip option
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
115 transparent area, to minimize covering text. Define rectangles?
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
117 ==============================================================================
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118 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
119
17036
235cbf491430 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17026
diff changeset
120 THIS IS UNDER DESIGN - ANYTHING MAY STILL CHANGE
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
122 Creating a popup window:
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
123 |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
124 |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
125 the cursor 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
126 |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
127 |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
128 |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
129
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
130 Manipulating a popup window:
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
131 |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
132 |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
133 |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
134 |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
135 |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
136
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
137 Closing popup windows:
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
138 |popup_close()| close one popup
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
139 |popup_clear()| close all popups
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
140
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
141 Filter functions:
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
142 |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
143 |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
144
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
145 Other:
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
146 |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
147 |popup_getpos()| get actual 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
148
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
149
17075
dacd46fbaa90 patch 8.1.1537: using "tab" for popup window can be confusing
Bram Moolenaar <Bram@vim.org>
parents: 17051
diff changeset
150 [functions help to be moved to eval.txt later]
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
152 popup_atcursor({text}, {options}) *popup_atcursor()*
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
153 Show the {text} above the cursor, and close it when the cursor
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
154 moves. This works like: >
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
155 call popup_create({text}, {
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
156 \ 'pos': 'botleft',
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
157 \ 'line': 'cursor-1',
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
158 \ 'col': 'cursor',
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
159 \ 'moved': 'WORD',
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
160 \ })
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
161 < 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
162
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
163
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
164 *popup_clear()*
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
165 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
166 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
167
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
168
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
169 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
170 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
171 be deleted.
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
172
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
173 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
174 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
175 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
176 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
177
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
178
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
179 popup_create({text}, {options}) *popup_create()*
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
180 Open a popup window showing {text}, which is either:
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
181 - a string
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
182 - 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
183 - a list of text lines with text properties
16871
e5dab34ded73 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
184
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
185 {options} is a dictionary with many possible entries.
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
186 See |popup_create-usage| for details.
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
187
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
188 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
189 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
190 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
191 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
192 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
193 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
194 < 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
195
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
196
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
197 popup_dialog({text}, {options}) *popup_dialog()*
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
198 Just like |popup_create()| but with these default options: >
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
199 call popup_create({text}, {
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
200 \ 'pos': 'center',
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
201 \ 'zindex': 200,
17097
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
202 \ 'drag': 1,
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
203 \ 'border': [],
16890
5131023c5728 patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16888
diff changeset
204 \ 'padding': [],
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
205 \})
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
206 < 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
207 option with value 'popup_filter_yesno'. Example: >
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
208 call popup_create('do you want to quit (Yes/no)?', {
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
209 \ 'filter': 'popup_filter_yesno',
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
210 \ 'callback': 'QuitCallback',
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
211 \ })
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
212
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
213 < 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
214 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
215
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
216
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
217 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
218 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
219 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
220 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
221 <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
222 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
223 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
224
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
225 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
226 |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
227
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
228 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
229 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
230 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
231 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
232
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
233 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
234 |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
235
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
236
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
237 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
238 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
239 '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
240 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
241 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
242 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
243 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
244 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
245
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
246
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
247 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
248 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
249 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
250 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
251
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
252 The "moved" entry is a list with minimum and maximum column,
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
253 [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
254
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
255 "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
256 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
257
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
258 "borderhighlight" is not included when all values are empty.
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
259
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
260 "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
261 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
262 another tabpage.
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
263
17123
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
264 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
265
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
266
16855
19162ff4eacd patch 8.1.1429: "pos" option of popup window not supported yet
Bram Moolenaar <Bram@vim.org>
parents: 16853
diff changeset
267 popup_getpos({id}) *popup_getpos()*
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
268 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
269 with these entries:
16841
cf630fab9fb6 patch 8.1.1422: popup_getoptions() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16833
diff changeset
270 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
271 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
272 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
273 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
274 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
275 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
276 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
277 core_height height of the text box in screen cells
17036
235cbf491430 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17026
diff changeset
278 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
279 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
280 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
281 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
282
59e4148c0c73 patch 8.1.1443: popup window padding and border not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16880
diff changeset
283 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
284
16829
5cebaecad422 patch 8.1.1416: popup_getposition() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16817
diff changeset
285 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
286
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
287
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
288 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
289 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
290 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
291 hidden.
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
292 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
293 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
294
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
295
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
296 popup_menu({text}, {options}) *popup_menu()*
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
297 Show the {text} near the cursor, handle selecting one of the
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
298 items with cursorkeys, and close it an item is selected with
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
299 Space or Enter. {text} should have multiple lines to make this
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
300 useful. This works like: >
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
301 call popup_create({text}, {
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
302 \ 'pos': 'center',
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
303 \ 'zindex': 200,
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
304 \ 'drag': 1,
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
305 \ 'wrap': 0,
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
306 \ 'border': [],
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
307 \ 'padding': [],
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
308 \ 'filter': 'popup_filter_menu',
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
309 \ })
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
310 < The current line is highlighted with a match using
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
311 PopupSelected, or |PmenuSel| if that is not defined.
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
312
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
313 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
314 "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
315
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
316
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
317 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
318 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
319 {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
320 specify the popup position:
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
321 line
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
322 col
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
323 pos
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
324 maxheight
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
325 minheight
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
326 maxwidth
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
327 minwidth
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
328 fixed
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
329 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
330 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
331
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
332
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
333 popup_notification({text}, {options}) *popup_notification()*
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
334 Show the {text} for 3 seconds at the top of the Vim window.
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
335 This works like: >
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
336 call popup_create({text}, {
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
337 \ 'line': 1,
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
338 \ 'col': 10,
17077
2546930657a9 patch 8.1.1538: cannot specify highlighting for notifications
Bram Moolenaar <Bram@vim.org>
parents: 17075
diff changeset
339 \ 'minwidth': 20,
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
340 \ 'time': 3000,
17075
dacd46fbaa90 patch 8.1.1537: using "tab" for popup window can be confusing
Bram Moolenaar <Bram@vim.org>
parents: 17051
diff changeset
341 \ 'tabpage': -1,
17097
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
342 \ 'zindex': 300,
17051
221d4b82bc0b patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
343 \ 'drag': 1,
17026
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
344 \ 'highlight': 'WarningMsg',
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
345 \ 'border': [],
17045
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
346 \ '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
347 \ })
17077
2546930657a9 patch 8.1.1538: cannot specify highlighting for notifications
Bram Moolenaar <Bram@vim.org>
parents: 17075
diff changeset
348 < 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
349 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
350
7ef5283ace3c patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17107
diff changeset
351 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
352 notifications.
7fe328ad5573 patch 8.1.1522: poup_notification() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17036
diff changeset
353 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
354
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
355
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
356 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
357 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
358 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
359
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
360
905e1b154058 patch 8.1.1513: all popup functionality is in functions, except :popupclear
Bram Moolenaar <Bram@vim.org>
parents: 16944
diff changeset
361 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
362 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
363 These options can be set:
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
364 flip
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
365 firstline
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
366 title
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
367 wrap
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
368 drag
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
369 highlight
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
370 padding
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
371 border
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
372 borderhighlight
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
373 borderchars
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
374 zindex
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
375 time
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
376 moved
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
377 filter
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
378 callback
efc6f5e3b543 patch 8.1.1561: popup_setoptions() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 17119
diff changeset
379 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
380 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
381 "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
382
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
383 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
384 Set the text of the buffer in poup win {id}. {text} is the
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17097
diff changeset
385 same as supplied to |popup_create()|.
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17097
diff changeset
386 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
387 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
388
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
389
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
390 POPUP BUFFER AND WINDOW *popup-buffer*
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
391
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
392 A new buffer is created to hold the text and text properties of the popup
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
393 window. The buffer is always associated with the popup window and
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
394 manipulation is restricted:
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
395 - the buffer has no name
17036
235cbf491430 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17026
diff changeset
396 - 'buftype' is "popup"
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
397 - 'swapfile' is off
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
398 - 'bufhidden' is "hide"
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
399 - 'buflisted' is off
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
400 - 'undolevels' is -1: no undo at all
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
401 - all other buffer-local and window-local options are set to their Vim default
16853
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
402 value.
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
403
16853
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
404 It is possible to change the specifically mentioned options, but anything
e6bcccccbf7b patch 8.1.1428: popup_atcursor() not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16841
diff changeset
405 might break then, so better leave them alone.
16808
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16806
diff changeset
406
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
407 The window does have a cursor position, but the cursor is not displayed.
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
408
16833
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
409 To execute a command in the context of the popup window and buffer use
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
410 `win_execute()`. Example: >
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
411 call win_execute(winid, 'syntax enable')
6699c03347d2 patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16829
diff changeset
412
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
413 Options can be set on the window with `setwinvar()`, e.g.: >
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
414 call setwinvar(winid, '&wrap', 0)
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
415 And options can be set on the buffer with `setbufvar()`, e.g.: >
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
416 call setbufvar(winbufnr(winid), '&filetype', 'java')
16859
0154363d3b98 patch 8.1.1431: popup window listed as "Scratch"
Bram Moolenaar <Bram@vim.org>
parents: 16855
diff changeset
417 Note that this does not trigger autocommands. Use `win_execute()` if you do
0154363d3b98 patch 8.1.1431: popup window listed as "Scratch"
Bram Moolenaar <Bram@vim.org>
parents: 16855
diff changeset
418 need them.
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
419
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
420
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
421 POPUP_CREATE() ARGUMENTS *popup_create-usage*
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
422
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
423 The first argument of |popup_create()| (and the second argument 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
424 |popup_setttext()|) specifies the text to be displayed, and optionally text
0001d10a7661 patch 8.1.1553: not easy to change the text in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 17097
diff changeset
425 properties. It is in one of three forms:
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
426 - a string
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
427 - 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
428 - 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
429 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
430 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
431 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
432 |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
433 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
434 |popup-props|.
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
435
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
436 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
437 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
438 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
439 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
440 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
441 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
442 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
443 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
444 "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
445 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
446 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
447 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
448 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
449 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
450 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
451 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
452 "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
453 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
454 - "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
455 - "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
456 - 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
457 the screen, then
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
458 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
459 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
460 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
461 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
462 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
463 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
464 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
465 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
466 {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
467 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
468 padding.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
469 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
470 padding.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
471 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
472 padding.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
473 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
474 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
475 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
476 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
477 the last buffer line will at the top of the window.
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
478 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
479 `popup_show()` to unhide it.
16778
eda4d65f232c patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents: 16724
diff changeset
480 {not implemented yet}
17075
dacd46fbaa90 patch 8.1.1537: using "tab" for popup window can be confusing
Bram Moolenaar <Bram@vim.org>
parents: 17051
diff changeset
481 tabpage When -1: display the popup on all tabs.
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
482 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
483 tab page.
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
484 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
485 displayed on; when invalid the popup is not created
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
486 and an error is given. *E996*
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
487 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
488 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
489 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
490 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
491 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
492 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
493 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
494 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
495 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
496 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
497 "topleft".
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
498 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
499 the 'wincolor' option.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
500 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
501 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
502 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
503 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
504 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
505 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
506 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
507 the left.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
508 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
509 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
510 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
511 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
512 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
513 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
514 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
515 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
516 'LeftColor']
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
517 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
518 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
519 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
520 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
521 Example: ['-', '|', '-', '|', '┌', '┐', '┘', '└']
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
522 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
523 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
524 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
525 By default a double line is used all around when
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
526 'encoding' is "utf-8" and 'ambiwidth' is "single,
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
527 otherwise ASCII characters are used.
17051
221d4b82bc0b patch 8.1.1525: cannot move a popup window with the mouse
Bram Moolenaar <Bram@vim.org>
parents: 17047
diff changeset
528 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
529 1, maximum value is 32000.
16896
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
530 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
531 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
532 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
533 - "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
534 - "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
535 - "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
536 - [{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
537 {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
538 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
539 line or to another window.
17036
235cbf491430 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17026
diff changeset
540 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
541 |popup-filter|.
52fc577a087d patch 8.1.1449: popup text truncated at end of screen
Bram Moolenaar <Bram@vim.org>
parents: 16890
diff changeset
542 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
543 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
544
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
545 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
546 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
547 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
548
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
549 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
550 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
551 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
552
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
553
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
554 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
555
16811
0457d49eb2d9 patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents: 16809
diff changeset
556 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
557 - "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
558 - "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
559 - "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
560 - "transparent" is extra
0457d49eb2d9 patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents: 16809
diff changeset
561 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
562 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
563 first column.
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
564 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
565 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
566 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
567 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
568 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
569 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
570 used
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
571 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
572 |prop_type_add()|
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
573 transparent do not show these characters, show the text under it;
16871
e5dab34ded73 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16859
diff changeset
574 if there is a border character to the right or below
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
575 it will be made transparent as well
16811
0457d49eb2d9 patch 8.1.1407: popup_create() does not support text properties
Bram Moolenaar <Bram@vim.org>
parents: 16809
diff changeset
576 {not implemented yet}
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
577
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
578
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
579 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
580
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
581 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
582 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
583
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
584 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
585 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
586 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
587 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
588 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
589
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
590 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
591 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
592 func MyFilter(winid, key)
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
593 if a:key == "\<F2>"
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
594 " do something
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
595 return 1
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
596 endif
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
597 if a:key == 'x'
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
598 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
599 return 1
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
600 endif
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
601 return 0
17036
235cbf491430 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 17026
diff changeset
602 endfunc
16880
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
603
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
604 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
605
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
606 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
607 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
608 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
609 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
610
16724
6030631a1541 patch 8.1.1364: design for popup window support needs more details
Bram Moolenaar <Bram@vim.org>
parents: 16654
diff changeset
611 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
612 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
613 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
614
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
615 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
616 |popup_filter_yesno()|.
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
617
16880
998603a243d7 patch 8.1.1441: popup window filter not yet implemented
Bram Moolenaar <Bram@vim.org>
parents: 16871
diff changeset
618 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
619 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
620 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
621 '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
622
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
623
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
624 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
625
17097
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
626 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
627
5131023c5728 patch 8.1.1446: popup window callback not implemented yet
Bram Moolenaar <Bram@vim.org>
parents: 16888
diff changeset
628 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
629 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
630 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
631
17097
94007c802045 patch 8.1.1548: popup_dialog() is not implemented
Bram Moolenaar <Bram@vim.org>
parents: 17077
diff changeset
632 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
633 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
634
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
635 ==============================================================================
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
636 3. Examples *popup-examples*
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
637
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
638 TODO
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
639 *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
640 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
641
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
642 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
643 if a:result
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
644 " ... '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
645 endif
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
646 endfunc
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
647
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
648 call popup_dialog('Continue? y/n', {
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
649 \ 'filter': 'popup_filter_yesno',
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
650 \ 'callback': 'MyDialogHandler',
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
651 \ })
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
652 <
17149
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
653 *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
654 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
655
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
656 call popup_menu('Save', 'Cancel', 'Discard'], {
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
657 \ 'filter': 'MyMenuFilter',
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
658 \ 'callback': 'MyMenuHandler',
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
659 \ })
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
660
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
661 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
662 " Handle shortcuts
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
663 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
664 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
665 return 1
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
666 endif
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
667 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
668 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
669 return 1
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
670 endif
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
671 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
672 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
673 return 1
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
674 endif
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
675
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
676 " 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
677 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
678 endfunc
c90fdb999393 patch 8.1.1574: tabpage option not yet implemented for popup window
Bram Moolenaar <Bram@vim.org>
parents: 17123
diff changeset
679 <
16654
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
680
7d54a66c95d7 patch 8.1.1329: plans for popup window support are spread out
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
681 vim:tw=78:ts=8:noet:ft=help:norl: