@@ -88,12 +88,17 @@ that it is in.
88
88
89
89
TODO:
90
90
- 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.
91
93
- Disable commands, feedkeys(), CTRL-W , etc. in a popup window.
92
94
Use ERROR_IF_POPUP_WINDOW for more commands.
93
95
- Add 'balloonpopup' : instead of showing text, let the callback open a popup
94
96
window and return the window ID. The popup will then be closed when the
95
97
mouse moves, except when it moves inside the popup.
96
98
- 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)
97
102
- Make redrawing more efficient and avoid flicker:
98
103
- put popup menu also put in popup_mask?
99
104
- Invoke filter with character before mapping?
@@ -102,17 +107,12 @@ TODO:
102
107
if wrapping inserts indent
103
108
- When drawing on top half a double-wide character, display ">" or "<" in the
104
109
incomplete cell.
105
- - Can the buffer be re-used, to avoid using up lots of buffer numbers?
106
110
- Use a popup window for the "info" item of completion instead of using a
107
111
preview window. Ideas in issue #4544.
108
112
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.
111
113
- Implement:
112
- tabpage option with number
113
114
flip option
114
- transparent text property
115
-
115
+ transparent area, to minimize covering text. Define rectangles?
116
116
117
117
==============================================================================
118
118
2. Functions *popup-functions*
@@ -123,7 +123,7 @@ Creating a popup window:
123
123
| popup_create() | centered in the screen
124
124
| popup_atcursor() | just above the cursor position, closes when
125
125
the cursor moves away
126
- | popup_notifiation ()| show a notification for three seconds
126
+ | popup_notification ()| show a notification for three seconds
127
127
| popup_dialog() | centered with padding and border
128
128
| popup_menu() | prompt for selecting an item from a list
129
129
@@ -163,7 +163,7 @@ popup_atcursor({text}, {options}) *popup_atcursor()*
163
163
164
164
*popup_clear()*
165
165
popup_clear() Emergency solution to a misbehaving plugin: close all popup
166
- windows.
166
+ windows for the current tab and global popups .
167
167
168
168
169
169
popup_close({id} [, {result} ]) *popup_close()*
@@ -216,7 +216,7 @@ popup_dialog({text}, {options}) *popup_dialog()*
216
216
217
217
popup_filter_menu({id} , {key} ) *popup_filter_menu()*
218
218
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
220
220
k <Up> select item above
221
221
<Space> <Enter> accept current selection
222
222
x Esc CTRL-C cancel the menu
@@ -230,6 +230,9 @@ popup_filter_menu({id}, {key}) *popup_filter_menu()*
230
230
the second argument. The first entry has index one.
231
231
Cancelling the menu invokes the callback with -1.
232
232
233
+ To add shortcut keys, see the example here:
234
+ | popup_menu-shortcut-example |
235
+
233
236
234
237
popup_filter_yesno({id} , {key} ) *popup_filter_yesno()*
235
238
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()*
238
241
as the second argument. Pressing Esc and 'x' works like
239
242
pressing 'n'. CTRL-C invokes the callback with -1. Other
240
243
keys are ignored.
244
+ See the example here: | popup_dialog-example |
241
245
242
246
243
247
popup_getoptions({id} ) *popup_getoptions()*
@@ -253,6 +257,10 @@ popup_getoptions({id}) *popup_getoptions()*
253
257
254
258
"borderhighlight" is not included when all values are empty.
255
259
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
+
256
264
If popup window {id} is not found an empty Dict is returned.
257
265
258
266
@@ -390,7 +398,7 @@ manipulation is restricted:
390
398
- 'bufhidden' is "hide"
391
399
- 'buflisted' is off
392
400
- '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
394
402
value.
395
403
396
404
It 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:
474
482
When 0 (the default): display the popup on the current
475
483
tab page.
476
484
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*
479
487
title Text to be displayed above the first item in the
480
488
popup, on top of any border. If there is no top
481
489
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:
515
523
When the list has two characters the first is used for
516
524
the border lines, the second for the corners.
517
525
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.
520
528
zindex Priority for the popup, default 50. Minimum value is
521
529
1, maximum value is 32000.
522
530
time Time in milliseconds after which the popup will close.
@@ -628,7 +636,7 @@ pressed, the number -1 is passed to the callback.
628
636
3. Examples *popup-examples*
629
637
630
638
TODO
631
-
639
+ *popup_dialog-example*
632
640
Prompt the user to press y/Y or n/N: >
633
641
634
642
func MyDialogHandler(id, result)
@@ -637,10 +645,37 @@ Prompt the user to press y/Y or n/N: >
637
645
endif
638
646
endfunc
639
647
640
- call popup_create([ 'Continue? y/n'] , {
648
+ call popup_dialog( 'Continue? y/n', {
641
649
\ 'filter': 'popup_filter_yesno',
642
650
\ 'callback': 'MyDialogHandler',
643
651
\ })
644
652
<
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
+ <
645
680
646
681
vim:tw=78:ts=8:noet:ft=help:norl:
0 commit comments