Mercurial > vim
comparison runtime/doc/popup.txt @ 17604:506dd2efcbb2 v8.1.1799
patch 8.1.1799: cannot avoid mapping for a popup window
commit https://github.com/vim/vim/commit/749fa0af85232be1d44b77a09161f71cdbace62c
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 3 16:18:07 2019 +0200
patch 8.1.1799: cannot avoid mapping for a popup window
Problem: Cannot avoid mapping for a popup window.
Solution: Add the "mapping" property, default TRUE.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 03 Aug 2019 16:30:06 +0200 |
parents | d5e5d0fc3fa8 |
children | 95c23e180022 |
comparison
equal
deleted
inserted
replaced
17603:3784be49d075 | 17604:506dd2efcbb2 |
---|---|
244 \ pos: 'center', | 244 \ pos: 'center', |
245 \ zindex: 200, | 245 \ zindex: 200, |
246 \ drag: 1, | 246 \ drag: 1, |
247 \ border: [], | 247 \ border: [], |
248 \ padding: [], | 248 \ padding: [], |
249 \ mapping: 0, | |
249 \}) | 250 \}) |
250 < Use {options} to change the properties. E.g. add a 'filter' | 251 < Use {options} to change the properties. E.g. add a 'filter' |
251 option with value 'popup_filter_yesno'. Example: > | 252 option with value 'popup_filter_yesno'. Example: > |
252 call popup_create('do you want to quit (Yes/no)?', #{ | 253 call popup_create('do you want to quit (Yes/no)?', #{ |
253 \ filter: 'popup_filter_yesno', | 254 \ filter: 'popup_filter_yesno', |
367 \ wrap: 0, | 368 \ wrap: 0, |
368 \ border: [], | 369 \ border: [], |
369 \ cursorline: 1, | 370 \ cursorline: 1, |
370 \ padding: [0,1,0,1], | 371 \ padding: [0,1,0,1], |
371 \ filter: 'popup_filter_menu', | 372 \ filter: 'popup_filter_menu', |
373 \ mapping: 0, | |
372 \ }) | 374 \ }) |
373 < The current line is highlighted with a match using | 375 < The current line is highlighted with a match using |
374 "PopupSelected", or "PmenuSel" if that is not defined. | 376 "PopupSelected", or "PmenuSel" if that is not defined. |
375 | 377 |
376 Use {options} to change the properties. Should at least set | 378 Use {options} to change the properties. Should at least set |
377 "callback" to a function that handles the selected item. | 379 "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 \ }) | |
378 | 387 |
379 | 388 |
380 popup_move({id}, {options}) *popup_move()* | 389 popup_move({id}, {options}) *popup_move()* |
381 Move popup {id} to the position specified with {options}. | 390 Move popup {id} to the position specified with {options}. |
382 {options} may contain the items from |popup_create()| that | 391 {options} may contain the items from |popup_create()| that |
431 border | 440 border |
432 borderchars | 441 borderchars |
433 borderhighlight | 442 borderhighlight |
434 callback | 443 callback |
435 close | 444 close |
445 cursorline | |
436 drag | 446 drag |
437 resize | |
438 cursorline | |
439 filter | 447 filter |
440 firstline | 448 firstline |
441 flip | 449 flip |
442 highlight | 450 highlight |
451 mapping | |
443 mask | 452 mask |
444 moved | 453 moved |
445 padding | 454 padding |
455 resize | |
446 scrollbar | 456 scrollbar |
447 scrollbarhighlight | 457 scrollbarhighlight |
448 thumbhighlight | 458 thumbhighlight |
449 time | 459 time |
450 title | 460 title |
613 when 'wrap' is off). | 623 when 'wrap' is off). |
614 zero: Do not highlight the cursor line. | 624 zero: Do not highlight the cursor line. |
615 Default is zero, except for |popup_menu()|. | 625 Default is zero, except for |popup_menu()|. |
616 filter A callback that can filter typed characters, see | 626 filter A callback that can filter typed characters, see |
617 |popup-filter|. | 627 |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. | |
618 callback A callback that is called when the popup closes, e.g. | 631 callback A callback that is called when the popup closes, e.g. |
619 when using |popup_filter_menu()|, see |popup-callback|. | 632 when using |popup_filter_menu()|, see |popup-callback|. |
620 | 633 |
621 Depending on the "zindex" the popup goes under or above other popups. The | 634 Depending on the "zindex" the popup goes under or above other popups. The |
622 completion menu (|popup-menu|) has zindex 100. For messages that occur for a | 635 completion menu (|popup-menu|) has zindex 100. For messages that occur for a |
669 call popup_close(a:winid) | 682 call popup_close(a:winid) |
670 return 1 | 683 return 1 |
671 endif | 684 endif |
672 return 0 | 685 return 0 |
673 endfunc | 686 endfunc |
674 | 687 < *popup-mapping* |
675 Currently the key is what results after any mapping. This may change... | 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()|. | |
676 | 692 |
677 Some common key actions: | 693 Some common key actions: |
678 x close the popup (see note below) | 694 x close the popup (see note below) |
679 cursor keys select another entry | 695 cursor keys select another entry |
680 Tab accept current suggestion | 696 Tab accept current suggestion |
700 result, which could be an index in the popup lines, or whatever was passed as | 716 result, which could be an index in the popup lines, or whatever was passed as |
701 the second argument of `popup_close()`. | 717 the second argument of `popup_close()`. |
702 | 718 |
703 If the popup is force-closed, e.g. because the cursor moved or CTRL-C was | 719 If the popup is force-closed, e.g. because the cursor moved or CTRL-C was |
704 pressed, the number -1 is passed to the callback. | 720 pressed, the number -1 is passed to the callback. |
721 | |
722 Example: > | |
723 func SelectedColor(id, result) | |
724 echo 'choice made: ' .. a:result | |
725 endfunc | |
705 | 726 |
706 | 727 |
707 POPUP SCROLLBAR *popup-scrollbar* | 728 POPUP SCROLLBAR *popup-scrollbar* |
708 | 729 |
709 If the text does not fit in the popup a scrollbar is displayed on the right of | 730 If the text does not fit in the popup a scrollbar is displayed on the right of |