Mercurial > vim
comparison runtime/doc/popup.txt @ 16880:998603a243d7 v8.1.1441
patch 8.1.1441: popup window filter not yet implemented
commit https://github.com/vim/vim/commit/bf0eff0b724ebf4951f7ca82e6c648451f9f0c01
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jun 1 17:13:36 2019 +0200
patch 8.1.1441: popup window filter not yet implemented
Problem: Popup window filter not yet implemented.
Solution: Implement the popup filter.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 01 Jun 2019 17:15:06 +0200 |
parents | e5dab34ded73 |
children | 59e4148c0c73 |
comparison
equal
deleted
inserted
replaced
16879:3fc7f1139ab4 | 16880:998603a243d7 |
---|---|
1 *popup.txt* For Vim version 8.1. Last change: 2019 May 31 | 1 *popup.txt* For Vim version 8.1. Last change: 2019 Jun 01 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Bram Moolenaar | 4 VIM REFERENCE MANUAL by Bram Moolenaar |
5 | 5 |
6 | 6 |
88 Probably 2. is the best choice. | 88 Probably 2. is the best choice. |
89 | 89 |
90 | 90 |
91 IMPLEMENTATION: | 91 IMPLEMENTATION: |
92 - Code is in popupwin.c | 92 - Code is in popupwin.c |
93 - Implement filter. | 93 - Invoke filter with character before mapping? |
94 Check that popup_close() works in the filter. | 94 - Handle screen resize in screenalloc(). (Ben Jackson, #4467) |
95 - Why does 'nrformats' leak from the popup window buffer??? | |
95 - Implement padding | 96 - Implement padding |
96 - Implement border | 97 - Implement border |
97 - Handle screen resize in screenalloc(). | |
98 - Make redrawing more efficient and avoid flicker. | 98 - Make redrawing more efficient and avoid flicker. |
99 Store popup info in a mask, use the mask in screen_line() | 99 Store popup info in a mask, use the mask in screen_line() |
100 Keep mask until next update_screen(), find differences and redraw affected | 100 Keep mask until next update_screen(), find differences and redraw affected |
101 windows/lines | 101 windows/lines |
102 Fix redrawing problem with completion. | 102 Fix redrawing problem with completion. |
103 Fix redrawing problem when scrolling non-current window | 103 Fix redrawing problem when scrolling non-current window |
104 Fix redrawing the statusline on top of a popup | 104 Fix redrawing the statusline on top of a popup |
105 - Disable commands, feedkeys(), CTRL-W, etc. in a popup window. Or whitelist | 105 - Disable commands, feedkeys(), CTRL-W, etc. in a popup window. |
106 commands that are allowed? | 106 Use NOT_IN_POPUP_WINDOW. |
107 - Figure out the size and position better. | 107 - Figure out the size and position better. |
108 if wrapping splits a double-wide character | 108 if wrapping splits a double-wide character |
109 if wrapping inserts indent | 109 if wrapping inserts indent |
110 - Can the buffer be re-used, to avoid using up lots of buffer numbers? | 110 - Can the buffer be re-used, to avoid using up lots of buffer numbers? |
111 - Implement all the unimplemented options and features. | 111 - Implement all the unimplemented options and features. |
383 a list with two numbers specifies the start and end | 383 a list with two numbers specifies the start and end |
384 column | 384 column |
385 {not implemented yet} | 385 {not implemented yet} |
386 filter a callback that can filter typed characters, see | 386 filter a callback that can filter typed characters, see |
387 |popup-filter| | 387 |popup-filter| |
388 {not implemented yet} | |
389 callback a callback to be used when the popup closes, e.g. when | 388 callback a callback to be used when the popup closes, e.g. when |
390 using |popup_filter_menu()|, see |popup-callback|. | 389 using |popup_filter_menu()|, see |popup-callback|. |
391 {not implemented yet} | 390 {not implemented yet} |
392 | 391 |
393 Depending on the "zindex" the popup goes under or above other popups. The | 392 Depending on the "zindex" the popup goes under or above other popups. The |
424 {not implemented yet} | 423 {not implemented yet} |
425 | 424 |
426 | 425 |
427 POPUP FILTER *popup-filter* | 426 POPUP FILTER *popup-filter* |
428 | 427 |
429 {not implemented yet} | |
430 A callback that gets any typed keys while a popup is displayed. The filter is | 428 A callback that gets any typed keys while a popup is displayed. The filter is |
431 not invoked when the popup is hidden. | 429 not invoked when the popup is hidden. |
432 | 430 |
433 The filter can return TRUE to indicate the key has been handled and is to be | 431 The filter can return TRUE to indicate the key has been handled and is to be |
434 discarded, or FALSE to let Vim handle the key as usual in the current state. | 432 discarded, or FALSE to let Vim handle the key as usual in the current state. |
435 In case it returns FALSE and there is another popup window visible, that | 433 In case it returns FALSE and there is another popup window visible, that |
436 filter is also called. The filter of the popup window with the highest zindex | 434 filter is also called. The filter of the popup window with the highest zindex |
437 is called first. | 435 is called first. |
438 | 436 |
439 The filter function is called with two arguments: the ID of the popup and the | 437 The filter function is called with two arguments: the ID of the popup and the |
440 key. | 438 key, e.g.: > |
439 func MyFilter(winid, key) | |
440 if a:key == "\<F2>" | |
441 " do something | |
442 return 1 | |
443 endif | |
444 if a:key == 'x' | |
445 call popup_close(a:winid) | |
446 return 1 | |
447 endif | |
448 return 0 | |
449 endfunc | |
450 | |
451 Currently the key is what results after any mapping. This may change... | |
441 | 452 |
442 Some common key actions: | 453 Some common key actions: |
443 Esc close the popup | 454 x close the popup (see note below) |
444 cursor keys select another entry | 455 cursor keys select another entry |
445 Tab accept current suggestion | 456 Tab accept current suggestion |
446 | 457 |
447 A mouse click arrives as <LeftMouse>. The coordinates are in | 458 A mouse click arrives as <LeftMouse>. The coordinates are in |
448 v:mouse_popup_col and v:mouse_popup_row. The top-left screen cell of the | 459 v:mouse_popup_col and v:mouse_popup_row. The top-left screen cell of the |
449 popup is col 1, row 1 (not counting the border). | 460 popup is col 1, row 1 (not counting the border). |
450 | 461 |
451 Vim provides standard filters |popup_filter_menu()| and | 462 Vim provides standard filters |popup_filter_menu()| and |
452 |popup_filter_yesno()|. | 463 |popup_filter_yesno()|. |
464 | |
465 Note that "x" is the normal way to close a popup. You may want to use Esc, | |
466 but since many keys start with an Esc character, there may be a delay before | |
467 Vim recognizes the Esc key. If you do use Esc, it is reecommended to set the | |
468 'ttimeoutlen' option to 100 and set 'timeout' and/or 'ttimeout'. | |
453 | 469 |
454 | 470 |
455 POPUP CALLBACK *popup-callback* | 471 POPUP CALLBACK *popup-callback* |
456 | 472 |
457 {not implemented yet} | 473 {not implemented yet} |