diff runtime/doc/popup.txt @ 17097:94007c802045 v8.1.1548

patch 8.1.1548: popup_dialog() is not implemented commit https://github.com/vim/vim/commit/a42d945efc60e6130c15f72b5a5aa9fd2b63241a Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 15 21:46:30 2019 +0200 patch 8.1.1548: popup_dialog() is not implemented Problem: Popup_dialog() is not implemented. Solution: Implement popup_dialog() and popup_filter_yesno().
author Bram Moolenaar <Bram@vim.org>
date Sat, 15 Jun 2019 22:00:06 +0200
parents 2546930657a9
children 0001d10a7661
line wrap: on
line diff
--- a/runtime/doc/popup.txt
+++ b/runtime/doc/popup.txt
@@ -103,10 +103,10 @@ TODO:
 - When drawing on top half a double-wide character, display ">" or "<" in the
   incomplete cell.
 - Can the buffer be re-used, to avoid using up lots of buffer numbers?
+- Use a popup window for the "info" item of completion instead of using a
+  preview window.
 - Implement:
-	popup_dialog({text}, {options})
 	popup_filter_menu({id}, {key})
-	popup_filter_yesno({id}, {key})
 	popup_menu({text}, {options})
 	popup_setoptions({id}, {options})
 	flip option
@@ -196,16 +196,23 @@ popup_create({text}, {options})				*popu
 
 
 popup_dialog({text}, {options})				*popup_dialog()*
-		{not implemented yet}
 		Just like |popup_create()| but with these default options: >
 			call popup_create({text}, {
 				\ 'pos': 'center',
 				\ 'zindex': 200,
+				\ 'drag': 1,
 				\ 'border': [],
 				\ 'padding': [],
 				\})
 <		Use {options} to change the properties. E.g. add a 'filter'
-		option with value 'popup_filter_yesno'.
+		option with value 'popup_filter_yesno'.  Example: >
+			call popup_create('do you want to quit (Yes/no)?', {
+				\ 'filter': 'popup_filter_yesno',
+				\ 'callback': 'QuitCallback',
+				\ })
+
+<		By default the dialog can be dragged, so that text below it
+		can be read if needed.
 
 
 popup_filter_menu({id}, {key})				*popup_filter_menu()*
@@ -218,12 +225,12 @@ popup_filter_menu({id}, {key})				*popup
 
 
 popup_filter_yesno({id}, {key})				*popup_filter_yesno()*
-		{not implemented yet}
 		Filter that can be used for a popup. It handles only the keys
 		'y', 'Y' and 'n' or 'N'.  Invokes the "callback" of the
 		popup menu with the 1 for 'y' or 'Y' and zero for 'n' or 'N'
-		as the second argument.  Pressing Esc and CTRL-C works like
-		pressing 'n'.  Other keys are ignored.
+		as the second argument.  Pressing Esc and 'x' works like
+		pressing 'n'.  CTRL-C invokes the callback with -1.  Other
+		keys are ignored.
 
 
 popup_getoptions({id})					*popup_getoptions()*
@@ -301,7 +308,7 @@ popup_notification({text}, {options})			
 				\ 'minwidth': 20,
 				\ 'time': 3000,
 				\ 'tabpage': -1,
-				\ 'zindex': 200,
+				\ 'zindex': 300,
 				\ 'drag': 1,
 				\ 'highlight': 'WarningMsg',
 				\ 'border': [],
@@ -521,7 +528,7 @@ filter is also called.  The filter of th
 is called first.
 
 The filter function is called with two arguments: the ID of the popup and the
-key, e.g.: >
+key as a string, e.g.: >
 	func MyFilter(winid, key)
 	  if a:key == "\<F2>"
 	    " do something
@@ -556,15 +563,14 @@ Vim recognizes the Esc key.  If you do u
 
 POPUP CALLBACK						*popup-callback*
 
-A callback that is invoked when the popup closes.  Used by
-|popup_filter_menu()|.
+A callback that is invoked when the popup closes.
 
 The callback is invoked with two arguments: the ID of the popup window and the
 result, which could be an index in the popup lines, or whatever was passed as
 the second argument of `popup_close()`.
 
-If the popup is closed because the cursor moved, the number -1 is passed to
-the callback.
+If the popup is force-closed, e.g. because the cursor moved or CTRL-C was
+pressed, the number -1 is passed to the callback.
 
 ==============================================================================
 3. Examples						*popup-examples*