diff runtime/doc/popup.txt @ 17117:7ef5283ace3c v8.1.1558

patch 8.1.1558: popup_menu() and popup_filter_menu() are not implemented yet commit https://github.com/vim/vim/commit/a730e55cc2d3045a79a340a5af1ad4a749058a32 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 16 19:05:31 2019 +0200 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.
author Bram Moolenaar <Bram@vim.org>
date Sun, 16 Jun 2019 19:15:05 +0200
parents 0001d10a7661
children b439e096a011
line wrap: on
line diff
--- a/runtime/doc/popup.txt
+++ b/runtime/doc/popup.txt
@@ -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})				*popu
 
 
 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
 			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})			
 				\ })
 <		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.