comparison runtime/doc/popup.txt @ 17225:09fa437d33d8 v8.1.1612

patch 8.1.1612: cannot show an existing buffer in a popup window commit https://github.com/vim/vim/commit/5b8cfedfbd19a71a30c73cf44b0aec3da7fc1a24 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 30 22:16:10 2019 +0200 patch 8.1.1612: cannot show an existing buffer in a popup window Problem: Cannot show an existing buffer in a popup window. Solution: Support buffer number argument in popup_create().
author Bram Moolenaar <Bram@vim.org>
date Sun, 30 Jun 2019 22:30:05 +0200
parents 5169811b3044
children cb0ca75f0c26
comparison
equal deleted inserted replaced
17224:e92df9dfef0f 17225:09fa437d33d8
96 or by clicking anywhere inside the popup. This must be enabled with the 96 or by clicking anywhere inside the popup. This must be enabled with the
97 "close" property. It is set by default for notifications. 97 "close" property. It is set by default for notifications.
98 98
99 99
100 TODO: 100 TODO:
101 - Currently 'buftype' is set to "popup", but all the specifics are on the
102 window. Can we use a "normal" buffer and put the type on the window? (#4595)
103 What if it's modified and the window closes?
104 - Add test for when popup with mask is off the left and off the right of the 101 - Add test for when popup with mask is off the left and off the right of the
105 screen. 102 screen.
106 - check padding/border when popup is off the left and right of the screen. 103 - check padding/border when popup is off the left and right of the screen.
107 - Have a way to scroll to the bottom? (#4577) 104 - Have a way to scroll to the bottom? (#4577)
108 - Why does 'nrformats' leak from the popup window buffer??? 105 - Why does 'nrformats' leak from the popup window buffer???
162 |popup_getpos()| get actual position and size of a popup 159 |popup_getpos()| get actual position and size of a popup
163 160
164 161
165 [functions help to be moved to eval.txt later] 162 [functions help to be moved to eval.txt later]
166 163
167 popup_atcursor({text}, {options}) *popup_atcursor()* 164 popup_atcursor({what}, {options}) *popup_atcursor()*
168 Show the {text} above the cursor, and close it when the cursor 165 Show the {what} above the cursor, and close it when the cursor
169 moves. This works like: > 166 moves. This works like: >
170 call popup_create({text}, { 167 call popup_create({what}, {
171 \ 'pos': 'botleft', 168 \ 'pos': 'botleft',
172 \ 'line': 'cursor-1', 169 \ 'line': 'cursor-1',
173 \ 'col': 'cursor', 170 \ 'col': 'cursor',
174 \ 'moved': 'WORD', 171 \ 'moved': 'WORD',
175 \ }) 172 \ })
189 popup window is deleted. If the optional {result} is present 186 popup window is deleted. If the optional {result} is present
190 it will be passed as the second argument of the callback. 187 it will be passed as the second argument of the callback.
191 Otherwise zero is passed to the callback. 188 Otherwise zero is passed to the callback.
192 189
193 190
194 popup_create({text}, {options}) *popup_create()* 191 popup_create({what}, {options}) *popup_create()*
195 Open a popup window showing {text}, which is either: 192 Open a popup window showing {what}, which is either:
193 - a buffer number
196 - a string 194 - a string
197 - a list of strings 195 - a list of strings
198 - a list of text lines with text properties 196 - a list of text lines with text properties
197 When {what} is not a buffer number, a buffer is created with
198 'buftype' set to "popup". That buffer will be wiped out once
199 the popup closes.
199 200
200 {options} is a dictionary with many possible entries. 201 {options} is a dictionary with many possible entries.
201 See |popup_create-usage| for details. 202 See |popup_create-usage| for details.
202 203
203 Returns a window-ID, which can be used with other popup 204 Returns a window-ID, which can be used with other popup
207 let bufnr = winbufnr(winid) 208 let bufnr = winbufnr(winid)
208 call setbufline(bufnr, 2, 'second line') 209 call setbufline(bufnr, 2, 'second line')
209 < In case of failure zero is returned. 210 < In case of failure zero is returned.
210 211
211 212
212 popup_dialog({text}, {options}) *popup_dialog()* 213 popup_dialog({what}, {options}) *popup_dialog()*
213 Just like |popup_create()| but with these default options: > 214 Just like |popup_create()| but with these default options: >
214 call popup_create({text}, { 215 call popup_create({what}, {
215 \ 'pos': 'center', 216 \ 'pos': 'center',
216 \ 'zindex': 200, 217 \ 'zindex': 200,
217 \ 'drag': 1, 218 \ 'drag': 1,
218 \ 'border': [], 219 \ 'border': [],
219 \ 'padding': [], 220 \ 'padding': [],
310 hidden. 311 hidden.
311 If window {id} does not exist nothing happens. If window {id} 312 If window {id} does not exist nothing happens. If window {id}
312 exists but is not a popup window an error is given. *E993* 313 exists but is not a popup window an error is given. *E993*
313 314
314 315
315 popup_menu({text}, {options}) *popup_menu()* 316 popup_menu({what}, {options}) *popup_menu()*
316 Show the {text} near the cursor, handle selecting one of the 317 Show the {what} near the cursor, handle selecting one of the
317 items with cursorkeys, and close it an item is selected with 318 items with cursorkeys, and close it an item is selected with
318 Space or Enter. {text} should have multiple lines to make this 319 Space or Enter. {what} should have multiple lines to make this
319 useful. This works like: > 320 useful. This works like: >
320 call popup_create({text}, { 321 call popup_create({what}, {
321 \ 'pos': 'center', 322 \ 'pos': 'center',
322 \ 'zindex': 200, 323 \ 'zindex': 200,
323 \ 'drag': 1, 324 \ 'drag': 1,
324 \ 'wrap': 0, 325 \ 'wrap': 0,
325 \ 'border': [], 326 \ 'border': [],
347 fixed 348 fixed
348 For {id} see `popup_hide()`. 349 For {id} see `popup_hide()`.
349 For other options see |popup_setoptions()|. 350 For other options see |popup_setoptions()|.
350 351
351 352
352 popup_notification({text}, {options}) *popup_notification()* 353 popup_notification({what}, {options}) *popup_notification()*
353 Show the {text} for 3 seconds at the top of the Vim window. 354 Show the {what} for 3 seconds at the top of the Vim window.
354 This works like: > 355 This works like: >
355 call popup_create({text}, { 356 call popup_create({what}, {
356 \ 'line': 1, 357 \ 'line': 1,
357 \ 'col': 10, 358 \ 'col': 10,
358 \ 'minwidth': 20, 359 \ 'minwidth': 20,
359 \ 'time': 3000, 360 \ 'time': 3000,
360 \ 'tabpage': -1, 361 \ 'tabpage': -1,
408 For "hidden" use |popup_hide()| and |popup_show()|. 409 For "hidden" use |popup_hide()| and |popup_show()|.
409 "tabpage" cannot be changed. 410 "tabpage" cannot be changed.
410 411
411 popup_settext({id}, {text}) *popup_settext()* 412 popup_settext({id}, {text}) *popup_settext()*
412 Set the text of the buffer in poup win {id}. {text} is the 413 Set the text of the buffer in poup win {id}. {text} is the
413 same as supplied to |popup_create()|. 414 same as supplied to |popup_create()|, except that a buffer
415 number is not allowed.
414 Does not change the window size or position, other than caused 416 Does not change the window size or position, other than caused
415 by the different text. 417 by the different text.
416 418
417 419
418 POPUP BUFFER AND WINDOW *popup-buffer* 420 POPUP BUFFER AND WINDOW *popup-buffer*
448 450
449 POPUP_CREATE() ARGUMENTS *popup_create-usage* 451 POPUP_CREATE() ARGUMENTS *popup_create-usage*
450 452
451 The first argument of |popup_create()| (and the second argument to 453 The first argument of |popup_create()| (and the second argument to
452 |popup_settext()|) specifies the text to be displayed, and optionally text 454 |popup_settext()|) specifies the text to be displayed, and optionally text
453 properties. It is in one of three forms: 455 properties. It is in one of four forms:
456 - a buffer number
454 - a string 457 - a string
455 - a list of strings 458 - a list of strings
456 - a list of dictionaries, where each dictionary has these entries: 459 - a list of dictionaries, where each dictionary has these entries:
457 text String with the text to display. 460 text String with the text to display.
458 props A list of text properties. Optional. 461 props A list of text properties. Optional.