|
1 | | -*popup.txt* For Vim version 9.2. Last change: 2026 May 01 |
| 1 | +*popup.txt* For Vim version 9.2. Last change: 2026 May 10 |
2 | 2 |
|
3 | 3 |
|
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -712,6 +712,15 @@ The second argument of |popup_create()| is a dictionary with options: |
712 | 712 | when "textprop" is present. |
713 | 713 | textpropid Used to identify the text property when "textprop" is |
714 | 714 | present. Use zero to reset. |
| 715 | + clipwindow Only used when "textprop" is set. When TRUE the popup |
| 716 | + is kept within the window containing the text |
| 717 | + property: if the text property scrolls past that |
| 718 | + window's top, bottom, left or right edge, the popup |
| 719 | + is clipped at that edge instead of being drawn |
| 720 | + outside it. Once the text property has scrolled out |
| 721 | + of the window the popup is hidden. |
| 722 | + Default FALSE. |
| 723 | + See |popup-clipwindow|. |
715 | 724 | fixed When FALSE (the default), and: |
716 | 725 | - "pos" is "botleft" or "topleft", and |
717 | 726 | - the popup would be truncated at the right edge of |
@@ -949,6 +958,31 @@ If the window for which the popup was defined is closed, the popup is closed. |
949 | 958 | If the popup cannot fit in the desired position, it may show at a nearby |
950 | 959 | position. |
951 | 960 |
|
| 961 | + |
| 962 | +CLIP TEXTPROP POPUP TO HOST WINDOW *popup-clipwindow* |
| 963 | + |
| 964 | +When the popup is anchored to a text property in a split window, the popup is |
| 965 | +by default drawn relative to the whole screen and may extend past the edges of |
| 966 | +the window that contains the text property (the "host window"). Setting |
| 967 | +"clipwindow" to TRUE keeps the popup within window's content area: |
| 968 | +parts of the popup that fall outside the window are clipped, and the popup is |
| 969 | +hidden once the text property has scrolled entirely past one of the edges. |
| 970 | + |
| 971 | +Example: a tall popup anchored above the cursor that should never spill into |
| 972 | +the window below the split: > |
| 973 | + call popup_create(body, #{ |
| 974 | + \ textprop: 'marker', |
| 975 | + \ textpropid: id, |
| 976 | + \ pos: 'topleft', |
| 977 | + \ line: -1, col: 0, |
| 978 | + \ posinvert: v:false, |
| 979 | + \ clipwindow: v:true, |
| 980 | + \ }) |
| 981 | +< |
| 982 | +With "posinvert" left at its default (TRUE) the popup may be flipped to the |
| 983 | +opposite side of the text property when there is no room; set it to FALSE to |
| 984 | +keep the requested side and rely on "clipwindow" to clip the overflow. |
| 985 | + |
952 | 986 | Some hints: |
953 | 987 | - To avoid collision with other plugins the text property type name has to be |
954 | 988 | unique. You can also use the "bufnr" item to make it local to a buffer. |
|
0 commit comments