comparison runtime/doc/popup.txt @ 16896:52fc577a087d v8.1.1449

patch 8.1.1449: popup text truncated at end of screen commit https://github.com/vim/vim/commit/042fb4b449bb5d8494698803e766dfd288b458cf Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 2 14:49:56 2019 +0200 patch 8.1.1449: popup text truncated at end of screen Problem: Popup text truncated at end of screen. Solution: Move popup left if needed. Add the "fixed" property to disable that. (Ben Jackson , closes #4466)
author Bram Moolenaar <Bram@vim.org>
date Sun, 02 Jun 2019 15:00:06 +0200
parents 5131023c5728
children 9138e2c60bf1
comparison
equal deleted inserted replaced
16895:44f703825130 16896:52fc577a087d
63 63
64 The width of the window is normally equal to the longest line in the buffer. 64 The width of the window is normally equal to the longest line in the buffer.
65 It can be limited with the "maxwidth" property. You can use spaces to 65 It can be limited with the "maxwidth" property. You can use spaces to
66 increase the width or the "minwidth" property. 66 increase the width or the "minwidth" property.
67 67
68 By default the 'wrap' option is set, so that no text disappears. However, if 68 By default the 'wrap' option is set, so that no text disappears. Otherwise,
69 there is not enough space, some text may be invisible. 69 if there is not enough space then the window is shifted left in order to
70 display more text. This can be disabled with the "fixed" property. Also
71 disabled when right-aligned.
70 72
71 Vim tries to show the popup in the location you specify. In some cases, e.g. 73 Vim tries to show the popup in the location you specify. In some cases, e.g.
72 when the popup would go outside of the Vim window, it will show it somewhere 74 when the popup would go outside of the Vim window, it will show it somewhere
73 else. E.g. if you use `popup_atcursor()` the popup normally shows just above 75 else. E.g. if you use `popup_atcursor()` the popup normally shows just above
74 the current cursor position, but if the cursor is close to the top of the Vim 76 the current cursor position, but if the cursor is close to the top of the Vim
75 window it will be placed below the cursor position. 77 window it will be placed below the cursor position.
76 78
77 79
78 80
79 TODO: 81 TODO:
80
81 Example how to use syntax highlighting of a code snippet.
82 82
83 Scrolling: When the screen scrolls up for output of an Ex command, what 83 Scrolling: When the screen scrolls up for output of an Ex command, what
84 happens with popups? 84 happens with popups?
85 1. Stay where they are. Problem: listed text may go behind and can't be read. 85 1. Stay where they are. Problem: listed text may go behind and can't be read.
86 2. Scroll with the page. What if they get updated? Either postpone, or take 86 2. Scroll with the page. What if they get updated? Either postpone, or take
91 IMPLEMENTATION: 91 IMPLEMENTATION:
92 - Code is in popupwin.c 92 - Code is in popupwin.c
93 - Fix positioning with border and padding. 93 - Fix positioning with border and padding.
94 - Why does 'nrformats' leak from the popup window buffer??? 94 - Why does 'nrformats' leak from the popup window buffer???
95 - Make redrawing more efficient and avoid flicker. 95 - Make redrawing more efficient and avoid flicker.
96 Store popup info in a mask, use the mask in screen_line() 96 First draw popups, creating a mask, use the mask in screen_line() when
97 Keep mask until next update_screen(), find differences and redraw affected 97 drawing other windows and stuff. Mask contains zindex of popups.
98 windows/lines 98 Keep mask until next update_screen(), use when drawing status lines.
99 Remove update_popup() calls after draw_tabline()/updating statusline
99 Fix redrawing problem with completion. 100 Fix redrawing problem with completion.
100 Fix redrawing problem when scrolling non-current window 101 Fix redrawing problem when scrolling non-current window
101 Fix redrawing the statusline on top of a popup
102 - Disable commands, feedkeys(), CTRL-W, etc. in a popup window. 102 - Disable commands, feedkeys(), CTRL-W, etc. in a popup window.
103 Use NOT_IN_POPUP_WINDOW for more commands. 103 Use NOT_IN_POPUP_WINDOW for more commands.
104 - Invoke filter with character before mapping? 104 - Invoke filter with character before mapping?
105 - Figure out the size and position better. 105 - Figure out the size and position better.
106 if wrapping splits a double-wide character 106 if wrapping splits a double-wide character
325 |prop_add()|, but specifying the column in the 325 |prop_add()|, but specifying the column in the
326 dictionary with a "col" entry, see below: 326 dictionary with a "col" entry, see below:
327 |popup-props|. 327 |popup-props|.
328 328
329 The second argument of |popup_create()| is a dictionary with options: 329 The second argument of |popup_create()| is a dictionary with options:
330 line screen line where to position the popup; can use a 330 line Screen line where to position the popup. Can use a
331 number or "cursor", "cursor+1" or "cursor-1" to use 331 number or "cursor", "cursor+1" or "cursor-1" to use
332 the line of the cursor and add or subtract a number of 332 the line of the cursor and add or subtract a number of
333 lines; if omitted the popup is vertically centered, 333 lines. If omitted the popup is vertically centered.
334 otherwise "pos" is used. 334 The first line is 1.
335 col screen column where to position the popup; can use a 335 col Screen column where to position the popup. Can use a
336 number or "cursor" to use the column of the cursor, 336 number or "cursor" to use the column of the cursor,
337 "cursor+99" and "cursor-99" to add or subtract a 337 "cursor+9" or "cursor-9" to add or subtract a number
338 number of columns; if omitted the popup is 338 of columns. If omitted the popup is horizontally
339 horizontally centered, otherwise "pos" is used 339 centered. The first column is 1.
340 pos "topleft", "topright", "botleft" or "botright": 340 pos "topleft", "topright", "botleft" or "botright":
341 defines what corner of the popup "line" and "col" are 341 defines what corner of the popup "line" and "col" are
342 used for. When not set "topleft" is used. 342 used for. When not set "topleft" is used.
343 Alternatively "center" can be used to position the 343 Alternatively "center" can be used to position the
344 popup in the center of the Vim window, in which case 344 popup in the center of the Vim window, in which case
345 "line" and "col" are ignored. 345 "line" and "col" are ignored.
346 flip when TRUE (the default) and the position is relative 346 fixed When FALSE (the default), and:
347 - "pos" is "botleft" or "topleft", and
348 - "wrap" is off, and
349 - the popup would be truncated at the right edge of
350 the screen, then
351 the popup is moved to the left so as to fit the
352 contents on the screen. Set to TRUE to disable this.
353 flip When TRUE (the default) and the position is relative
347 to the cursor, flip to below or above the cursor to 354 to the cursor, flip to below or above the cursor to
348 avoid overlap with the |popupmenu-completion| or 355 avoid overlap with the |popupmenu-completion| or
349 another popup with a higher "zindex" 356 another popup with a higher "zindex".
350 {not implemented yet} 357 {not implemented yet}
351 maxheight maximum height 358 maxheight Maximum height of the contents, excluding border and
352 minheight minimum height 359 padding.
353 maxwidth maximum width 360 minheight Minimum height of the contents, excluding border and
354 minwidth minimum width 361 padding.
355 hidden when TRUE the popup exists but is not displayed; use 362 maxwidth Maximum width of the contents, excluding border and
363 padding.
364 minwidth Minimum width of the contents, excluding border and
365 padding.
366 hidden When TRUE the popup exists but is not displayed; use
356 `popup_show()` to unhide it. 367 `popup_show()` to unhide it.
357 {not implemented yet} 368 {not implemented yet}
358 tab when -1: display the popup on all tabs; when 0 (the 369 tab When -1: display the popup on all tabs.
359 default): display the popup on the current tab; 370 When 0 (the default): display the popup on the current
360 otherwise the number of the tab page the popup is 371 tab.
361 displayed on; when invalid the current tab is used 372 Otherwise the number of the tab page the popup is
373 displayed on; when invalid the current tab is used.
362 {only -1 and 0 are implemented} 374 {only -1 and 0 are implemented}
363 title text to be displayed above the first item in the 375 title Text to be displayed above the first item in the
364 popup, on top of any border 376 popup, on top of any border. If there is no top
377 border on line of padding is added to put the title on.
365 {not implemented yet} 378 {not implemented yet}
366 wrap TRUE to make the lines wrap (default TRUE) 379 wrap TRUE to make the lines wrap (default TRUE).
367 highlight highlight group name to use for the text, stored in 380 highlight Highlight group name to use for the text, stored in
368 the 'wincolor' option 381 the 'wincolor' option.
369 padding list with numbers, defining the padding 382 padding List with numbers, defining the padding
370 above/right/below/left of the popup (similar to CSS); 383 above/right/below/left of the popup (similar to CSS).
371 an empty list uses a padding of 1 all around; the 384 An empty list uses a padding of 1 all around. The
372 padding goes around the text, inside any border; 385 padding goes around the text, inside any border.
373 padding uses the 'wincolor' highlight; Example: [1, 2, 386 Padding uses the 'wincolor' highlight.
374 1, 3] has 1 line of padding above, 2 columns on the 387 Example: [1, 2, 1, 3] has 1 line of padding above, 2
375 right, 1 line below and 3 columns on the left 388 columns on the right, 1 line below and 3 columns on
376 border list with numbers, defining the border thickness 389 the left.
377 above/right/below/left of the popup (similar to CSS); 390 border List with numbers, defining the border thickness
378 only values of zero and non-zero are recognized; 391 above/right/below/left of the popup (similar to CSS).
379 an empty list uses a border all around 392 Only values of zero and non-zero are recognized.
380 borderhighlight list of highlight group names to use for the border; 393 An empty list uses a border all around.
381 when one entry it is used for all borders, otherwise 394 borderhighlight List of highlight group names to use for the border.
382 the highlight for the top/right/bottom/left border 395 When one entry it is used for all borders, otherwise
383 borderchars list with characters, defining the character to use 396 the highlight for the top/right/bottom/left border.
384 for the top/right/bottom/left border; optionally 397 Example: ['TopColor', 'RightColor', 'BottomColor,
398 'LeftColor']
399 borderchars List with characters, defining the character to use
400 for the top/right/bottom/left border. Optionally
385 followed by the character to use for the 401 followed by the character to use for the
386 topleft/topright/botright/botleft corner; when the 402 topleft/topright/botright/botleft corner.
387 list has one character it is used for all; when 403 Example: ['-', '|', '-', '|', '┌', '┐', '┘', '└']
388 the list has two characters the first is used for the 404 When the list has one character it is used for all.
389 border lines, the second for the corners; by default 405 When the list has two characters the first is used for
390 a double line is used all around when 'encoding' is 406 the border lines, the second for the corners.
391 "utf-8", otherwise ASCII characters are used. 407 By default a double line is used all around when
392 zindex priority for the popup, default 50 408 'encoding' is "utf-8", otherwise ASCII characters are
393 time time in milliseconds after which the popup will close; 409 used.
394 when omitted |popup_close()| must be used. 410 zindex Priority for the popup, default 50.
411 time Time in milliseconds after which the popup will close.
412 When omitted |popup_close()| must be used.
395 moved "cell": close the popup if the cursor moved at least 413 moved "cell": close the popup if the cursor moved at least
396 one screen cell; "word" allows for moving within 414 one screen cell.
397 |<cword>|, "WORD" allows for moving within |<cWORD>|, 415 "word" allows for moving the cursor within |<cword>|
416 "WORD" allows for moving the cursor within |<cWORD>|
398 a list with two numbers specifies the start and end 417 a list with two numbers specifies the start and end
399 column 418 column outside of which the popup will close
400 {not implemented yet} 419 {not implemented yet}
401 filter a callback that can filter typed characters, see 420 filter A callback that can filter typed characters, see
402 |popup-filter| 421 |popup-filter|.
403 callback a callback to be used when the popup closes, e.g. when 422 callback A callback that is called when the popup closes, e.g.
404 using |popup_filter_menu()|, see |popup-callback|. 423 when using |popup_filter_menu()|, see |popup-callback|.
405 424
406 Depending on the "zindex" the popup goes under or above other popups. The 425 Depending on the "zindex" the popup goes under or above other popups. The
407 completion menu (|popup-menu|) has zindex 100. For messages that occur for a 426 completion menu (|popup-menu|) has zindex 100. For messages that occur for a
408 short time the suggestion is to use zindex 1000. 427 short time the suggestion is to use zindex 1000.
409 428