comparison runtime/doc/popup.txt @ 17097:94007c802045 v8.1.1548

patch 8.1.1548: popup_dialog() is not implemented commit https://github.com/vim/vim/commit/a42d945efc60e6130c15f72b5a5aa9fd2b63241a Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 15 21:46:30 2019 +0200 patch 8.1.1548: popup_dialog() is not implemented Problem: Popup_dialog() is not implemented. Solution: Implement popup_dialog() and popup_filter_yesno().
author Bram Moolenaar <Bram@vim.org>
date Sat, 15 Jun 2019 22:00:06 +0200
parents 2546930657a9
children 0001d10a7661
comparison
equal deleted inserted replaced
17096:a8e6a8fbe880 17097:94007c802045
101 if wrapping splits a double-wide character 101 if wrapping splits a double-wide character
102 if wrapping inserts indent 102 if wrapping inserts indent
103 - When drawing on top half a double-wide character, display ">" or "<" in the 103 - When drawing on top half a double-wide character, display ">" or "<" in the
104 incomplete cell. 104 incomplete cell.
105 - Can the buffer be re-used, to avoid using up lots of buffer numbers? 105 - Can the buffer be re-used, to avoid using up lots of buffer numbers?
106 - Use a popup window for the "info" item of completion instead of using a
107 preview window.
106 - Implement: 108 - Implement:
107 popup_dialog({text}, {options})
108 popup_filter_menu({id}, {key}) 109 popup_filter_menu({id}, {key})
109 popup_filter_yesno({id}, {key})
110 popup_menu({text}, {options}) 110 popup_menu({text}, {options})
111 popup_setoptions({id}, {options}) 111 popup_setoptions({id}, {options})
112 flip option 112 flip option
113 hidden option 113 hidden option
114 tabpage option with number 114 tabpage option with number
194 call setbufline(bufnr, 2, 'second line') 194 call setbufline(bufnr, 2, 'second line')
195 < In case of failure zero is returned. 195 < In case of failure zero is returned.
196 196
197 197
198 popup_dialog({text}, {options}) *popup_dialog()* 198 popup_dialog({text}, {options}) *popup_dialog()*
199 {not implemented yet}
200 Just like |popup_create()| but with these default options: > 199 Just like |popup_create()| but with these default options: >
201 call popup_create({text}, { 200 call popup_create({text}, {
202 \ 'pos': 'center', 201 \ 'pos': 'center',
203 \ 'zindex': 200, 202 \ 'zindex': 200,
203 \ 'drag': 1,
204 \ 'border': [], 204 \ 'border': [],
205 \ 'padding': [], 205 \ 'padding': [],
206 \}) 206 \})
207 < Use {options} to change the properties. E.g. add a 'filter' 207 < Use {options} to change the properties. E.g. add a 'filter'
208 option with value 'popup_filter_yesno'. 208 option with value 'popup_filter_yesno'. Example: >
209 call popup_create('do you want to quit (Yes/no)?', {
210 \ 'filter': 'popup_filter_yesno',
211 \ 'callback': 'QuitCallback',
212 \ })
213
214 < By default the dialog can be dragged, so that text below it
215 can be read if needed.
209 216
210 217
211 popup_filter_menu({id}, {key}) *popup_filter_menu()* 218 popup_filter_menu({id}, {key}) *popup_filter_menu()*
212 {not implemented yet} 219 {not implemented yet}
213 Filter that can be used for a popup. It handles the cursor 220 Filter that can be used for a popup. It handles the cursor
216 popup menu with the index of the selected line as the second 223 popup menu with the index of the selected line as the second
217 argument. 224 argument.
218 225
219 226
220 popup_filter_yesno({id}, {key}) *popup_filter_yesno()* 227 popup_filter_yesno({id}, {key}) *popup_filter_yesno()*
221 {not implemented yet}
222 Filter that can be used for a popup. It handles only the keys 228 Filter that can be used for a popup. It handles only the keys
223 'y', 'Y' and 'n' or 'N'. Invokes the "callback" of the 229 'y', 'Y' and 'n' or 'N'. Invokes the "callback" of the
224 popup menu with the 1 for 'y' or 'Y' and zero for 'n' or 'N' 230 popup menu with the 1 for 'y' or 'Y' and zero for 'n' or 'N'
225 as the second argument. Pressing Esc and CTRL-C works like 231 as the second argument. Pressing Esc and 'x' works like
226 pressing 'n'. Other keys are ignored. 232 pressing 'n'. CTRL-C invokes the callback with -1. Other
233 keys are ignored.
227 234
228 235
229 popup_getoptions({id}) *popup_getoptions()* 236 popup_getoptions({id}) *popup_getoptions()*
230 Return the {options} for popup {id} in a Dict. 237 Return the {options} for popup {id} in a Dict.
231 A zero value means the option was not set. For "zindex" the 238 A zero value means the option was not set. For "zindex" the
299 \ 'line': 1, 306 \ 'line': 1,
300 \ 'col': 10, 307 \ 'col': 10,
301 \ 'minwidth': 20, 308 \ 'minwidth': 20,
302 \ 'time': 3000, 309 \ 'time': 3000,
303 \ 'tabpage': -1, 310 \ 'tabpage': -1,
304 \ 'zindex': 200, 311 \ 'zindex': 300,
305 \ 'drag': 1, 312 \ 'drag': 1,
306 \ 'highlight': 'WarningMsg', 313 \ 'highlight': 'WarningMsg',
307 \ 'border': [], 314 \ 'border': [],
308 \ 'padding': [0,1,0,1], 315 \ 'padding': [0,1,0,1],
309 \ }) 316 \ })
519 In case it returns FALSE and there is another popup window visible, that 526 In case it returns FALSE and there is another popup window visible, that
520 filter is also called. The filter of the popup window with the highest zindex 527 filter is also called. The filter of the popup window with the highest zindex
521 is called first. 528 is called first.
522 529
523 The filter function is called with two arguments: the ID of the popup and the 530 The filter function is called with two arguments: the ID of the popup and the
524 key, e.g.: > 531 key as a string, e.g.: >
525 func MyFilter(winid, key) 532 func MyFilter(winid, key)
526 if a:key == "\<F2>" 533 if a:key == "\<F2>"
527 " do something 534 " do something
528 return 1 535 return 1
529 endif 536 endif
554 'ttimeoutlen' option to 100 and set 'timeout' and/or 'ttimeout'. 561 'ttimeoutlen' option to 100 and set 'timeout' and/or 'ttimeout'.
555 562
556 563
557 POPUP CALLBACK *popup-callback* 564 POPUP CALLBACK *popup-callback*
558 565
559 A callback that is invoked when the popup closes. Used by 566 A callback that is invoked when the popup closes.
560 |popup_filter_menu()|.
561 567
562 The callback is invoked with two arguments: the ID of the popup window and the 568 The callback is invoked with two arguments: the ID of the popup window and the
563 result, which could be an index in the popup lines, or whatever was passed as 569 result, which could be an index in the popup lines, or whatever was passed as
564 the second argument of `popup_close()`. 570 the second argument of `popup_close()`.
565 571
566 If the popup is closed because the cursor moved, the number -1 is passed to 572 If the popup is force-closed, e.g. because the cursor moved or CTRL-C was
567 the callback. 573 pressed, the number -1 is passed to the callback.
568 574
569 ============================================================================== 575 ==============================================================================
570 3. Examples *popup-examples* 576 3. Examples *popup-examples*
571 577
572 TODO 578 TODO