comparison runtime/doc/popup.txt @ 16890:5131023c5728 v8.1.1446

patch 8.1.1446: popup window callback not implemented yet commit https://github.com/vim/vim/commit/9eaac896501bcd6abdd430a90293eae8101df24a Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 1 22:49:29 2019 +0200 patch 8.1.1446: popup window callback not implemented yet Problem: Popup window callback not implemented yet. Solution: Implement the callback.
author Bram Moolenaar <Bram@vim.org>
date Sat, 01 Jun 2019 23:00:06 +0200
parents ec61b6b79865
children 52fc577a087d
comparison
equal deleted inserted replaced
16889:b6d0ad5822b1 16890:5131023c5728
88 Probably 2. is the best choice. 88 Probably 2. is the best choice.
89 89
90 90
91 IMPLEMENTATION: 91 IMPLEMENTATION:
92 - Code is in popupwin.c 92 - Code is in popupwin.c
93 - Fix positioning with border and padding.
93 - Why does 'nrformats' leak from the popup window buffer??? 94 - Why does 'nrformats' leak from the popup window buffer???
94 - Make redrawing more efficient and avoid flicker. 95 - Make redrawing more efficient and avoid flicker.
95 Store popup info in a mask, use the mask in screen_line() 96 Store popup info in a mask, use the mask in screen_line()
96 Keep mask until next update_screen(), find differences and redraw affected 97 Keep mask until next update_screen(), find differences and redraw affected
97 windows/lines 98 windows/lines
131 let bufnr = winbufnr(winid) 132 let bufnr = winbufnr(winid)
132 call setbufline(bufnr, 2, 'second line') 133 call setbufline(bufnr, 2, 'second line')
133 < In case of failure zero is returned. 134 < In case of failure zero is returned.
134 135
135 136
136 popup_close({id}) *popup_close()* 137 popup_close({id} [, {result}]) *popup_close()*
137 Close popup {id}. The window and the associated buffer will 138 Close popup {id}. The window and the associated buffer will
138 be deleted. 139 be deleted.
140
141 If the popup has a callback it will be called just before the
142 popup window is deleted. If the optional {result} is present
143 it will be passed as the second argument of the callback.
144 Otherwise zero is passed to the callback.
139 145
140 146
141 popup_dialog({text}, {options}) *popup_dialog()* 147 popup_dialog({text}, {options}) *popup_dialog()*
142 {not implemented yet} 148 {not implemented yet}
143 Just like |popup_create()| but with these default options: > 149 Just like |popup_create()| but with these default options: >
144 call popup_create({text}, { 150 call popup_create({text}, {
145 \ 'pos': 'center', 151 \ 'pos': 'center',
146 \ 'zindex': 200, 152 \ 'zindex': 200,
147 \ 'border': [], 153 \ 'border': [],
154 \ 'padding': [],
148 \}) 155 \})
149 < Use {options} to change the properties. 156 < Use {options} to change the properties.
150 157
151 158
152 popup_notification({text}, {options}) *popup_notification()* 159 popup_notification({text}, {options}) *popup_notification()*
164 \ }) 171 \ })
165 < Use {options} to change the properties. 172 < Use {options} to change the properties.
166 173
167 174
168 popup_atcursor({text}, {options}) *popup_atcursor()* 175 popup_atcursor({text}, {options}) *popup_atcursor()*
176 {not implemented yet: close when cursor moves}
169 Show the {text} above the cursor, and close it when the cursor 177 Show the {text} above the cursor, and close it when the cursor
170 moves. This works like: > 178 moves. This works like: >
171 call popup_create({text}, { 179 call popup_create({text}, {
172 \ 'pos': 'botleft', 180 \ 'pos': 'botleft',
173 \ 'line': 'cursor-1', 181 \ 'line': 'cursor-1',
392 {not implemented yet} 400 {not implemented yet}
393 filter a callback that can filter typed characters, see 401 filter a callback that can filter typed characters, see
394 |popup-filter| 402 |popup-filter|
395 callback a callback to be used when the popup closes, e.g. when 403 callback a callback to be used when the popup closes, e.g. when
396 using |popup_filter_menu()|, see |popup-callback|. 404 using |popup_filter_menu()|, see |popup-callback|.
397 {not implemented yet}
398 405
399 Depending on the "zindex" the popup goes under or above other popups. The 406 Depending on the "zindex" the popup goes under or above other popups. The
400 completion menu (|popup-menu|) has zindex 100. For messages that occur for a 407 completion menu (|popup-menu|) has zindex 100. For messages that occur for a
401 short time the suggestion is to use zindex 1000. 408 short time the suggestion is to use zindex 1000.
402 409
475 'ttimeoutlen' option to 100 and set 'timeout' and/or 'ttimeout'. 482 'ttimeoutlen' option to 100 and set 'timeout' and/or 'ttimeout'.
476 483
477 484
478 POPUP CALLBACK *popup-callback* 485 POPUP CALLBACK *popup-callback*
479 486
480 {not implemented yet}
481 A callback that is invoked when the popup closes. Used by 487 A callback that is invoked when the popup closes. Used by
482 |popup_filter_menu()|. Invoked with two arguments: the ID of the popup and 488 |popup_filter_menu()|.
483 the result, which would usually be an index in the popup lines, or whatever 489
484 the filter wants to pass. 490 The callback is invoked with two arguments: the ID of the popup window and the
491 result, which could be an index in the popup lines, or whatever was passed as
492 the second argument of `popup_close()`.
485 493
486 ============================================================================== 494 ==============================================================================
487 3. Examples *popup-examples* 495 3. Examples *popup-examples*
488 496
489 TODO 497 TODO