@@ -88,12 +88,17 @@ that it is in.
8888
8989TODO:
9090- Why does 'nrformats' leak from the popup window buffer???
91+ - When the lines do not fit show a scrollbar (like in the popup menu).
92+ Use the mouse wheel for scrolling.
9193- Disable commands, feedkeys(), CTRL-W , etc. in a popup window.
9294 Use ERROR_IF_POPUP_WINDOW for more commands.
9395- Add 'balloonpopup' : instead of showing text, let the callback open a popup
9496 window and return the window ID. The popup will then be closed when the
9597 mouse moves, except when it moves inside the popup.
9698- For the "moved" property also include mouse movement?
99+ - Can the buffer be re-used, to avoid using up lots of buffer numbers?
100+ - Have an option to attach the popup to a text position, like text properties
101+ do. (#4560)
97102- Make redrawing more efficient and avoid flicker:
98103 - put popup menu also put in popup_mask?
99104- Invoke filter with character before mapping?
@@ -102,17 +107,12 @@ TODO:
102107 if wrapping inserts indent
103108- When drawing on top half a double-wide character, display ">" or "<" in the
104109 incomplete cell.
105- - Can the buffer be re-used, to avoid using up lots of buffer numbers?
106110- Use a popup window for the "info" item of completion instead of using a
107111 preview window. Ideas in issue #4544.
108112 How to add highlighting?
109- - When the lines do not fit show a scrollbar (like in the popup menu).
110- Use the mouse wheel for scrolling.
111113- Implement:
112- tabpage option with number
113114 flip option
114- transparent text property
115-
115+ transparent area, to minimize covering text. Define rectangles?
116116
117117==============================================================================
1181182. Functions *popup-functions*
@@ -123,7 +123,7 @@ Creating a popup window:
123123 | popup_create() | centered in the screen
124124 | popup_atcursor() | just above the cursor position, closes when
125125 the cursor moves away
126- | popup_notifiation ()| show a notification for three seconds
126+ | popup_notification ()| show a notification for three seconds
127127 | popup_dialog() | centered with padding and border
128128 | popup_menu() | prompt for selecting an item from a list
129129
@@ -163,7 +163,7 @@ popup_atcursor({text}, {options}) *popup_atcursor()*
163163
164164 *popup_clear()*
165165popup_clear() Emergency solution to a misbehaving plugin: close all popup
166- windows.
166+ windows for the current tab and global popups .
167167
168168
169169popup_close({id} [, {result} ]) *popup_close()*
@@ -216,7 +216,7 @@ popup_dialog({text}, {options}) *popup_dialog()*
216216
217217popup_filter_menu({id} , {key} ) *popup_filter_menu()*
218218 Filter that can be used for a popup. These keys can be used:
219- j <Down> select item below
219+ j <Down> select item below
220220 k <Up> select item above
221221 <Space> <Enter> accept current selection
222222 x Esc CTRL-C cancel the menu
@@ -230,6 +230,9 @@ popup_filter_menu({id}, {key}) *popup_filter_menu()*
230230 the second argument. The first entry has index one.
231231 Cancelling the menu invokes the callback with -1.
232232
233+ To add shortcut keys, see the example here:
234+ | popup_menu-shortcut-example |
235+
233236
234237popup_filter_yesno({id} , {key} ) *popup_filter_yesno()*
235238 Filter that can be used for a popup. It handles only the keys
@@ -238,6 +241,7 @@ popup_filter_yesno({id}, {key}) *popup_filter_yesno()*
238241 as the second argument. Pressing Esc and 'x' works like
239242 pressing 'n'. CTRL-C invokes the callback with -1. Other
240243 keys are ignored.
244+ See the example here: | popup_dialog-example |
241245
242246
243247popup_getoptions({id} ) *popup_getoptions()*
@@ -253,6 +257,10 @@ popup_getoptions({id}) *popup_getoptions()*
253257
254258 "borderhighlight" is not included when all values are empty.
255259
260+ "tabpage" will be -1 for a global popup, zero for a popup on
261+ the current tabpage and a positive number for a popup on
262+ another tabpage.
263+
256264 If popup window {id} is not found an empty Dict is returned.
257265
258266
@@ -390,7 +398,7 @@ manipulation is restricted:
390398- 'bufhidden' is "hide"
391399- 'buflisted' is off
392400- 'undolevels' is -1: no undo at all
393- - all other buffer-local and window_local options are set to their Vim default
401+ - all other buffer-local and window-local options are set to their Vim default
394402 value.
395403
396404It is possible to change the specifically mentioned options, but anything
@@ -474,8 +482,8 @@ The second argument of |popup_create()| is a dictionary with options:
474482 When 0 (the default): display the popup on the current
475483 tab page.
476484 Otherwise the number of the tab page the popup is
477- displayed on; when invalid the current tab page is used.
478- {only -1 and 0 are implemented}
485+ displayed on; when invalid the popup is not created
486+ and an error is given. *E996*
479487 title Text to be displayed above the first item in the
480488 popup, on top of any border. If there is no top
481489 border one line of padding is added to put the title
@@ -515,8 +523,8 @@ The second argument of |popup_create()| is a dictionary with options:
515523 When the list has two characters the first is used for
516524 the border lines, the second for the corners.
517525 By default a double line is used all around when
518- 'encoding' is "utf-8", otherwise ASCII characters are
519- used.
526+ 'encoding' is "utf-8" and 'ambiwidth' is "single,
527+ otherwise ASCII characters are used.
520528 zindex Priority for the popup, default 50. Minimum value is
521529 1, maximum value is 32000.
522530 time Time in milliseconds after which the popup will close.
@@ -628,7 +636,7 @@ pressed, the number -1 is passed to the callback.
6286363. Examples *popup-examples*
629637
630638TODO
631-
639+ *popup_dialog-example*
632640Prompt the user to press y/Y or n/N: >
633641
634642 func MyDialogHandler(id, result)
@@ -637,10 +645,37 @@ Prompt the user to press y/Y or n/N: >
637645 endif
638646 endfunc
639647
640- call popup_create([ 'Continue? y/n'] , {
648+ call popup_dialog( 'Continue? y/n', {
641649 \ 'filter': 'popup_filter_yesno',
642650 \ 'callback': 'MyDialogHandler',
643651 \ })
644652<
653+ *popup_menu-shortcut-example*
654+ Extend popup_filter_menu() with shortcut keys: >
655+
656+ call popup_menu('Save', 'Cancel', 'Discard'], {
657+ \ 'filter': 'MyMenuFilter',
658+ \ 'callback': 'MyMenuHandler',
659+ \ })
660+
661+ func MyMenuFilter(id, key)
662+ " Handle shortcuts
663+ if a:key == 'S'
664+ call popup_close(a:id, 1)
665+ return 1
666+ endif
667+ if a:key == 'C'
668+ call popup_close(a:id, 2)
669+ return 1
670+ endif
671+ if a:key == 'D'
672+ call popup_close(a:id, 3)
673+ return 1
674+ endif
675+
676+ " No shortcut, pass to generic filter
677+ return popup_filter_menu(a:id, a:key)
678+ endfunc
679+ <
645680
646681 vim:tw=78:ts=8:noet:ft=help:norl:
0 commit comments