@@ -246,6 +246,7 @@ popup_dialog({what}, {options}) *popup_dialog()*
246246 \ drag: 1,
247247 \ border: [],
248248 \ padding: [],
249+ \ mapping: 0,
249250 \})
250251< Use {options} to change the properties. E.g. add a 'filter'
251252 option with value 'popup_filter_yesno'. Example: >
@@ -369,12 +370,20 @@ popup_menu({what}, {options}) *popup_menu()*
369370 \ cursorline: 1,
370371 \ padding: [0,1,0,1],
371372 \ filter: 'popup_filter_menu',
373+ \ mapping: 0,
372374 \ })
373375< The current line is highlighted with a match using
374376 "PopupSelected", or "PmenuSel" if that is not defined.
375377
376378 Use {options} to change the properties. Should at least set
377379 "callback" to a function that handles the selected item.
380+ Example: >
381+ func ColorSelected(id, result)
382+ " use a:result
383+ endfunc
384+ call popup_menu(['red', 'green', 'blue'], #{
385+ \ callback: 'ColorSelected',
386+ \ })
378387
379388
380389 popup_move({id} , {options} ) *popup_move()*
@@ -433,16 +442,17 @@ popup_setoptions({id}, {options}) *popup_setoptions()*
433442 borderhighlight
434443 callback
435444 close
436- drag
437- resize
438445 cursorline
446+ drag
439447 filter
440448 firstline
441449 flip
442450 highlight
451+ mapping
443452 mask
444453 moved
445454 padding
455+ resize
446456 scrollbar
447457 scrollbarhighlight
448458 thumbhighlight
@@ -615,6 +625,9 @@ The second argument of |popup_create()| is a dictionary with options:
615625 Default is zero, except for | popup_menu() | .
616626 filter A callback that can filter typed characters, see
617627 | popup-filter | .
628+ mapping Allow for key mapping. When FALSE and the popup is
629+ visible and has a filter callback key mapping is
630+ disabled. Default value is TRUE.
618631 callback A callback that is called when the popup closes, e.g.
619632 when using | popup_filter_menu() | , see | popup-callback | .
620633
@@ -671,8 +684,11 @@ key as a string, e.g.: >
671684 endif
672685 return 0
673686 endfunc
674-
675- Currently the key is what results after any mapping. This may change...
687+ < *popup-mapping*
688+ Normally the key is what results after any mapping, since the keys pass on as
689+ normal input if the filter does not use it. If the filter consumes all the
690+ keys, set the "mapping" property to zero so that mappings do not get in the
691+ way. This is default for | popup_menu() | and | popup_dialog() | .
676692
677693Some common key actions:
678694 x close the popup (see note below)
@@ -703,6 +719,11 @@ the second argument of `popup_close()`.
703719If the popup is force-closed, e.g. because the cursor moved or CTRL-C was
704720pressed, the number -1 is passed to the callback.
705721
722+ Example: >
723+ func SelectedColor(id, result)
724+ echo 'choice made: ' .. a:result
725+ endfunc
726+
706727
707728 POPUP SCROLLBAR *popup-scrollbar*
708729
0 commit comments