comparison runtime/doc/popup.txt @ 17045:7fe328ad5573 v8.1.1522

patch 8.1.1522: poup_notification() not implemented yet commit https://github.com/vim/vim/commit/68d48f40a4da79547b53e3164b658812e154d411 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jun 12 22:42:41 2019 +0200 patch 8.1.1522: poup_notification() not implemented yet Problem: Popup_notification() not implemented yet. Solution: Implement it.
author Bram Moolenaar <Bram@vim.org>
date Wed, 12 Jun 2019 22:45:07 +0200
parents 235cbf491430
children 6400d1ad5e4b
comparison
equal deleted inserted replaced
17044:687ec0a10570 17045:7fe328ad5573
1 *popup.txt* For Vim version 8.1. Last change: 2019 Jun 10 1 *popup.txt* For Vim version 8.1. Last change: 2019 Jun 12
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
34 The default color used is "Pmenu". If you prefer something else use the 34 The default color used is "Pmenu". If you prefer something else use the
35 "highlight" argument or the 'wincolor' option, e.g.: > 35 "highlight" argument or the 'wincolor' option, e.g.: >
36 hi MyPopupColor ctermbg=lightblue guibg=lightblue 36 hi MyPopupColor ctermbg=lightblue guibg=lightblue
37 call setwinvar(winid, '&wincolor', 'MyPopupColor') 37 call setwinvar(winid, '&wincolor', 'MyPopupColor')
38 38
39 'hlsearch' and match highlighting are not displayed in a popup window. 39 'hlsearch' highlighting is not displayed in a popup window.
40 40
41 A popup window has a window-ID like other windows, but behaves differently. 41 A popup window has a window-ID like other windows, but behaves differently.
42 The size can be up to the whole Vim window and it overlaps other windows. 42 The size can be up to the whole Vim window and it overlaps other windows.
43 Popup windows can also overlap each other. 43 Popup windows can also overlap each other.
44 44
61 property. You can use empty lines to increase the height or the "minheight" 61 property. You can use empty lines to increase the height or the "minheight"
62 property. 62 property.
63 63
64 The width of the window is normally equal to the longest line in the buffer. 64 The width of the window is normally equal to the longest line in the buffer.
65 It can be limited with the "maxwidth" property. You can use spaces to 65 It can be limited with the "maxwidth" property. You can use spaces to
66 increase the width or the "minwidth" property. 66 increase the width or use the "minwidth" property.
67 67
68 By default the 'wrap' option is set, so that no text disappears. Otherwise, 68 By default the 'wrap' option is set, so that no text disappears. Otherwise,
69 if there is not enough space then the window is shifted left in order to 69 if there is not enough space then the window is shifted left in order to
70 display more text. This can be disabled with the "fixed" property. Also 70 display more text. This can be disabled with the "fixed" property. Also
71 disabled when right-aligned. 71 disabled when right-aligned.
77 window it will be placed below the cursor position. 77 window it will be placed below the cursor position.
78 78
79 When the screen scrolls up for output of an Ex command, popups move too, so 79 When the screen scrolls up for output of an Ex command, popups move too, so
80 that they will not cover the output. 80 that they will not cover the output.
81 81
82 The current cursor position is displayed even when it is under a popup window.
83 That way you can still see where it is, even though you cannot see the text
84 that it is in.
82 85
83 86
84 87
85 IMPLEMENTATION: 88 IMPLEMENTATION:
86 - buffers remain after a popup was deleted.
87 - Why does 'nrformats' leak from the popup window buffer??? 89 - Why does 'nrformats' leak from the popup window buffer???
90 - Option to set first line to display (useful for a preview window)
91 - Disable commands, feedkeys(), CTRL-W, etc. in a popup window.
92 Use NOT_IN_POPUP_WINDOW for more commands.
88 - Add 'balloonpopup': instead of showing text, let the callback open a popup 93 - Add 'balloonpopup': instead of showing text, let the callback open a popup
89 window and return the window ID. The popup will then be closed when the 94 window and return the window ID. The popup will then be closed when the
90 mouse moves, except when it moves inside the popup. 95 mouse moves, except when it moves inside the popup.
91 - For the "moved" property also include mouse movement? 96 - For the "moved" property also include mouse movement?
97 - When selecting text in the popup with modeless selection, do not select
98 outside of the popup and don't select the border or padding.
99 - Allow the user to drag the popup window when the "dragging" property is set.
92 - Make redrawing more efficient and avoid flicker: 100 - Make redrawing more efficient and avoid flicker:
93 - put popup menu also put in popup_mask? 101 - put popup menu also put in popup_mask?
94 - Disable commands, feedkeys(), CTRL-W, etc. in a popup window.
95 Use NOT_IN_POPUP_WINDOW for more commands.
96 - Invoke filter with character before mapping? 102 - Invoke filter with character before mapping?
97 - Figure out the size and position better. 103 - Figure out the size and position better.
98 if wrapping splits a double-wide character 104 if wrapping splits a double-wide character
99 if wrapping inserts indent 105 if wrapping inserts indent
106 - When drawing on top half a double-wide character, display ">" or "<" in the
107 incomplete cell.
100 - Can the buffer be re-used, to avoid using up lots of buffer numbers? 108 - Can the buffer be re-used, to avoid using up lots of buffer numbers?
101 - Implement all the unimplemented options and features. 109 - Implement all the unimplemented options and features.
102 110
103 111
104 ============================================================================== 112 ==============================================================================
105 2. Functions *popup-functions* 113 2. Functions *popup-functions*
106 114
107 THIS IS UNDER DESIGN - ANYTHING MAY STILL CHANGE 115 THIS IS UNDER DESIGN - ANYTHING MAY STILL CHANGE
108 116
109 [functions to be moved to eval.txt later, keep overview of functions here] 117 Creating a popup window:
118 |popup_create()| centered in the screen
119 |popup_atcursor()| just above the cursor position, closes when
120 the cursor moves away
121 |popup_notifiation()| show a notification for three seconds
122 |popup_dialog()| centered with padding and border
123 |popup_menu()| prompt for selecting an item from a list
124
125 Manipulating a popup window:
126 |popup_hide()| hide a popup temporarily
127 |popup_show()| show a previously hidden popup
128 |popup_move()| change the position and size of a popup
129 |popup_setoptions()| override options of a popup
130
131 Closing popup windows:
132 |popup_close()| close one popup
133 |popup_clear()| close all popups
134
135 Filter functions:
136 |popup_filter_menu()| select from a list of items
137 |popup_filter_yesno()| blocks until 'y' or 'n' is pressed
138
139 Other:
140 |popup_getoptions()| get current options for a popup
141 |popup_getpos()| get actual position and size of a popup
142
143
144 [functions to be moved to eval.txt later]
110 145
111 popup_atcursor({text}, {options}) *popup_atcursor()* 146 popup_atcursor({text}, {options}) *popup_atcursor()*
112 Show the {text} above the cursor, and close it when the cursor 147 Show the {text} above the cursor, and close it when the cursor
113 moves. This works like: > 148 moves. This works like: >
114 call popup_create({text}, { 149 call popup_create({text}, {
160 \ 'pos': 'center', 195 \ 'pos': 'center',
161 \ 'zindex': 200, 196 \ 'zindex': 200,
162 \ 'border': [], 197 \ 'border': [],
163 \ 'padding': [], 198 \ 'padding': [],
164 \}) 199 \})
165 < Use {options} to change the properties. 200 < Use {options} to change the properties. E.g. add a 'filter'
201 option with value 'popup_filter_yesno'.
166 202
167 203
168 popup_filter_menu({id}, {key}) *popup_filter_menu()* 204 popup_filter_menu({id}, {key}) *popup_filter_menu()*
169 {not implemented yet} 205 {not implemented yet}
170 Filter that can be used for a popup. It handles the cursor 206 Filter that can be used for a popup. It handles the cursor
178 {not implemented yet} 214 {not implemented yet}
179 Filter that can be used for a popup. It handles only the keys 215 Filter that can be used for a popup. It handles only the keys
180 'y', 'Y' and 'n' or 'N'. Invokes the "callback" of the 216 'y', 'Y' and 'n' or 'N'. Invokes the "callback" of the
181 popup menu with the 1 for 'y' or 'Y' and zero for 'n' or 'N' 217 popup menu with the 1 for 'y' or 'Y' and zero for 'n' or 'N'
182 as the second argument. Pressing Esc and CTRL-C works like 218 as the second argument. Pressing Esc and CTRL-C works like
183 pressing 'n'. 219 pressing 'n'. Other keys are ignored.
184 220
185 221
186 popup_getoptions({id}) *popup_getoptions()* 222 popup_getoptions({id}) *popup_getoptions()*
187 Return the {options} for popup {id} in a Dict. 223 Return the {options} for popup {id} in a Dict.
188 A zero value means the option was not set. For "zindex" the 224 A zero value means the option was not set. For "zindex" the
248 "minheight", "maxwidth" and "minwidth". 284 "minheight", "maxwidth" and "minwidth".
249 For {id} see `popup_hide()`. 285 For {id} see `popup_hide()`.
250 286
251 287
252 popup_notification({text}, {options}) *popup_notification()* 288 popup_notification({text}, {options}) *popup_notification()*
253 {not implemented yet}
254 Show the {text} for 3 seconds at the top of the Vim window. 289 Show the {text} for 3 seconds at the top of the Vim window.
255 This works like: > 290 This works like: >
256 call popup_create({text}, { 291 call popup_create({text}, {
257 \ 'line': 1, 292 \ 'line': 1,
258 \ 'col': 10, 293 \ 'col': 10,
259 \ 'time': 3000, 294 \ 'time': 3000,
260 \ 'tab': -1, 295 \ 'tab': -1,
261 \ 'zindex': 200, 296 \ 'zindex': 200,
262 \ 'highlight': 'WarningMsg', 297 \ 'highlight': 'WarningMsg',
263 \ 'border': [], 298 \ 'border': [],
299 \ 'padding': [0,1,0,1],
264 \ }) 300 \ })
265 < Use {options} to change the properties. 301 < The position will be adjusted to avoid overlap with other
302 notifications.
303 Use {options} to change the properties.
266 304
267 305
268 popup_show({id}) *popup_show()* 306 popup_show({id}) *popup_show()*
269 If {id} is a hidden popup, show it now. 307 If {id} is a hidden popup, show it now.
270 For {id} see `popup_hide()`. 308 For {id} see `popup_hide()`.