Mercurial > vim
comparison runtime/doc/popup.txt @ 17117:7ef5283ace3c v8.1.1558
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
commit https://github.com/vim/vim/commit/a730e55cc2d3045a79a340a5af1ad4a749058a32
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 16 19:05:31 2019 +0200
patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet
Problem: Popup_menu() and popup_filter_menu() are not implemented yet.
Solution: Implement the functions. Fix that centering didn't take the border
and padding into account.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 16 Jun 2019 19:15:05 +0200 |
parents | 0001d10a7661 |
children | b439e096a011 |
comparison
equal
deleted
inserted
replaced
17116:3cc7132b7a5c | 17117:7ef5283ace3c |
---|---|
87 | 87 |
88 | 88 |
89 TODO: | 89 TODO: |
90 - Why does 'nrformats' leak from the popup window buffer??? | 90 - Why does 'nrformats' leak from the popup window buffer??? |
91 - Disable commands, feedkeys(), CTRL-W, etc. in a popup window. | 91 - Disable commands, feedkeys(), CTRL-W, etc. in a popup window. |
92 Use NOT_IN_POPUP_WINDOW for more commands. | 92 Use ERROR_IF_POPUP_WINDOW for more commands. |
93 - 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 |
94 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 |
95 mouse moves, except when it moves inside the popup. | 95 mouse moves, except when it moves inside the popup. |
96 - For the "moved" property also include mouse movement? | 96 - For the "moved" property also include mouse movement? |
97 - Make redrawing more efficient and avoid flicker: | 97 - Make redrawing more efficient and avoid flicker: |
107 preview window. Ideas in issue #4544. | 107 preview window. Ideas in issue #4544. |
108 How to add highlighting? | 108 How to add highlighting? |
109 - When the lines do not fit show a scrollbar (like in the popup menu). | 109 - When the lines do not fit show a scrollbar (like in the popup menu). |
110 Use the mouse wheel for scrolling. | 110 Use the mouse wheel for scrolling. |
111 - Implement: | 111 - Implement: |
112 popup_filter_menu({id}, {key}) | |
113 popup_menu({text}, {options}) | |
114 popup_setoptions({id}, {options}) | 112 popup_setoptions({id}, {options}) |
115 hidden option | 113 hidden option |
116 tabpage option with number | 114 tabpage option with number |
117 title option | 115 title option |
118 flip option | 116 flip option |
218 < By default the dialog can be dragged, so that text below it | 216 < By default the dialog can be dragged, so that text below it |
219 can be read if needed. | 217 can be read if needed. |
220 | 218 |
221 | 219 |
222 popup_filter_menu({id}, {key}) *popup_filter_menu()* | 220 popup_filter_menu({id}, {key}) *popup_filter_menu()* |
223 {not implemented yet} | 221 Filter that can be used for a popup. These keys can be used: |
224 Filter that can be used for a popup. It handles the cursor | 222 j <Down> select item below |
225 keys to move the selected index in the popup. Space and Enter | 223 k <Up> select item above |
226 can be used to select an item. Invokes the "callback" of the | 224 <Space> <Enter> accept current selection |
227 popup menu with the index of the selected line as the second | 225 x Esc CTRL-C cancel the menu |
228 argument. | 226 Other keys are ignored. |
227 | |
228 A match is set on that line to highlight it, see | |
229 |popup_menu()|. | |
230 | |
231 When the current selection is accepted the "callback" of the | |
232 popup menu is invoked with the index of the selected line as | |
233 the second argument. The first entry has index one. | |
234 Cancelling the menu invokes the callback with -1. | |
229 | 235 |
230 | 236 |
231 popup_filter_yesno({id}, {key}) *popup_filter_yesno()* | 237 popup_filter_yesno({id}, {key}) *popup_filter_yesno()* |
232 Filter that can be used for a popup. It handles only the keys | 238 Filter that can be used for a popup. It handles only the keys |
233 'y', 'Y' and 'n' or 'N'. Invokes the "callback" of the | 239 'y', 'Y' and 'n' or 'N'. Invokes the "callback" of the |
277 If window {id} does not exist nothing happens. If window {id} | 283 If window {id} does not exist nothing happens. If window {id} |
278 exists but is not a popup window an error is given. *E993* | 284 exists but is not a popup window an error is given. *E993* |
279 | 285 |
280 | 286 |
281 popup_menu({text}, {options}) *popup_menu()* | 287 popup_menu({text}, {options}) *popup_menu()* |
282 {not implemented yet} | |
283 Show the {text} near the cursor, handle selecting one of the | 288 Show the {text} near the cursor, handle selecting one of the |
284 items with cursorkeys, and close it an item is selected with | 289 items with cursorkeys, and close it an item is selected with |
285 Space or Enter. {text} should have multiple lines to make this | 290 Space or Enter. {text} should have multiple lines to make this |
286 useful. This works like: > | 291 useful. This works like: > |
287 call popup_create({text}, { | 292 call popup_create({text}, { |
288 \ 'pos': 'center', | 293 \ 'pos': 'center', |
289 \ 'zindex': 200, | 294 \ 'zindex': 200, |
295 \ 'drag': 1, | |
290 \ 'wrap': 0, | 296 \ 'wrap': 0, |
291 \ 'border': [], | 297 \ 'border': [], |
298 \ 'padding': [], | |
292 \ 'filter': 'popup_filter_menu', | 299 \ 'filter': 'popup_filter_menu', |
293 \ }) | 300 \ }) |
294 < Use {options} to change the properties. Should at least set | 301 < The current line is highlighted with a match using |
302 PopupSelected, or |PmenuSel| if that is not defined. | |
303 | |
304 Use {options} to change the properties. Should at least set | |
295 "callback" to a function that handles the selected item. | 305 "callback" to a function that handles the selected item. |
296 | 306 |
297 | 307 |
298 popup_move({id}, {options}) *popup_move()* | 308 popup_move({id}, {options}) *popup_move()* |
299 Move popup {id} to the position specified with {options}. | 309 Move popup {id} to the position specified with {options}. |
318 \ 'border': [], | 328 \ 'border': [], |
319 \ 'padding': [0,1,0,1], | 329 \ 'padding': [0,1,0,1], |
320 \ }) | 330 \ }) |
321 < The PopupNotification highlight group is used instead of | 331 < The PopupNotification highlight group is used instead of |
322 WarningMsg if it is defined. | 332 WarningMsg if it is defined. |
323 < The position will be adjusted to avoid overlap with other | 333 |
334 The position will be adjusted to avoid overlap with other | |
324 notifications. | 335 notifications. |
325 Use {options} to change the properties. | 336 Use {options} to change the properties. |
326 | 337 |
327 | 338 |
328 popup_show({id}) *popup_show()* | 339 popup_show({id}) *popup_show()* |