1
0
forked from aniani/vim

patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet

Problem:    Popup_menu() and popup_filter_menu() are not implemented yet.
Solution:   Implement the functions. Fix that centering didn't take the border
            and padding into account.
This commit is contained in:
Bram Moolenaar
2019-06-16 19:05:31 +02:00
parent 983f2f1403
commit a730e55cc2
12 changed files with 276 additions and 52 deletions

View File

@@ -89,7 +89,7 @@ that it is in.
TODO:
- Why does 'nrformats' leak from the popup window buffer???
- Disable commands, feedkeys(), CTRL-W, etc. in a popup window.
Use NOT_IN_POPUP_WINDOW for more commands.
Use ERROR_IF_POPUP_WINDOW for more commands.
- Add 'balloonpopup': instead of showing text, let the callback open a popup
window and return the window ID. The popup will then be closed when the
mouse moves, except when it moves inside the popup.
@@ -109,8 +109,6 @@ TODO:
- When the lines do not fit show a scrollbar (like in the popup menu).
Use the mouse wheel for scrolling.
- Implement:
popup_filter_menu({id}, {key})
popup_menu({text}, {options})
popup_setoptions({id}, {options})
hidden option
tabpage option with number
@@ -220,12 +218,20 @@ popup_dialog({text}, {options}) *popup_dialog()*
popup_filter_menu({id}, {key}) *popup_filter_menu()*
{not implemented yet}
Filter that can be used for a popup. It handles the cursor
keys to move the selected index in the popup. Space and Enter
can be used to select an item. Invokes the "callback" of the
popup menu with the index of the selected line as the second
argument.
Filter that can be used for a popup. These keys can be used:
j <Down> select item below
k <Up> select item above
<Space> <Enter> accept current selection
x Esc CTRL-C cancel the menu
Other keys are ignored.
A match is set on that line to highlight it, see
|popup_menu()|.
When the current selection is accepted the "callback" of the
popup menu is invoked with the index of the selected line as
the second argument. The first entry has index one.
Cancelling the menu invokes the callback with -1.
popup_filter_yesno({id}, {key}) *popup_filter_yesno()*
@@ -279,7 +285,6 @@ popup_hide({id}) *popup_hide()*
popup_menu({text}, {options}) *popup_menu()*
{not implemented yet}
Show the {text} near the cursor, handle selecting one of the
items with cursorkeys, and close it an item is selected with
Space or Enter. {text} should have multiple lines to make this
@@ -287,11 +292,16 @@ popup_menu({text}, {options}) *popup_menu()*
call popup_create({text}, {
\ 'pos': 'center',
\ 'zindex': 200,
\ 'drag': 1,
\ 'wrap': 0,
\ 'border': [],
\ 'padding': [],
\ 'filter': 'popup_filter_menu',
\ })
< Use {options} to change the properties. Should at least set
< The current line is highlighted with a match using
PopupSelected, or |PmenuSel| if that is not defined.
Use {options} to change the properties. Should at least set
"callback" to a function that handles the selected item.
@@ -320,7 +330,8 @@ popup_notification({text}, {options}) *popup_notification()*
\ })
< The PopupNotification highlight group is used instead of
WarningMsg if it is defined.
< The position will be adjusted to avoid overlap with other
The position will be adjusted to avoid overlap with other
notifications.
Use {options} to change the properties.