1- *popup.txt* For Vim version 8.1. Last change: 2019 Jun 30
1+ *popup.txt* For Vim version 8.1. Last change: 2019 Jul 04
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
55
66
7- Displaying text in floating window. *popup* *popup-window*
7+ Displaying text in a floating window. *popup* *popup-window*
88
9- THIS IS UNDER DESIGN - ANYTHING MAY STILL CHANGE
109
11101. Introduction | popup-intro |
11+ Window position and size | popup-position |
12+ Closing the popup window | popup-close |
13+ Popup buffer and window | popup-buffer |
12142. Functions | popup-functions |
13- 3. Examples | popup-examples |
15+ Details | popup-function-details |
16+ 3. Usage | popup-usage |
17+ popup_create() arguments | popup_create-arguments |
18+ Popup text properties | popup-props |
19+ Popup filter | popup-filter |
20+ Popup callback | popup-callback |
21+ Popup scrollbar | popup-scrollbar |
22+ Popup mask | popup-mask |
23+ 4. Examples | popup-examples |
1424
1525
1626{not available if the | +textprop | feature was disabled at compile time}
@@ -55,7 +65,7 @@ If this is not what you are looking for, check out other popup functionality:
5565- balloon, see | balloon-eval |
5666
5767
58- WINDOW POSITION AND SIZE *popup-position*
68+ WINDOW POSITION AND SIZE *popup-position*
5969
6070The height of the window is normally equal to the number of, possibly
6171wrapping, lines in the buffer. It can be limited with the "maxheight"
@@ -85,7 +95,7 @@ That way you can still see where it is, even though you cannot see the text
8595that it is in.
8696
8797
88- CLOSING THE POPUP WINDOW *popup-close*
98+ CLOSING THE POPUP WINDOW *popup-close*
8999
90100Normally the plugin that created the popup window is also in charge of closing
91101it. If somehow a popup hangs around, you can close all of them with: >
@@ -97,40 +107,41 @@ or by clicking anywhere inside the popup. This must be enabled with the
97107"close" property. It is set by default for notifications.
98108
99109
100- TODO:
101- - Add test for when popup with mask is off the left and off the right of the
102- screen.
103- - check padding/border when popup is off the left and right of the screen.
104- - Have a way to scroll to the bottom? (#4577)
105- - Why does 'nrformats' leak from the popup window buffer???
106- - Disable commands, feedkeys(), CTRL-W , etc. in a popup window.
107- Use ERROR_IF_POPUP_WINDOW for more commands.
108- - Add 'balloonpopup' : instead of showing text, let the callback open a popup
109- window and return the window ID. The popup will then be closed when the
110- mouse moves, except when it moves inside the popup.
111- - For the "moved" property also include mouse movement?
112- - Can the buffer be re-used, to avoid using up lots of buffer numbers?
113- - Have an option to attach the popup to a text position, like text properties
114- do. (#4560)
115- - Make redrawing more efficient and avoid flicker:
116- - put popup menu also put in popup_mask?
117- - Invoke filter with character before mapping?
118- - Figure out the size and position better.
119- if wrapping splits a double-wide character
120- if wrapping inserts indent
121- - When drawing on top half a double-wide character, display ">" or "<" in the
122- incomplete cell.
123- - Use a popup window for the "info" item of completion instead of using a
124- preview window. Ideas in issue #4544.
125- How to add highlighting?
126- - Implement:
127- flip option
110+ POPUP BUFFER AND WINDOW *popup-buffer*
111+
112+ If a popup function is called to create a popup from text, a new buffer is
113+ created to hold the text and text properties of the popup window. The buffer
114+ is always associated with the popup window and manipulation is restricted:
115+ - the buffer has no name
116+ - 'buftype' is "popup"
117+ - 'swapfile' is off
118+ - 'bufhidden' is "hide"
119+ - 'buflisted' is off
120+ - 'undolevels' is -1: no undo at all
121+ - all other buffer-local and window-local options are set to their Vim default
122+ value.
123+
124+ It is possible to change the specifically mentioned options, but anything
125+ might break then, so better leave them alone.
126+
127+ The window does have a cursor position, but the cursor is not displayed.
128+
129+ To execute a command in the context of the popup window and buffer use
130+ `win_execute ()` . Example: >
131+ call win_execute(winid, 'syntax enable')
132+
133+ Options can be set on the window with `setwinvar ()` , e.g.: >
134+ call setwinvar(winid, '&wrap', 0)
135+ And options can be set on the buffer with `setbufvar ()` , e.g.: >
136+ call setbufvar(winbufnr(winid), '&filetype', 'java')
137+ Note that this does not trigger autocommands. Use `win_execute ()` if you do
138+ need them.
139+
140+
128141
129142==============================================================================
1301432. Functions *popup-functions*
131144
132- THIS IS UNDER DESIGN - ANYTHING MAY STILL CHANGE
133-
134145Creating a popup window:
135146 | popup_create() | centered in the screen
136147 | popup_atcursor() | just above the cursor position, closes when
@@ -159,9 +170,9 @@ Other:
159170 | popup_getpos() | get actual position and size of a popup
160171
161172
162- [functions help to be moved to eval.txt later]
173+ DETAILS *popup-function-details*
163174
164- popup_atcursor({what} , {options} ) *popup_atcursor()*
175+ popup_atcursor({what} , {options} ) *popup_atcursor()*
165176 Show the {what} above the cursor, and close it when the cursor
166177 moves. This works like: >
167178 call popup_create({what}, {
@@ -199,7 +210,7 @@ popup_create({what}, {options}) *popup_create()*
199210 the popup closes.
200211
201212 {options} is a dictionary with many possible entries.
202- See | popup_create-usage | for details.
213+ See | popup_create-arguments | for details.
203214
204215 Returns a window-ID, which can be used with other popup
205216 functions. Use `winbufnr ()` to get the number of the buffer
@@ -417,38 +428,10 @@ popup_settext({id}, {text}) *popup_settext()*
417428 by the different text.
418429
419430
420- POPUP BUFFER AND WINDOW *popup-buffer*
421-
422- A new buffer is created to hold the text and text properties of the popup
423- window. The buffer is always associated with the popup window and
424- manipulation is restricted:
425- - the buffer has no name
426- - 'buftype' is "popup"
427- - 'swapfile' is off
428- - 'bufhidden' is "hide"
429- - 'buflisted' is off
430- - 'undolevels' is -1: no undo at all
431- - all other buffer-local and window-local options are set to their Vim default
432- value.
433-
434- It is possible to change the specifically mentioned options, but anything
435- might break then, so better leave them alone.
436-
437- The window does have a cursor position, but the cursor is not displayed.
438-
439- To execute a command in the context of the popup window and buffer use
440- `win_execute ()` . Example: >
441- call win_execute(winid, 'syntax enable')
442-
443- Options can be set on the window with `setwinvar ()` , e.g.: >
444- call setwinvar(winid, '&wrap', 0)
445- And options can be set on the buffer with `setbufvar ()` , e.g.: >
446- call setbufvar(winbufnr(winid), '&filetype', 'java')
447- Note that this does not trigger autocommands. Use `win_execute ()` if you do
448- need them.
449-
431+ ==============================================================================
432+ 3. Usage *popup-usage*
450433
451- POPUP_CREATE() ARGUMENTS *popup_create-usage *
434+ POPUP_CREATE() ARGUMENTS *popup_create-arguments *
452435
453436The first argument of | popup_create() | (and the second argument to
454437| popup_settext() | ) specifies the text to be displayed, and optionally text
@@ -709,9 +692,9 @@ To make the four corners transparent:
709692 [[1, 1, 1, 1], [-1, -1, 1, 1], [1, 1, -1, -1], [-1, -1, -1, -1]]
710693
711694==============================================================================
712- 3 . Examples *popup-examples*
695+ 4 . Examples *popup-examples*
713696
714- TODO
697+ TODO: more interesting examples
715698 *popup_dialog-example*
716699Prompt the user to press y/Y or n/N: >
717700
0 commit comments