|
1 |
| -*popup.txt* For Vim version 8.2. Last change: 2022 Apr 04 |
| 1 | +*popup.txt* For Vim version 8.2. Last change: 2022 Jun 06 |
2 | 2 |
|
3 | 3 |
|
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar
|
@@ -147,7 +147,8 @@ A special case is running a terminal in a popup window. Many rules are then
|
147 | 147 | different: *E863*
|
148 | 148 | - The popup window always has focus, it is not possible to switch to another
|
149 | 149 | window.
|
150 |
| -- When the job ends, the popup window closes. |
| 150 | +- When the job ends, the popup window shows the buffer in Terminal-Normal |
| 151 | + mode. Use `:q` to close it or use "term_finish" value "close". |
151 | 152 | - The popup window can be closed with `popup_close()`, the terminal buffer
|
152 | 153 | then becomes hidden.
|
153 | 154 | - It is not possible to open a second popup window with a terminal. *E861*
|
@@ -998,20 +999,23 @@ To make the four corners transparent:
|
998 | 999 | ==============================================================================
|
999 | 1000 | 4. Examples *popup-examples*
|
1000 | 1001 |
|
| 1002 | +These examples use |Vim9| script. |
| 1003 | + |
1001 | 1004 | TODO: more interesting examples
|
| 1005 | + |
1002 | 1006 | *popup_dialog-example*
|
1003 | 1007 | Prompt the user to press y/Y or n/N: >
|
1004 | 1008 |
|
1005 |
| - func MyDialogHandler(id, result) |
1006 |
| - if a:result |
1007 |
| - " ... 'y' or 'Y' was pressed |
1008 |
| - endif |
1009 |
| - endfunc |
1010 |
| -
|
1011 |
| - call popup_dialog('Continue? y/n', #{ |
1012 |
| - \ filter: 'popup_filter_yesno', |
1013 |
| - \ callback: 'MyDialogHandler', |
1014 |
| - \ }) |
| 1009 | + popup_dialog('Continue? y/n', { |
| 1010 | + filter: 'popup_filter_yesno', |
| 1011 | + callback: (id, result) => { |
| 1012 | + if result == 1 |
| 1013 | + echomsg "'y' or 'Y' was pressed" |
| 1014 | + else |
| 1015 | + echomsg "'y' or 'Y' was NOT pressed" |
| 1016 | + endif |
| 1017 | + }, |
| 1018 | + }) |
1015 | 1019 | <
|
1016 | 1020 | *popup_menu-shortcut-example*
|
1017 | 1021 | Extend popup_filter_menu() with shortcut keys: >
|
@@ -1039,6 +1043,10 @@ Extend popup_filter_menu() with shortcut keys: >
|
1039 | 1043 | " No shortcut, pass to generic filter
|
1040 | 1044 | return popup_filter_menu(a:id, a:key)
|
1041 | 1045 | endfunc
|
| 1046 | +
|
| 1047 | + func MyMenuHandler(id, result) |
| 1048 | + echo $'Result: {a:result}' |
| 1049 | + endfunc |
1042 | 1050 | <
|
1043 | 1051 | *popup_beval_example*
|
1044 | 1052 | Example for using a popup window for 'ballooneval': >
|
|
0 commit comments