Mercurial > vim
comparison runtime/doc/popup.txt @ 17219:5169811b3044 v8.1.1609
patch 8.1.1609: the user cannot easily close a popup window
commit https://github.com/vim/vim/commit/2e62b568e91c36adb16dbcc609665170f09f3845
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 30 18:07:00 2019 +0200
patch 8.1.1609: the user cannot easily close a popup window
Problem: The user cannot easily close a popup window.
Solution: Add the "close" property. (mostly by Masato Nishihata,
closes #4601)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 30 Jun 2019 18:15:04 +0200 |
parents | 11f3cf51d43b |
children | 09fa437d33d8 |
comparison
equal
deleted
inserted
replaced
17218:210c4c5f783d | 17219:5169811b3044 |
---|---|
1 *popup.txt* For Vim version 8.1. Last change: 2019 Jun 29 | 1 *popup.txt* For Vim version 8.1. Last change: 2019 Jun 30 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Bram Moolenaar | 4 VIM REFERENCE MANUAL by Bram Moolenaar |
5 | 5 |
6 | 6 |
66 It can be limited with the "maxwidth" property. You can use spaces to | 66 It can be limited with the "maxwidth" property. You can use spaces to |
67 increase the width or use the "minwidth" property. | 67 increase the width or use the "minwidth" property. |
68 | 68 |
69 By default the 'wrap' option is set, so that no text disappears. Otherwise, | 69 By default the 'wrap' option is set, so that no text disappears. Otherwise, |
70 if there is not enough space then the window is shifted left in order to | 70 if there is not enough space then the window is shifted left in order to |
71 display more text. This can be disabled with the "fixed" property. Also | 71 display more text. When right-aligned the window is shifted right to display |
72 disabled when right-aligned. | 72 more text. The shifting can be disabled with the "fixed" property. |
73 | 73 |
74 Vim tries to show the popup in the location you specify. In some cases, e.g. | 74 Vim tries to show the popup in the location you specify. In some cases, e.g. |
75 when the popup would go outside of the Vim window, it will show it somewhere | 75 when the popup would go outside of the Vim window, it will show it somewhere |
76 else. E.g. if you use `popup_atcursor()` the popup normally shows just above | 76 nearby. E.g. if you use `popup_atcursor()` the popup normally shows just above |
77 the current cursor position, but if the cursor is close to the top of the Vim | 77 the current cursor position, but if the cursor is close to the top of the Vim |
78 window it will be placed below the cursor position. | 78 window it will be placed below the cursor position. |
79 | 79 |
80 When the screen scrolls up for output of an Ex command, popups move too, so | 80 When the screen scrolls up for output of an Ex command, popups move too, so |
81 that they will not cover the output. | 81 that they will not cover the output. |
82 | 82 |
83 The current cursor position is displayed even when it is under a popup window. | 83 The current cursor position is displayed even when it is under a popup window. |
84 That way you can still see where it is, even though you cannot see the text | 84 That way you can still see where it is, even though you cannot see the text |
85 that it is in. | 85 that it is in. |
86 | |
87 | |
88 CLOSING THE POPUP WINDOW *popup-close* | |
89 | |
90 Normally the plugin that created the popup window is also in charge of closing | |
91 it. If somehow a popup hangs around, you can close all of them with: > | |
92 call popup_clear() | |
93 Some popups, such as notifications, close after a specified time. This can be | |
94 set with the "time" property on `popup_create()`. | |
95 Otherwise, a popup can be closed by clicking on the X in the top-right corner | |
96 or by clicking anywhere inside the popup. This must be enabled with the | |
97 "close" property. It is set by default for notifications. | |
86 | 98 |
87 | 99 |
88 TODO: | 100 TODO: |
89 - Currently 'buftype' is set to "popup", but all the specifics are on the | 101 - Currently 'buftype' is set to "popup", but all the specifics are on the |
90 window. Can we use a "normal" buffer and put the type on the window? (#4595) | 102 window. Can we use a "normal" buffer and put the type on the window? (#4595) |
348 \ 'tabpage': -1, | 360 \ 'tabpage': -1, |
349 \ 'zindex': 300, | 361 \ 'zindex': 300, |
350 \ 'drag': 1, | 362 \ 'drag': 1, |
351 \ 'highlight': 'WarningMsg', | 363 \ 'highlight': 'WarningMsg', |
352 \ 'border': [], | 364 \ 'border': [], |
365 \ 'close': 'click', | |
353 \ 'padding': [0,1,0,1], | 366 \ 'padding': [0,1,0,1], |
354 \ }) | 367 \ }) |
355 < The PopupNotification highlight group is used instead of | 368 < The PopupNotification highlight group is used instead of |
356 WarningMsg if it is defined. | 369 WarningMsg if it is defined. |
357 | 370 |
358 This popup should only be used with the |+timers| feature, | 371 Without the |+timers| feature the poup will not disappear |
359 otherwise it will not disappear. | 372 automatically, the user has to click in it. |
360 | 373 |
361 The position will be adjusted to avoid overlap with other | 374 The position will be adjusted to avoid overlap with other |
362 notifications. | 375 notifications. |
363 Use {options} to change the properties. | 376 Use {options} to change the properties. |
364 | 377 |
369 | 382 |
370 | 383 |
371 popup_setoptions({id}, {options}) *popup_setoptions()* | 384 popup_setoptions({id}, {options}) *popup_setoptions()* |
372 Override options in popup {id} with entries in {options}. | 385 Override options in popup {id} with entries in {options}. |
373 These options can be set: | 386 These options can be set: |
387 border | |
388 borderchars | |
389 borderhighlight | |
390 callback | |
391 close | |
392 drag | |
393 filter | |
394 firstline | |
374 flip | 395 flip |
375 firstline | |
376 title | |
377 wrap | |
378 drag | |
379 highlight | 396 highlight |
397 mask | |
398 moved | |
380 padding | 399 padding |
381 border | |
382 borderhighlight | |
383 borderchars | |
384 scrollbar | 400 scrollbar |
385 scrollbarhighlight | 401 scrollbarhighlight |
386 thumbhighlight | 402 thumbhighlight |
403 time | |
404 title | |
405 wrap | |
387 zindex | 406 zindex |
388 mask | |
389 time | |
390 moved | |
391 filter | |
392 callback | |
393 The options from |popup_move()| can also be used. | 407 The options from |popup_move()| can also be used. |
394 For "hidden" use |popup_hide()| and |popup_show()|. | 408 For "hidden" use |popup_hide()| and |popup_show()|. |
395 "tabpage" cannot be changed. | 409 "tabpage" cannot be changed. |
396 | 410 |
397 popup_settext({id}, {text}) *popup_settext()* | 411 popup_settext({id}, {text}) *popup_settext()* |
507 drag TRUE to allow the popup to be dragged with the mouse | 521 drag TRUE to allow the popup to be dragged with the mouse |
508 by grabbing at at the border. Has no effect if the | 522 by grabbing at at the border. Has no effect if the |
509 popup does not have a border. As soon as dragging | 523 popup does not have a border. As soon as dragging |
510 starts and "pos" is "center" it is changed to | 524 starts and "pos" is "center" it is changed to |
511 "topleft". | 525 "topleft". |
526 close When "button" an X is displayed in the top-right, on | |
527 top of any border, padding or text. When clicked on | |
528 the X the popup will close. Any callback is invoked | |
529 with the value -2. | |
530 When "click" any mouse click in the popup will close | |
531 it. | |
532 When "none" (the default) mouse clicks do not close | |
533 the popup window. | |
512 highlight Highlight group name to use for the text, stored in | 534 highlight Highlight group name to use for the text, stored in |
513 the 'wincolor' option. | 535 the 'wincolor' option. |
514 padding List with numbers, defining the padding | 536 padding List with numbers, defining the padding |
515 above/right/below/left of the popup (similar to CSS). | 537 above/right/below/left of the popup (similar to CSS). |
516 An empty list uses a padding of 1 all around. The | 538 An empty list uses a padding of 1 all around. The |