patch 8.1.1391: no popup window support
Problem: No popup window support. Solution: Add initial code for popup windows. Add the 'wincolor' option.
This commit is contained in:
2
Filelist
2
Filelist
@ -79,6 +79,7 @@ SRC_ALL = \
|
|||||||
src/option.c \
|
src/option.c \
|
||||||
src/option.h \
|
src/option.h \
|
||||||
src/popupmnu.c \
|
src/popupmnu.c \
|
||||||
|
src/popupwin.c \
|
||||||
src/quickfix.c \
|
src/quickfix.c \
|
||||||
src/regexp.c \
|
src/regexp.c \
|
||||||
src/regexp_nfa.c \
|
src/regexp_nfa.c \
|
||||||
@ -200,6 +201,7 @@ SRC_ALL = \
|
|||||||
src/proto/ops.pro \
|
src/proto/ops.pro \
|
||||||
src/proto/option.pro \
|
src/proto/option.pro \
|
||||||
src/proto/popupmnu.pro \
|
src/proto/popupmnu.pro \
|
||||||
|
src/proto/popupwin.pro \
|
||||||
src/proto/quickfix.pro \
|
src/proto/quickfix.pro \
|
||||||
src/proto/regexp.pro \
|
src/proto/regexp.pro \
|
||||||
src/proto/screen.pro \
|
src/proto/screen.pro \
|
||||||
|
|||||||
@ -1361,6 +1361,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
prompt buffer where only the last line can be edited, meant
|
prompt buffer where only the last line can be edited, meant
|
||||||
to be used by a plugin, see |prompt-buffer|
|
to be used by a plugin, see |prompt-buffer|
|
||||||
{only when compiled with the |+channel| feature}
|
{only when compiled with the |+channel| feature}
|
||||||
|
popup buffer used in a popup window, see |popup|.
|
||||||
|
{only when compiled with the |+textprop| feature}
|
||||||
|
|
||||||
This option is used together with 'bufhidden' and 'swapfile' to
|
This option is used together with 'bufhidden' and 'swapfile' to
|
||||||
specify special kinds of buffers. See |special-buffers|.
|
specify special kinds of buffers. See |special-buffers|.
|
||||||
@ -8687,6 +8689,12 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
This option is not used for <F10>; on Win32 and with GTK <F10> will
|
This option is not used for <F10>; on Win32 and with GTK <F10> will
|
||||||
select the menu, unless it has been mapped.
|
select the menu, unless it has been mapped.
|
||||||
|
|
||||||
|
*'wincolor'* *'wcr'*
|
||||||
|
'wincolor' 'wcr' string (default empty)
|
||||||
|
local to window
|
||||||
|
Highlight group name to use for this window instead of the Normal
|
||||||
|
color |hl-Normal|.
|
||||||
|
|
||||||
*'window'* *'wi'*
|
*'window'* *'wi'*
|
||||||
'window' 'wi' number (default screen height - 1)
|
'window' 'wi' number (default screen height - 1)
|
||||||
global
|
global
|
||||||
|
|||||||
@ -27,12 +27,19 @@ popup window like with regular windows.
|
|||||||
A popup window can be used for such things as:
|
A popup window can be used for such things as:
|
||||||
- briefly show a message without changing the command line
|
- briefly show a message without changing the command line
|
||||||
- prompt the user with a dialog
|
- prompt the user with a dialog
|
||||||
- display information while typing
|
- display contextual information while typing
|
||||||
- give extra information for auto-completion
|
- give extra information for auto-completion
|
||||||
|
|
||||||
The text in the popup window can be colored with |text-properties|. It is
|
The text in the popup window can be colored with |text-properties|. It is
|
||||||
also possible to use syntax highlighting.
|
also possible to use syntax highlighting.
|
||||||
|
|
||||||
|
The default color used is "Pmenu". If you prefer something else use the
|
||||||
|
"highlight" argument or the 'wincolor' option, e.g.: >
|
||||||
|
hi MyPopupColor ctermbg=lightblue guibg=lightblue
|
||||||
|
call setwinvar(winid, '&wincolor', 'MyPopupColor')
|
||||||
|
|
||||||
|
'hlsearch' and match highlighting are not displayed in a popup window.
|
||||||
|
|
||||||
A popup window has a window-ID like other windows, but behaves differently.
|
A popup window has a window-ID like other windows, but behaves differently.
|
||||||
The size can be up to the whole Vim window and it overlaps other windows.
|
The size can be up to the whole Vim window and it overlaps other windows.
|
||||||
It contains a buffer, and that buffer is always associated with the popup
|
It contains a buffer, and that buffer is always associated with the popup
|
||||||
@ -46,6 +53,20 @@ If this is not what you are looking for, check out other popup functionality:
|
|||||||
- balloon, see |balloon-eval|
|
- balloon, see |balloon-eval|
|
||||||
|
|
||||||
|
|
||||||
|
WINDOW POSITION AND SIZE *popup-position*
|
||||||
|
|
||||||
|
The height of the window is normally equal to the number of lines in the
|
||||||
|
buffer. It can be limited with the "maxheight" property. You can use empty
|
||||||
|
lines to increase the height.
|
||||||
|
|
||||||
|
The width of the window is normally equal to the longest line in the buffer.
|
||||||
|
It can be limited with the "maxwidth" property. You can use spaces to
|
||||||
|
increase the width.
|
||||||
|
|
||||||
|
By default the 'wrap' option is set, so that no text disappears. However, if
|
||||||
|
there is not enough space, some text may be invisible.
|
||||||
|
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
|
|
||||||
Example how to use syntax highlighting of a code snippet.
|
Example how to use syntax highlighting of a code snippet.
|
||||||
@ -57,22 +78,14 @@ happens with popups?
|
|||||||
the scroll offset into account.
|
the scroll offset into account.
|
||||||
Probably 2. is the best choice.
|
Probably 2. is the best choice.
|
||||||
|
|
||||||
Positioning relative to the popup-menu to avoid overlapping with it; add a
|
|
||||||
function to get the position and size of the popup-menu.
|
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENTATION:
|
IMPLEMENTATION:
|
||||||
- Put code in popupwin.c
|
- Code is in popupwin.c
|
||||||
- Use win_update() for displaying
|
- handle screen resize in screenalloc().
|
||||||
- At first redraw all windows NOT_VALID when the popup moves or hides.
|
- Support tab-local popup windows, use tp_first_popupwin and
|
||||||
- At first always display the popup windows at the end of update_screen(),
|
first_tab_popupwin. Swap like with firstwin/curwin.
|
||||||
lowest zindex first.
|
- Make redrawing more efficient and avoid flicker.
|
||||||
- Later make it more efficient and avoid flicker
|
- implement all the unimplemented features.
|
||||||
- Use a separate list of windows, one for each tab and one global. Also put
|
|
||||||
"aucmd_win" in there.
|
|
||||||
- add optional {buf} command to execute(). Only works for a buffer that is
|
|
||||||
visible in a window in the current tab or in a popup window.
|
|
||||||
E.g. for execute('syntax enable', 'silent', bufnr)
|
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
@ -89,6 +102,7 @@ popup_create({text}, {options}) *popup_create()*
|
|||||||
- a string
|
- a string
|
||||||
- a list of strings
|
- a list of strings
|
||||||
- a list of text lines with text properties
|
- a list of text lines with text properties
|
||||||
|
{not implemented yet}
|
||||||
{options} is a dictionary with many possible entries.
|
{options} is a dictionary with many possible entries.
|
||||||
See |popup_create-usage| for details.
|
See |popup_create-usage| for details.
|
||||||
|
|
||||||
@ -98,9 +112,16 @@ popup_create({text}, {options}) *popup_create()*
|
|||||||
let winid = popup_create('hello', {})
|
let winid = popup_create('hello', {})
|
||||||
let bufnr = winbufnr(winid)
|
let bufnr = winbufnr(winid)
|
||||||
call setbufline(bufnr, 2, 'second line')
|
call setbufline(bufnr, 2, 'second line')
|
||||||
|
< In case of failure zero is returned.
|
||||||
|
|
||||||
|
|
||||||
|
popup_close({id}) *popup_close()*
|
||||||
|
Close popup {id}. The window and the associated buffer will
|
||||||
|
be deleted.
|
||||||
|
|
||||||
|
|
||||||
popup_dialog({text}, {options}) *popup_dialog()*
|
popup_dialog({text}, {options}) *popup_dialog()*
|
||||||
|
{not implemented yet}
|
||||||
Just like |popup_create()| but with these default options: >
|
Just like |popup_create()| but with these default options: >
|
||||||
call popup_create({text}, {
|
call popup_create({text}, {
|
||||||
\ 'pos': 'center',
|
\ 'pos': 'center',
|
||||||
@ -111,6 +132,7 @@ popup_dialog({text}, {options}) *popup_dialog()*
|
|||||||
|
|
||||||
|
|
||||||
popup_notification({text}, {options}) *popup_notification()*
|
popup_notification({text}, {options}) *popup_notification()*
|
||||||
|
{not implemented yet}
|
||||||
Show the {text} for 3 seconds at the top of the Vim window.
|
Show the {text} for 3 seconds at the top of the Vim window.
|
||||||
This works like: >
|
This works like: >
|
||||||
call popup_create({text}, {
|
call popup_create({text}, {
|
||||||
@ -126,6 +148,7 @@ popup_notification({text}, {options}) *popup_notification()*
|
|||||||
|
|
||||||
|
|
||||||
popup_atcursor({text}, {options}) *popup_atcursor()*
|
popup_atcursor({text}, {options}) *popup_atcursor()*
|
||||||
|
{not implemented yet}
|
||||||
Show the {text} above the cursor, and close it when the cursor
|
Show the {text} above the cursor, and close it when the cursor
|
||||||
moves. This works like: >
|
moves. This works like: >
|
||||||
call popup_create({text}, {
|
call popup_create({text}, {
|
||||||
@ -137,6 +160,7 @@ popup_atcursor({text}, {options}) *popup_atcursor()*
|
|||||||
|
|
||||||
|
|
||||||
popup_menu({text}, {options}) *popup_menu()*
|
popup_menu({text}, {options}) *popup_menu()*
|
||||||
|
{not implemented yet}
|
||||||
Show the {text} near the cursor, handle selecting one of the
|
Show the {text} near the cursor, handle selecting one of the
|
||||||
items with cursorkeys, and close it an item is selected with
|
items with cursorkeys, and close it an item is selected with
|
||||||
Space or Enter. {text} should have multiple lines to make this
|
Space or Enter. {text} should have multiple lines to make this
|
||||||
@ -153,14 +177,17 @@ popup_menu({text}, {options}) *popup_menu()*
|
|||||||
|
|
||||||
|
|
||||||
popup_show({id}) *popup_show()*
|
popup_show({id}) *popup_show()*
|
||||||
|
{not implemented yet}
|
||||||
If {id} is a hidden popup, show it now.
|
If {id} is a hidden popup, show it now.
|
||||||
|
|
||||||
popup_hide({id}) *popup_hide()*
|
popup_hide({id}) *popup_hide()*
|
||||||
|
{not implemented yet}
|
||||||
If {id} is a displayed popup, hide it now. If the popup has a
|
If {id} is a displayed popup, hide it now. If the popup has a
|
||||||
filter it will not be invoked for so long as the popup is
|
filter it will not be invoked for so long as the popup is
|
||||||
hidden.
|
hidden.
|
||||||
|
|
||||||
popup_move({id}, {options}) *popup_move()*
|
popup_move({id}, {options}) *popup_move()*
|
||||||
|
{not implemented yet}
|
||||||
Move popup {id} to the position speficied with {options}.
|
Move popup {id} to the position speficied with {options}.
|
||||||
{options} may contain the items from |popup_create()| that
|
{options} may contain the items from |popup_create()| that
|
||||||
specify the popup position: "line", "col", "pos", "maxheight",
|
specify the popup position: "line", "col", "pos", "maxheight",
|
||||||
@ -168,6 +195,7 @@ popup_move({id}, {options}) *popup_move()*
|
|||||||
|
|
||||||
|
|
||||||
popup_filter_menu({id}, {key}) *popup_filter_menu()*
|
popup_filter_menu({id}, {key}) *popup_filter_menu()*
|
||||||
|
{not implemented yet}
|
||||||
Filter that can be used for a popup. It handles the cursor
|
Filter that can be used for a popup. It handles the cursor
|
||||||
keys to move the selected index in the popup. Space and Enter
|
keys to move the selected index in the popup. Space and Enter
|
||||||
can be used to select an item. Invokes the "callback" of the
|
can be used to select an item. Invokes the "callback" of the
|
||||||
@ -176,6 +204,7 @@ popup_filter_menu({id}, {key}) *popup_filter_menu()*
|
|||||||
|
|
||||||
|
|
||||||
popup_filter_yesno({id}, {key}) *popup_filter_yesno()*
|
popup_filter_yesno({id}, {key}) *popup_filter_yesno()*
|
||||||
|
{not implemented yet}
|
||||||
Filter that can be used for a popup. It handles only the keys
|
Filter that can be used for a popup. It handles only the keys
|
||||||
'y', 'Y' and 'n' or 'N'. Invokes the "callback" of the
|
'y', 'Y' and 'n' or 'N'. Invokes the "callback" of the
|
||||||
popup menu with the 1 for 'y' or 'Y' and zero for 'n' or 'N'
|
popup menu with the 1 for 'y' or 'Y' and zero for 'n' or 'N'
|
||||||
@ -184,15 +213,31 @@ popup_filter_yesno({id}, {key}) *popup_filter_yesno()*
|
|||||||
|
|
||||||
|
|
||||||
popup_setoptions({id}, {options}) *popup_setoptions()*
|
popup_setoptions({id}, {options}) *popup_setoptions()*
|
||||||
|
{not implemented yet}
|
||||||
Override options in popup {id} with entries in {options}.
|
Override options in popup {id} with entries in {options}.
|
||||||
|
|
||||||
|
|
||||||
popup_getoptions({id}) *popup_getoptions()*
|
popup_getoptions({id}) *popup_getoptions()*
|
||||||
|
{not implemented yet}
|
||||||
Return the {options} for popup {id}.
|
Return the {options} for popup {id}.
|
||||||
|
|
||||||
|
popup_getposition({id}) *popup_getposition()*
|
||||||
|
{not implemented yet}
|
||||||
|
Return the position and size of popup {id}. Returns a Dict
|
||||||
|
with these entries:
|
||||||
|
col screen column of the popup, one-based
|
||||||
|
line screen line of the popup, one-based
|
||||||
|
width width of the popup in screen cells
|
||||||
|
height height of the popup in screen cells
|
||||||
|
|
||||||
popup_close({id}) *popup_close()*
|
win_execute({id}, {command})
|
||||||
Close popup {id}.
|
{not implemented yet}
|
||||||
|
Like `execute()` but in the context of window {id}.
|
||||||
|
The window will temporarily be made the current window,
|
||||||
|
without triggering autocommands.
|
||||||
|
Example: >
|
||||||
|
call win_execute(winid, 'syntax enable')
|
||||||
|
<
|
||||||
|
|
||||||
*:popupclear* *:popupc*
|
*:popupclear* *:popupc*
|
||||||
:popupc[lear] Emergency solution to a misbehaving plugin: close all popup
|
:popupc[lear] Emergency solution to a misbehaving plugin: close all popup
|
||||||
@ -209,6 +254,7 @@ manipulation is restricted:
|
|||||||
- 'swapfile' is off
|
- 'swapfile' is off
|
||||||
- 'bufhidden' is "hide"
|
- 'bufhidden' is "hide"
|
||||||
- 'buflisted' is off
|
- 'buflisted' is off
|
||||||
|
- 'undolevels' is -1: no undo at all
|
||||||
TODO: more
|
TODO: more
|
||||||
|
|
||||||
The window does have a cursor position, but the cursor is not displayed.
|
The window does have a cursor position, but the cursor is not displayed.
|
||||||
@ -226,6 +272,7 @@ optionally text properties. It is in one of three forms:
|
|||||||
- a string
|
- a string
|
||||||
- a list of strings
|
- a list of strings
|
||||||
- a list of dictionaries, where each dictionary has these entries:
|
- a list of dictionaries, where each dictionary has these entries:
|
||||||
|
{not implemented yet}
|
||||||
text String with the text to display.
|
text String with the text to display.
|
||||||
props A list of text properties. Optional.
|
props A list of text properties. Optional.
|
||||||
Each entry is a dictionary, like the third argument of
|
Each entry is a dictionary, like the third argument of
|
||||||
@ -238,55 +285,73 @@ The second argument of |popup_create()| is a dictionary with options:
|
|||||||
"cursor", "cursor+1" or "cursor-1" to use the line of
|
"cursor", "cursor+1" or "cursor-1" to use the line of
|
||||||
the cursor and add or subtract a number of lines;
|
the cursor and add or subtract a number of lines;
|
||||||
default is "cursor-1".
|
default is "cursor-1".
|
||||||
|
{only number is implemented}
|
||||||
col screen column where to position the popup; can use
|
col screen column where to position the popup; can use
|
||||||
"cursor" to use the column of the cursor, "cursor+99"
|
"cursor" to use the column of the cursor, "cursor+99"
|
||||||
and "cursor-99" to add or subtract a number of
|
and "cursor-99" to add or subtract a number of
|
||||||
columns; default is "cursor"
|
columns; default is "cursor"
|
||||||
|
{only number is implemented}
|
||||||
pos "topleft", "topright", "botleft" or "botright":
|
pos "topleft", "topright", "botleft" or "botright":
|
||||||
defines what corner of the popup "line" and "col" are
|
defines what corner of the popup "line" and "col" are
|
||||||
used for. Default is "botleft". Alternatively
|
used for. Default is "botleft". Alternatively
|
||||||
"center" can be used to position the popup somewhere
|
"center" can be used to position the popup in the
|
||||||
near the cursor.
|
center of the Vim window.
|
||||||
|
{not implemented yet}
|
||||||
flip when TRUE (the default) and the position is relative
|
flip when TRUE (the default) and the position is relative
|
||||||
to the cursor, flip to below or above the cursor to
|
to the cursor, flip to below or above the cursor to
|
||||||
avoid overlap with the |popupmenu-completion| or
|
avoid overlap with the |popupmenu-completion| or
|
||||||
another popup with a higher "zindex"
|
another popup with a higher "zindex"
|
||||||
|
{not implemented yet}
|
||||||
maxheight maximum height
|
maxheight maximum height
|
||||||
minheight minimum height
|
minheight minimum height
|
||||||
|
{not implemented yet}
|
||||||
maxwidth maximum width
|
maxwidth maximum width
|
||||||
minwidth minimum width
|
minwidth minimum width
|
||||||
|
{not implemented yet}
|
||||||
hidden when TRUE the popup exists but is not displayed; use
|
hidden when TRUE the popup exists but is not displayed; use
|
||||||
`popup_show()` to unhide it.
|
`popup_show()` to unhide it.
|
||||||
|
{not implemented yet}
|
||||||
tab when -1: display the popup on all tabs; when 0 (the
|
tab when -1: display the popup on all tabs; when 0 (the
|
||||||
default): display the popup on the current tab;
|
default): display the popup on the current tab;
|
||||||
otherwise the number of the tab page the popup is
|
otherwise the number of the tab page the popup is
|
||||||
displayed on; when invalid the current tab is used
|
displayed on; when invalid the current tab is used
|
||||||
|
{only -1 and 0 are implemented}
|
||||||
title text to be displayed above the first item in the
|
title text to be displayed above the first item in the
|
||||||
popup, on top of any border
|
popup, on top of any border
|
||||||
|
{not implemented yet}
|
||||||
wrap TRUE to make the lines wrap (default TRUE)
|
wrap TRUE to make the lines wrap (default TRUE)
|
||||||
highlight highlight group name to use for the text, defines the
|
{not implemented yet}
|
||||||
background and foreground color
|
highlight highlight group name to use for the text, stored in
|
||||||
|
'wincolor'
|
||||||
|
{not implemented yet}
|
||||||
border list with numbers, defining the border thickness
|
border list with numbers, defining the border thickness
|
||||||
above/right/below/left of the popup; an empty list
|
above/right/below/left of the popup; an empty list
|
||||||
uses a border of 1 all around
|
uses a border of 1 all around
|
||||||
|
{not implemented yet}
|
||||||
borderhighlight highlight group name to use for the border
|
borderhighlight highlight group name to use for the border
|
||||||
|
{not implemented yet}
|
||||||
borderchars list with characters, defining the character to use
|
borderchars list with characters, defining the character to use
|
||||||
for the top/right/bottom/left border; optionally
|
for the top/right/bottom/left border; optionally
|
||||||
followed by the character to use for the
|
followed by the character to use for the
|
||||||
topright/botright/botleft/topleft corner; an empty
|
topright/botright/botleft/topleft corner; an empty
|
||||||
list can be used to show a double line all around
|
list can be used to show a double line all around
|
||||||
|
{not implemented yet}
|
||||||
zindex priority for the popup, default 50
|
zindex priority for the popup, default 50
|
||||||
time time in milliseconds after which the popup will close;
|
time time in milliseconds after which the popup will close;
|
||||||
when omitted |popup_close()| must be used.
|
when omitted |popup_close()| must be used.
|
||||||
|
{not implemented yet}
|
||||||
moved "cell": close the popup if the cursor moved at least
|
moved "cell": close the popup if the cursor moved at least
|
||||||
one screen cell; "word" allows for moving within
|
one screen cell; "word" allows for moving within
|
||||||
|<cword>|, "WORD" allows for moving within |<cWORD>|,
|
|<cword>|, "WORD" allows for moving within |<cWORD>|,
|
||||||
a list with two numbers specifies the start and end
|
a list with two numbers specifies the start and end
|
||||||
column
|
column
|
||||||
|
{not implemented yet}
|
||||||
filter a callback that can filter typed characters, see
|
filter a callback that can filter typed characters, see
|
||||||
|popup-filter|
|
|popup-filter|
|
||||||
|
{not implemented yet}
|
||||||
callback a callback to be used when the popup closes, e.g. when
|
callback a callback to be used when the popup closes, e.g. when
|
||||||
using |popup_filter_menu()|, see |popup-callback|.
|
using |popup_filter_menu()|, see |popup-callback|.
|
||||||
|
{not implemented yet}
|
||||||
|
|
||||||
Depending on the "zindex" the popup goes under or above other popups. The
|
Depending on the "zindex" the popup goes under or above other popups. The
|
||||||
completion menu (|popup-menu|) has zindex 100. For messages that occur for a
|
completion menu (|popup-menu|) has zindex 100. For messages that occur for a
|
||||||
@ -299,6 +364,7 @@ outside of the Vim window will not be displayed, thus truncated.
|
|||||||
|
|
||||||
POPUP TEXT PROPERTIES *popup-props*
|
POPUP TEXT PROPERTIES *popup-props*
|
||||||
|
|
||||||
|
{not implemented yet}
|
||||||
These are similar to the third argument of |prop_add()|, but not exactly the
|
These are similar to the third argument of |prop_add()|, but not exactly the
|
||||||
same, since they only apply to one line.
|
same, since they only apply to one line.
|
||||||
col starting column, counted in bytes, use one for the
|
col starting column, counted in bytes, use one for the
|
||||||
@ -318,11 +384,15 @@ same, since they only apply to one line.
|
|||||||
|
|
||||||
POPUP FILTER *popup-filter*
|
POPUP FILTER *popup-filter*
|
||||||
|
|
||||||
|
{not implemented yet}
|
||||||
A callback that gets any typed keys while a popup is displayed. The filter is
|
A callback that gets any typed keys while a popup is displayed. The filter is
|
||||||
not invoked for as long as the popup is hidden.
|
not invoked when the popup is hidden.
|
||||||
|
|
||||||
The filter can return TRUE to indicate the key has been handled and is to be
|
The filter can return TRUE to indicate the key has been handled and is to be
|
||||||
discarded, or FALSE to let Vim handle the key as usual in the current state.
|
discarded, or FALSE to let Vim handle the key as usual in the current state.
|
||||||
|
In case it returns FALSE and there is another popup window visible, that
|
||||||
|
filter is also called. The filter of the popup window with the highest zindex
|
||||||
|
is called first.
|
||||||
|
|
||||||
The filter function is called with two arguments: the ID of the popup and the
|
The filter function is called with two arguments: the ID of the popup and the
|
||||||
key.
|
key.
|
||||||
@ -342,6 +412,7 @@ Vim provides standard filters |popup_filter_menu()| and
|
|||||||
|
|
||||||
POPUP CALLBACK *popup-callback*
|
POPUP CALLBACK *popup-callback*
|
||||||
|
|
||||||
|
{not implemented yet}
|
||||||
A callback that is invoked when the popup closes. Used by
|
A callback that is invoked when the popup closes. Used by
|
||||||
|popup_filter_menu()|. Invoked with two arguments: the ID of the popup and
|
|popup_filter_menu()|. Invoked with two arguments: the ID of the popup and
|
||||||
the result, which would usually be an index in the popup lines, or whatever
|
the result, which would usually be an index in the popup lines, or whatever
|
||||||
|
|||||||
@ -740,6 +740,7 @@ OBJ = \
|
|||||||
$(OUTDIR)/os_win32.o \
|
$(OUTDIR)/os_win32.o \
|
||||||
$(OUTDIR)/pathdef.o \
|
$(OUTDIR)/pathdef.o \
|
||||||
$(OUTDIR)/popupmnu.o \
|
$(OUTDIR)/popupmnu.o \
|
||||||
|
$(OUTDIR)/popupwin.o \
|
||||||
$(OUTDIR)/quickfix.o \
|
$(OUTDIR)/quickfix.o \
|
||||||
$(OUTDIR)/regexp.o \
|
$(OUTDIR)/regexp.o \
|
||||||
$(OUTDIR)/screen.o \
|
$(OUTDIR)/screen.o \
|
||||||
|
|||||||
@ -743,6 +743,8 @@ OBJ = \
|
|||||||
$(OUTDIR)\os_win32.obj \
|
$(OUTDIR)\os_win32.obj \
|
||||||
$(OUTDIR)\pathdef.obj \
|
$(OUTDIR)\pathdef.obj \
|
||||||
$(OUTDIR)\popupmnu.obj \
|
$(OUTDIR)\popupmnu.obj \
|
||||||
|
$(OUTDIR)\popupwin.obj \
|
||||||
|
$(OUTDIR)\popupwin.obj \
|
||||||
$(OUTDIR)\quickfix.obj \
|
$(OUTDIR)\quickfix.obj \
|
||||||
$(OUTDIR)\regexp.obj \
|
$(OUTDIR)\regexp.obj \
|
||||||
$(OUTDIR)\screen.obj \
|
$(OUTDIR)\screen.obj \
|
||||||
@ -1575,6 +1577,8 @@ $(OUTDIR)/pathdef.obj: $(OUTDIR) $(PATHDEF_SRC) $(INCL)
|
|||||||
|
|
||||||
$(OUTDIR)/popupmnu.obj: $(OUTDIR) popupmnu.c $(INCL)
|
$(OUTDIR)/popupmnu.obj: $(OUTDIR) popupmnu.c $(INCL)
|
||||||
|
|
||||||
|
$(OUTDIR)/popupwin.obj: $(OUTDIR) popupwin.c $(INCL)
|
||||||
|
|
||||||
$(OUTDIR)/quickfix.obj: $(OUTDIR) quickfix.c $(INCL)
|
$(OUTDIR)/quickfix.obj: $(OUTDIR) quickfix.c $(INCL)
|
||||||
|
|
||||||
$(OUTDIR)/regexp.obj: $(OUTDIR) regexp.c regexp_nfa.c $(INCL)
|
$(OUTDIR)/regexp.obj: $(OUTDIR) regexp.c regexp_nfa.c $(INCL)
|
||||||
@ -1745,6 +1749,7 @@ proto.h: \
|
|||||||
proto/winclip.pro \
|
proto/winclip.pro \
|
||||||
proto/os_win32.pro \
|
proto/os_win32.pro \
|
||||||
proto/popupmnu.pro \
|
proto/popupmnu.pro \
|
||||||
|
proto/popupwin.pro \
|
||||||
proto/quickfix.pro \
|
proto/quickfix.pro \
|
||||||
proto/regexp.pro \
|
proto/regexp.pro \
|
||||||
proto/screen.pro \
|
proto/screen.pro \
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
# Makefile for Vim on OpenVMS
|
# Makefile for Vim on OpenVMS
|
||||||
#
|
#
|
||||||
# Maintainer: Zoltan Arpadffy <arpadffy@polarhome.com>
|
# Maintainer: Zoltan Arpadffy <arpadffy@polarhome.com>
|
||||||
# Last change: 2019 May 11
|
# Last change: 2019 May 24
|
||||||
#
|
#
|
||||||
# This has script been tested on VMS 6.2 to 8.2 on DEC Alpha, VAX and IA64
|
# This has script been tested on VMS 6.2 to 8.2 on DEC Alpha, VAX and IA64
|
||||||
# with MMS and MMK
|
# with MMS and MMK
|
||||||
@ -313,7 +313,7 @@ SRC = arabic.c autocmd.c beval.c blob.c blowfish.c buffer.c change.c charset.c \
|
|||||||
if_cscope.c if_xcmdsrv.c fileio.c findfile.c fold.c getchar.c \
|
if_cscope.c if_xcmdsrv.c fileio.c findfile.c fold.c getchar.c \
|
||||||
hardcopy.c hashtab.c indent.c insexpand.c json.c list.c main.c mark.c \
|
hardcopy.c hashtab.c indent.c insexpand.c json.c list.c main.c mark.c \
|
||||||
menu.c mbyte.c memfile.c memline.c message.c misc1.c misc2.c move.c \
|
menu.c mbyte.c memfile.c memline.c message.c misc1.c misc2.c move.c \
|
||||||
normal.c ops.c option.c popupmnu.c quickfix.c regexp.c search.c \
|
normal.c ops.c option.c popupmnu.c popupwin.c, quickfix.c regexp.c search.c \
|
||||||
sha256.c sign.c spell.c spellfile.c syntax.c tag.c term.c termlib.c \
|
sha256.c sign.c spell.c spellfile.c syntax.c tag.c term.c termlib.c \
|
||||||
textprop.c ui.c undo.c usercmd.c userfunc.c version.c screen.c \
|
textprop.c ui.c undo.c usercmd.c userfunc.c version.c screen.c \
|
||||||
window.c os_unix.c os_vms.c pathdef.c \
|
window.c os_unix.c os_vms.c pathdef.c \
|
||||||
@ -327,7 +327,7 @@ OBJ = arabic.obj autocmd.obj beval.obj blob.obj blowfish.obj buffer.obj change.
|
|||||||
fileio.obj findfile.obj fold.obj getchar.obj hardcopy.obj hashtab.obj \
|
fileio.obj findfile.obj fold.obj getchar.obj hardcopy.obj hashtab.obj \
|
||||||
indent.obj insexpand.obj json.obj list.obj main.obj mark.obj \
|
indent.obj insexpand.obj json.obj list.obj main.obj mark.obj \
|
||||||
menu.obj memfile.obj memline.obj message.obj misc1.obj misc2.obj \
|
menu.obj memfile.obj memline.obj message.obj misc1.obj misc2.obj \
|
||||||
move.obj mbyte.obj normal.obj ops.obj option.obj popupmnu.obj \
|
move.obj mbyte.obj normal.obj ops.obj option.obj popupmnu.obj popupwin.obj\
|
||||||
quickfix.obj regexp.obj search.obj sha256.obj sign.obj spell.obj \
|
quickfix.obj regexp.obj search.obj sha256.obj sign.obj spell.obj \
|
||||||
spellfile.obj syntax.obj tag.obj term.obj termlib.obj textprop.obj \
|
spellfile.obj syntax.obj tag.obj term.obj termlib.obj textprop.obj \
|
||||||
ui.obj undo.obj usercmd.obj userfunc.obj screen.obj version.obj \
|
ui.obj undo.obj usercmd.obj userfunc.obj screen.obj version.obj \
|
||||||
@ -688,6 +688,10 @@ popupmnu.obj : popupmnu.c vim.h [.auto]config.h feature.h os_unix.h \
|
|||||||
ascii.h keymap.h term.h macros.h structs.h regexp.h \
|
ascii.h keymap.h term.h macros.h structs.h regexp.h \
|
||||||
gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
|
gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
|
||||||
globals.h
|
globals.h
|
||||||
|
popupwin.obj : popupwin.c vim.h [.auto]config.h feature.h os_unix.h \
|
||||||
|
ascii.h keymap.h term.h macros.h structs.h regexp.h \
|
||||||
|
gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
|
||||||
|
globals.h
|
||||||
quickfix.obj : quickfix.c vim.h [.auto]config.h feature.h os_unix.h \
|
quickfix.obj : quickfix.c vim.h [.auto]config.h feature.h os_unix.h \
|
||||||
ascii.h keymap.h term.h macros.h structs.h regexp.h \
|
ascii.h keymap.h term.h macros.h structs.h regexp.h \
|
||||||
gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
|
gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
|
||||||
|
|||||||
10
src/Makefile
10
src/Makefile
@ -1620,6 +1620,7 @@ BASIC_SRC = \
|
|||||||
os_unix.c \
|
os_unix.c \
|
||||||
auto/pathdef.c \
|
auto/pathdef.c \
|
||||||
popupmnu.c \
|
popupmnu.c \
|
||||||
|
popupwin.c \
|
||||||
pty.c \
|
pty.c \
|
||||||
quickfix.c \
|
quickfix.c \
|
||||||
regexp.c \
|
regexp.c \
|
||||||
@ -1734,6 +1735,7 @@ OBJ_COMMON = \
|
|||||||
objects/os_unix.o \
|
objects/os_unix.o \
|
||||||
objects/pathdef.o \
|
objects/pathdef.o \
|
||||||
objects/popupmnu.o \
|
objects/popupmnu.o \
|
||||||
|
objects/popupwin.o \
|
||||||
objects/pty.o \
|
objects/pty.o \
|
||||||
objects/quickfix.o \
|
objects/quickfix.o \
|
||||||
objects/regexp.o \
|
objects/regexp.o \
|
||||||
@ -1873,6 +1875,7 @@ PRO_AUTO = \
|
|||||||
os_mac_conv.pro \
|
os_mac_conv.pro \
|
||||||
os_unix.pro \
|
os_unix.pro \
|
||||||
popupmnu.pro \
|
popupmnu.pro \
|
||||||
|
popupwin.pro \
|
||||||
pty.pro \
|
pty.pro \
|
||||||
quickfix.pro \
|
quickfix.pro \
|
||||||
regexp.pro \
|
regexp.pro \
|
||||||
@ -3208,6 +3211,9 @@ objects/pathdef.o: auto/pathdef.c
|
|||||||
objects/popupmnu.o: popupmnu.c
|
objects/popupmnu.o: popupmnu.c
|
||||||
$(CCC) -o $@ popupmnu.c
|
$(CCC) -o $@ popupmnu.c
|
||||||
|
|
||||||
|
objects/popupwin.o: popupwin.c
|
||||||
|
$(CCC) -o $@ popupwin.c
|
||||||
|
|
||||||
objects/pty.o: pty.c
|
objects/pty.o: pty.c
|
||||||
$(CCC) -o $@ pty.c
|
$(CCC) -o $@ pty.c
|
||||||
|
|
||||||
@ -3612,6 +3618,10 @@ objects/popupmnu.o: popupmnu.c vim.h protodef.h auto/config.h feature.h os_unix.
|
|||||||
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
||||||
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
||||||
proto.h globals.h
|
proto.h globals.h
|
||||||
|
objects/popupwin.o: popupwin.c vim.h protodef.h auto/config.h feature.h os_unix.h \
|
||||||
|
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
||||||
|
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
||||||
|
proto.h globals.h
|
||||||
objects/pty.o: pty.c vim.h protodef.h auto/config.h feature.h os_unix.h \
|
objects/pty.o: pty.c vim.h protodef.h auto/config.h feature.h os_unix.h \
|
||||||
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
||||||
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
||||||
|
|||||||
@ -1349,7 +1349,7 @@ ex_doautoall(exarg_T *eap)
|
|||||||
*/
|
*/
|
||||||
FOR_ALL_BUFFERS(buf)
|
FOR_ALL_BUFFERS(buf)
|
||||||
{
|
{
|
||||||
if (buf->b_ml.ml_mfp != NULL)
|
if (buf->b_ml.ml_mfp != NULL && !bt_popup(buf))
|
||||||
{
|
{
|
||||||
// find a window for this buffer and save some values
|
// find a window for this buffer and save some values
|
||||||
aucmd_prepbuf(&aco, buf);
|
aucmd_prepbuf(&aco, buf);
|
||||||
@ -1423,7 +1423,7 @@ aucmd_prepbuf(
|
|||||||
// back to using the current window.
|
// back to using the current window.
|
||||||
if (win == NULL && aucmd_win == NULL)
|
if (win == NULL && aucmd_win == NULL)
|
||||||
{
|
{
|
||||||
win_alloc_aucmd_win();
|
aucmd_win = win_alloc_popup_win();
|
||||||
if (aucmd_win == NULL)
|
if (aucmd_win == NULL)
|
||||||
win = curwin;
|
win = curwin;
|
||||||
}
|
}
|
||||||
@ -1451,20 +1451,12 @@ aucmd_prepbuf(
|
|||||||
// unexpected results.
|
// unexpected results.
|
||||||
aco->use_aucmd_win = TRUE;
|
aco->use_aucmd_win = TRUE;
|
||||||
aucmd_win_used = TRUE;
|
aucmd_win_used = TRUE;
|
||||||
aucmd_win->w_buffer = buf;
|
|
||||||
#if defined(FEAT_SYN_HL) || defined(FEAT_SPELL)
|
|
||||||
aucmd_win->w_s = &buf->b_s;
|
|
||||||
#endif
|
|
||||||
++buf->b_nwindows;
|
|
||||||
win_init_empty(aucmd_win); // set cursor and topline to safe values
|
|
||||||
|
|
||||||
// Make sure w_localdir and globaldir are NULL to avoid a chdir() in
|
win_init_popup_win(aucmd_win, buf);
|
||||||
// win_enter_ext().
|
|
||||||
VIM_CLEAR(aucmd_win->w_localdir);
|
|
||||||
aco->globaldir = globaldir;
|
aco->globaldir = globaldir;
|
||||||
globaldir = NULL;
|
globaldir = NULL;
|
||||||
|
|
||||||
|
|
||||||
// Split the current window, put the aucmd_win in the upper half.
|
// Split the current window, put the aucmd_win in the upper half.
|
||||||
// We don't want the BufEnter or WinEnter autocommands.
|
// We don't want the BufEnter or WinEnter autocommands.
|
||||||
block_autocmds();
|
block_autocmds();
|
||||||
@ -1620,6 +1612,8 @@ apply_autocmds(
|
|||||||
int force, // when TRUE, ignore autocmd_busy
|
int force, // when TRUE, ignore autocmd_busy
|
||||||
buf_T *buf) // buffer for <abuf>
|
buf_T *buf) // buffer for <abuf>
|
||||||
{
|
{
|
||||||
|
if (bt_popup(buf))
|
||||||
|
return FALSE;
|
||||||
return apply_autocmds_group(event, fname, fname_io, force,
|
return apply_autocmds_group(event, fname, fname_io, force,
|
||||||
AUGROUP_ALL, buf, NULL);
|
AUGROUP_ALL, buf, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
14
src/buffer.c
14
src/buffer.c
@ -456,7 +456,7 @@ close_buffer(
|
|||||||
win_T *win, /* if not NULL, set b_last_cursor */
|
win_T *win, /* if not NULL, set b_last_cursor */
|
||||||
buf_T *buf,
|
buf_T *buf,
|
||||||
int action,
|
int action,
|
||||||
int abort_if_last UNUSED)
|
int abort_if_last)
|
||||||
{
|
{
|
||||||
int is_curbuf;
|
int is_curbuf;
|
||||||
int nwindows;
|
int nwindows;
|
||||||
@ -5678,7 +5678,17 @@ bt_help(buf_T *buf)
|
|||||||
int
|
int
|
||||||
bt_prompt(buf_T *buf)
|
bt_prompt(buf_T *buf)
|
||||||
{
|
{
|
||||||
return buf != NULL && buf->b_p_bt[0] == 'p';
|
return buf != NULL && buf->b_p_bt[0] == 'p' && buf->b_p_bt[1] == 'r';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return TRUE if "buf" is a buffer for a popup window.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
bt_popup(buf_T *buf)
|
||||||
|
{
|
||||||
|
return buf != NULL && buf->b_p_bt != NULL
|
||||||
|
&& buf->b_p_bt[0] == 'p' && buf->b_p_bt[1] == 'o';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
26
src/eval.c
26
src/eval.c
@ -5585,6 +5585,19 @@ garbage_collect(int testing)
|
|||||||
if (aucmd_win != NULL)
|
if (aucmd_win != NULL)
|
||||||
abort = abort || set_ref_in_item(&aucmd_win->w_winvar.di_tv, copyID,
|
abort = abort || set_ref_in_item(&aucmd_win->w_winvar.di_tv, copyID,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
#ifdef FEAT_TEXT_PROP
|
||||||
|
for (wp = first_popupwin; wp != NULL; wp = wp->w_next)
|
||||||
|
abort = abort || set_ref_in_item(&wp->w_winvar.di_tv, copyID,
|
||||||
|
NULL, NULL);
|
||||||
|
for (wp = first_tab_popupwin; wp != NULL; wp = wp->w_next)
|
||||||
|
abort = abort || set_ref_in_item(&wp->w_winvar.di_tv, copyID,
|
||||||
|
NULL, NULL);
|
||||||
|
FOR_ALL_TABPAGES(tp)
|
||||||
|
if (tp != curtab)
|
||||||
|
for (wp = tp->tp_first_popupwin; wp != NULL; wp = wp->w_next)
|
||||||
|
abort = abort || set_ref_in_item(&wp->w_winvar.di_tv, copyID,
|
||||||
|
NULL, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* tabpage-local variables */
|
/* tabpage-local variables */
|
||||||
FOR_ALL_TABPAGES(tp)
|
FOR_ALL_TABPAGES(tp)
|
||||||
@ -8801,7 +8814,20 @@ find_win_by_nr(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (nr >= LOWEST_WIN_ID)
|
if (nr >= LOWEST_WIN_ID)
|
||||||
|
{
|
||||||
|
#ifdef FEAT_TEXT_PROP
|
||||||
|
// popup windows are in a separate list
|
||||||
|
for (wp = (tp == NULL || tp == curtab)
|
||||||
|
? first_tab_popupwin : tp->tp_first_popupwin;
|
||||||
|
wp != NULL; wp = wp->w_next)
|
||||||
|
if (wp->w_id == nr)
|
||||||
|
return wp;
|
||||||
|
for (wp = first_popupwin; wp != NULL; wp = wp->w_next)
|
||||||
|
if (wp->w_id == nr)
|
||||||
|
return wp;
|
||||||
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
return wp;
|
return wp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -807,6 +807,10 @@ static struct fst
|
|||||||
#ifdef FEAT_PERL
|
#ifdef FEAT_PERL
|
||||||
{"perleval", 1, 1, f_perleval},
|
{"perleval", 1, 1, f_perleval},
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef FEAT_TEXT_PROP
|
||||||
|
{"popup_close", 1, 1, f_popup_close},
|
||||||
|
{"popup_create", 2, 2, f_popup_create},
|
||||||
|
#endif
|
||||||
#ifdef FEAT_FLOAT
|
#ifdef FEAT_FLOAT
|
||||||
{"pow", 2, 2, f_pow},
|
{"pow", 2, 2, f_pow},
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -21,16 +21,16 @@ static const unsigned short cmdidxs1[26] =
|
|||||||
/* n */ 285,
|
/* n */ 285,
|
||||||
/* o */ 305,
|
/* o */ 305,
|
||||||
/* p */ 317,
|
/* p */ 317,
|
||||||
/* q */ 356,
|
/* q */ 357,
|
||||||
/* r */ 359,
|
/* r */ 360,
|
||||||
/* s */ 379,
|
/* s */ 380,
|
||||||
/* t */ 447,
|
/* t */ 448,
|
||||||
/* u */ 492,
|
/* u */ 493,
|
||||||
/* v */ 503,
|
/* v */ 504,
|
||||||
/* w */ 521,
|
/* w */ 522,
|
||||||
/* x */ 535,
|
/* x */ 536,
|
||||||
/* y */ 545,
|
/* y */ 546,
|
||||||
/* z */ 546
|
/* z */ 547
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -56,7 +56,7 @@ static const unsigned char cmdidxs2[26][26] =
|
|||||||
/* m */ { 1, 0, 0, 0, 7, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 },
|
/* m */ { 1, 0, 0, 0, 7, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16 },
|
||||||
/* n */ { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 10, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0 },
|
/* n */ { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 10, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0 },
|
||||||
/* o */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 5, 0, 0, 0, 0, 0, 0, 9, 0, 11, 0, 0, 0 },
|
/* o */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 5, 0, 0, 0, 0, 0, 0, 9, 0, 11, 0, 0, 0 },
|
||||||
/* p */ { 1, 0, 3, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 0, 0, 16, 17, 26, 0, 27, 0, 28, 0 },
|
/* p */ { 1, 0, 3, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 10, 0, 0, 17, 18, 27, 0, 28, 0, 29, 0 },
|
||||||
/* q */ { 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
/* q */ { 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||||
/* r */ { 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 19, 0, 0, 0, 0 },
|
/* r */ { 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 19, 0, 0, 0, 0 },
|
||||||
/* s */ { 2, 6, 15, 0, 19, 23, 0, 25, 26, 0, 0, 29, 31, 35, 39, 41, 0, 49, 0, 50, 0, 62, 63, 0, 64, 0 },
|
/* s */ { 2, 6, 15, 0, 19, 23, 0, 25, 26, 0, 0, 29, 31, 35, 39, 41, 0, 49, 0, 50, 0, 62, 63, 0, 64, 0 },
|
||||||
@ -69,4 +69,4 @@ static const unsigned char cmdidxs2[26][26] =
|
|||||||
/* z */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
/* z */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int command_count = 559;
|
static const int command_count = 560;
|
||||||
|
|||||||
@ -1091,6 +1091,9 @@ EX(CMD_pop, "pop", ex_tag,
|
|||||||
EX(CMD_popup, "popup", ex_popup,
|
EX(CMD_popup, "popup", ex_popup,
|
||||||
NEEDARG|EXTRA|BANG|TRLBAR|NOTRLCOM|CMDWIN,
|
NEEDARG|EXTRA|BANG|TRLBAR|NOTRLCOM|CMDWIN,
|
||||||
ADDR_NONE),
|
ADDR_NONE),
|
||||||
|
EX(CMD_popupclear, "popupclear", ex_popupclear,
|
||||||
|
TRLBAR,
|
||||||
|
ADDR_NONE),
|
||||||
EX(CMD_ppop, "ppop", ex_ptag,
|
EX(CMD_ppop, "ppop", ex_ptag,
|
||||||
RANGE|BANG|COUNT|TRLBAR|ZEROR,
|
RANGE|BANG|COUNT|TRLBAR|ZEROR,
|
||||||
ADDR_OTHER),
|
ADDR_OTHER),
|
||||||
|
|||||||
@ -477,7 +477,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +textprop Text properties
|
* +textprop Text properties and popup windows
|
||||||
*/
|
*/
|
||||||
#if defined(FEAT_EVAL) && defined(FEAT_SYN_HL)
|
#if defined(FEAT_EVAL) && defined(FEAT_SYN_HL)
|
||||||
# define FEAT_TEXT_PROP
|
# define FEAT_TEXT_PROP
|
||||||
|
|||||||
@ -550,9 +550,10 @@ EXTERN int clip_unnamed_saved INIT(= 0);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* All windows are linked in a list. firstwin points to the first entry,
|
* All regular windows are linked in a list. "firstwin" points to the first
|
||||||
* lastwin to the last entry (can be the same as firstwin) and curwin to the
|
* entry, "lastwin" to the last entry (can be the same as firstwin) and
|
||||||
* currently active window.
|
* "curwin" to the currently active window.
|
||||||
|
* When switching tabs these swapped with the pointers in "tabpage_T".
|
||||||
*/
|
*/
|
||||||
EXTERN win_T *firstwin; /* first window */
|
EXTERN win_T *firstwin; /* first window */
|
||||||
EXTERN win_T *lastwin; /* last window */
|
EXTERN win_T *lastwin; /* last window */
|
||||||
@ -580,6 +581,11 @@ EXTERN win_T *curwin; /* currently active window */
|
|||||||
EXTERN win_T *aucmd_win; /* window used in aucmd_prepbuf() */
|
EXTERN win_T *aucmd_win; /* window used in aucmd_prepbuf() */
|
||||||
EXTERN int aucmd_win_used INIT(= FALSE); /* aucmd_win is being used */
|
EXTERN int aucmd_win_used INIT(= FALSE); /* aucmd_win is being used */
|
||||||
|
|
||||||
|
#ifdef FEAT_TEXT_PROP
|
||||||
|
EXTERN win_T *first_tab_popupwin; // first popup window local to tab page
|
||||||
|
EXTERN win_T *first_popupwin; // first global popup window
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The window layout is kept in a tree of frames. topframe points to the top
|
* The window layout is kept in a tree of frames. topframe points to the top
|
||||||
* of the tree.
|
* of the tree.
|
||||||
|
|||||||
11
src/option.c
11
src/option.c
@ -196,6 +196,7 @@
|
|||||||
# define PV_BRI OPT_WIN(WV_BRI)
|
# define PV_BRI OPT_WIN(WV_BRI)
|
||||||
# define PV_BRIOPT OPT_WIN(WV_BRIOPT)
|
# define PV_BRIOPT OPT_WIN(WV_BRIOPT)
|
||||||
#endif
|
#endif
|
||||||
|
# define PV_WCR OPT_WIN(WV_WCR)
|
||||||
#ifdef FEAT_DIFF
|
#ifdef FEAT_DIFF
|
||||||
# define PV_DIFF OPT_WIN(WV_DIFF)
|
# define PV_DIFF OPT_WIN(WV_DIFF)
|
||||||
#endif
|
#endif
|
||||||
@ -3033,6 +3034,10 @@ static struct vimoption options[] =
|
|||||||
{(char_u *)NULL, (char_u *)0L}
|
{(char_u *)NULL, (char_u *)0L}
|
||||||
#endif
|
#endif
|
||||||
SCTX_INIT},
|
SCTX_INIT},
|
||||||
|
{"wincolor", "wcr", P_STRING|P_ALLOCED|P_VI_DEF|P_RWIN,
|
||||||
|
(char_u *)VAR_WIN, PV_WCR,
|
||||||
|
{(char_u *)"", (char_u *)NULL}
|
||||||
|
SCTX_INIT},
|
||||||
{"window", "wi", P_NUM|P_VI_DEF,
|
{"window", "wi", P_NUM|P_VI_DEF,
|
||||||
(char_u *)&p_window, PV_NONE,
|
(char_u *)&p_window, PV_NONE,
|
||||||
{(char_u *)0L, (char_u *)0L} SCTX_INIT},
|
{(char_u *)0L, (char_u *)0L} SCTX_INIT},
|
||||||
@ -3211,7 +3216,7 @@ static char *(p_bsdir_values[]) = {"current", "last", "buffer", NULL};
|
|||||||
static char *(p_scbopt_values[]) = {"ver", "hor", "jump", NULL};
|
static char *(p_scbopt_values[]) = {"ver", "hor", "jump", NULL};
|
||||||
static char *(p_debug_values[]) = {"msg", "throw", "beep", NULL};
|
static char *(p_debug_values[]) = {"msg", "throw", "beep", NULL};
|
||||||
static char *(p_ead_values[]) = {"both", "ver", "hor", NULL};
|
static char *(p_ead_values[]) = {"both", "ver", "hor", NULL};
|
||||||
static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", "terminal", "acwrite", "prompt", NULL};
|
static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", "terminal", "acwrite", "prompt", "popup", NULL};
|
||||||
static char *(p_bufhidden_values[]) = {"hide", "unload", "delete", "wipe", NULL};
|
static char *(p_bufhidden_values[]) = {"hide", "unload", "delete", "wipe", NULL};
|
||||||
static char *(p_bs_values[]) = {"indent", "eol", "start", NULL};
|
static char *(p_bs_values[]) = {"indent", "eol", "start", NULL};
|
||||||
#ifdef FEAT_FOLDING
|
#ifdef FEAT_FOLDING
|
||||||
@ -10940,6 +10945,7 @@ get_varp(struct vimoption *p)
|
|||||||
case PV_BRI: return (char_u *)&(curwin->w_p_bri);
|
case PV_BRI: return (char_u *)&(curwin->w_p_bri);
|
||||||
case PV_BRIOPT: return (char_u *)&(curwin->w_p_briopt);
|
case PV_BRIOPT: return (char_u *)&(curwin->w_p_briopt);
|
||||||
#endif
|
#endif
|
||||||
|
case PV_WCR: return (char_u *)&(curwin->w_p_wcr);
|
||||||
case PV_SCBIND: return (char_u *)&(curwin->w_p_scb);
|
case PV_SCBIND: return (char_u *)&(curwin->w_p_scb);
|
||||||
case PV_CRBIND: return (char_u *)&(curwin->w_p_crb);
|
case PV_CRBIND: return (char_u *)&(curwin->w_p_crb);
|
||||||
#ifdef FEAT_CONCEAL
|
#ifdef FEAT_CONCEAL
|
||||||
@ -11124,6 +11130,7 @@ copy_winopt(winopt_T *from, winopt_T *to)
|
|||||||
to->wo_bri = from->wo_bri;
|
to->wo_bri = from->wo_bri;
|
||||||
to->wo_briopt = vim_strsave(from->wo_briopt);
|
to->wo_briopt = vim_strsave(from->wo_briopt);
|
||||||
#endif
|
#endif
|
||||||
|
to->wo_wcr = vim_strsave(from->wo_wcr);
|
||||||
to->wo_scb = from->wo_scb;
|
to->wo_scb = from->wo_scb;
|
||||||
to->wo_scb_save = from->wo_scb_save;
|
to->wo_scb_save = from->wo_scb_save;
|
||||||
to->wo_crb = from->wo_crb;
|
to->wo_crb = from->wo_crb;
|
||||||
@ -11221,6 +11228,7 @@ check_winopt(winopt_T *wop UNUSED)
|
|||||||
#ifdef FEAT_LINEBREAK
|
#ifdef FEAT_LINEBREAK
|
||||||
check_string_option(&wop->wo_briopt);
|
check_string_option(&wop->wo_briopt);
|
||||||
#endif
|
#endif
|
||||||
|
check_string_option(&wop->wo_wcr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -11245,6 +11253,7 @@ clear_winopt(winopt_T *wop UNUSED)
|
|||||||
#ifdef FEAT_LINEBREAK
|
#ifdef FEAT_LINEBREAK
|
||||||
clear_string_option(&wop->wo_briopt);
|
clear_string_option(&wop->wo_briopt);
|
||||||
#endif
|
#endif
|
||||||
|
clear_string_option(&wop->wo_wcr);
|
||||||
#ifdef FEAT_RIGHTLEFT
|
#ifdef FEAT_RIGHTLEFT
|
||||||
clear_string_option(&wop->wo_rlc);
|
clear_string_option(&wop->wo_rlc);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -1116,6 +1116,7 @@ enum
|
|||||||
, WV_BRI
|
, WV_BRI
|
||||||
, WV_BRIOPT
|
, WV_BRIOPT
|
||||||
#endif
|
#endif
|
||||||
|
, WV_WCR
|
||||||
#ifdef FEAT_DIFF
|
#ifdef FEAT_DIFF
|
||||||
, WV_DIFF
|
, WV_DIFF
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
231
src/popupwin.c
Normal file
231
src/popupwin.c
Normal file
@ -0,0 +1,231 @@
|
|||||||
|
/* vi:set ts=8 sts=4 sw=4 noet:
|
||||||
|
*
|
||||||
|
* VIM - Vi IMproved by Bram Moolenaar
|
||||||
|
*
|
||||||
|
* Do ":help uganda" in Vim to read a list of people who contributed.
|
||||||
|
* Do ":help credits" in Vim to see a list of people who contributed.
|
||||||
|
* See README.txt for an overview of the Vim source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Implementation of popup windows. See ":help popup".
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "vim.h"
|
||||||
|
|
||||||
|
#ifdef FEAT_TEXT_PROP
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Go through the options in "dict" and apply them to buffer "buf" displayed in
|
||||||
|
* popup window "wp".
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
apply_options(win_T *wp, buf_T *buf UNUSED, dict_T *dict)
|
||||||
|
{
|
||||||
|
wp->w_maxwidth = dict_get_number(dict, (char_u *)"maxwidth");
|
||||||
|
wp->w_maxheight = dict_get_number(dict, (char_u *)"maxheight");
|
||||||
|
wp->w_winrow = dict_get_number(dict, (char_u *)"line");
|
||||||
|
wp->w_wincol = dict_get_number(dict, (char_u *)"col");
|
||||||
|
wp->w_zindex = dict_get_number(dict, (char_u *)"zindex");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* popup_create({text}, {options})
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
f_popup_create(typval_T *argvars, typval_T *rettv)
|
||||||
|
{
|
||||||
|
win_T *wp;
|
||||||
|
buf_T *buf;
|
||||||
|
dict_T *d;
|
||||||
|
int nr;
|
||||||
|
|
||||||
|
// Check arguments look OK.
|
||||||
|
if (!(argvars[0].v_type == VAR_STRING
|
||||||
|
&& argvars[0].vval.v_string != NULL
|
||||||
|
&& STRLEN(argvars[0].vval.v_string) > 0)
|
||||||
|
&& !(argvars[0].v_type == VAR_LIST
|
||||||
|
&& argvars[0].vval.v_list != NULL
|
||||||
|
&& argvars[0].vval.v_list->lv_len > 0))
|
||||||
|
{
|
||||||
|
emsg(_(e_listreq));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (argvars[1].v_type != VAR_DICT || argvars[1].vval.v_dict == NULL)
|
||||||
|
{
|
||||||
|
emsg(_(e_dictreq));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
d = argvars[1].vval.v_dict;
|
||||||
|
|
||||||
|
// Create the window and buffer.
|
||||||
|
wp = win_alloc_popup_win();
|
||||||
|
if (wp == NULL)
|
||||||
|
return;
|
||||||
|
rettv->vval.v_number = wp->w_id;
|
||||||
|
wp->w_p_wrap = TRUE; // 'wrap' is default on
|
||||||
|
|
||||||
|
buf = buflist_new(NULL, NULL, (linenr_T)0, BLN_NEW|BLN_LISTED|BLN_DUMMY);
|
||||||
|
if (buf == NULL)
|
||||||
|
return;
|
||||||
|
ml_open(buf);
|
||||||
|
curbuf = buf;
|
||||||
|
set_string_option_direct((char_u *)"buftype", -1,
|
||||||
|
(char_u *)"popup", OPT_FREE|OPT_LOCAL, 0);
|
||||||
|
set_string_option_direct((char_u *)"bufhidden", -1,
|
||||||
|
(char_u *)"hide", OPT_FREE|OPT_LOCAL, 0);
|
||||||
|
curbuf = curwin->w_buffer;
|
||||||
|
buf->b_p_ul = -1; // no undo
|
||||||
|
buf->b_p_swf = FALSE; // no swap file
|
||||||
|
buf->b_p_bl = FALSE; // unlisted buffer
|
||||||
|
|
||||||
|
win_init_popup_win(wp, buf);
|
||||||
|
|
||||||
|
nr = (int)dict_get_number(d, (char_u *)"tab");
|
||||||
|
if (nr == 0)
|
||||||
|
{
|
||||||
|
// popup on current tab
|
||||||
|
wp->w_next = first_tab_popupwin;
|
||||||
|
first_tab_popupwin = wp;
|
||||||
|
}
|
||||||
|
else if (nr < 0)
|
||||||
|
{
|
||||||
|
// global popup
|
||||||
|
wp->w_next = first_popupwin;
|
||||||
|
first_popupwin = wp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
// TODO: find tab page "nr"
|
||||||
|
emsg("Not implemented yet");
|
||||||
|
|
||||||
|
// Add text to the buffer.
|
||||||
|
if (argvars[0].v_type == VAR_STRING)
|
||||||
|
// just a string
|
||||||
|
ml_append_buf(buf, 0, argvars[0].vval.v_string, (colnr_T)0, TRUE);
|
||||||
|
else if (argvars[0].vval.v_list->lv_first->li_tv.v_type == VAR_STRING)
|
||||||
|
{
|
||||||
|
listitem_T *li;
|
||||||
|
linenr_T lnum = 0;
|
||||||
|
char_u *p;
|
||||||
|
|
||||||
|
// list of strings
|
||||||
|
for (li = argvars[0].vval.v_list->lv_first; li != NULL;
|
||||||
|
li = li->li_next)
|
||||||
|
if (li->li_tv.v_type == VAR_STRING)
|
||||||
|
{
|
||||||
|
p = li->li_tv.vval.v_string;
|
||||||
|
ml_append_buf(buf, lnum++,
|
||||||
|
p == NULL ? (char_u *)"" : p, (colnr_T)0, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
// TODO: handle a list of dictionaries
|
||||||
|
emsg("Not implemented yet");
|
||||||
|
|
||||||
|
// Delete the line of the empty buffer.
|
||||||
|
curbuf = buf;
|
||||||
|
ml_delete(buf->b_ml.ml_line_count, FALSE);
|
||||||
|
curbuf = curwin->w_buffer;
|
||||||
|
|
||||||
|
// Deal with options.
|
||||||
|
apply_options(wp, buf, argvars[1].vval.v_dict);
|
||||||
|
|
||||||
|
// set default values
|
||||||
|
if (wp->w_zindex == 0)
|
||||||
|
wp->w_zindex = 50;
|
||||||
|
|
||||||
|
// TODO: Compute the size and position properly.
|
||||||
|
|
||||||
|
// Default position is in middle of the screen, assuming a small popup
|
||||||
|
if (wp->w_winrow == 0)
|
||||||
|
wp->w_winrow = Rows > 5 ? Rows / 2 - 2 : 0;
|
||||||
|
else
|
||||||
|
--wp->w_winrow; // option value is one-based
|
||||||
|
if (wp->w_wincol == 0)
|
||||||
|
wp->w_wincol = Columns > 20 ? Columns / 2 - 10 : 0;
|
||||||
|
else
|
||||||
|
--wp->w_wincol; // option value is one-based
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: set width based on longest text line and the 'wrap' option
|
||||||
|
wp->w_width = wp->w_maxwidth == 0 ? 20 : wp->w_maxwidth;
|
||||||
|
if (wp->w_maxwidth > 0 && wp->w_width > wp->w_maxwidth)
|
||||||
|
wp->w_width = wp->w_maxwidth;
|
||||||
|
if (wp->w_width > Columns - wp->w_wincol)
|
||||||
|
wp->w_width = Columns - wp->w_wincol;
|
||||||
|
|
||||||
|
// TODO: adjust height for wrapped lines
|
||||||
|
wp->w_height = buf->b_ml.ml_line_count;
|
||||||
|
if (wp->w_maxheight > 0 && wp->w_height > wp->w_maxheight)
|
||||||
|
wp->w_height = wp->w_maxheight;
|
||||||
|
if (wp->w_height > Rows - wp->w_winrow)
|
||||||
|
wp->w_height = Rows - wp->w_winrow;
|
||||||
|
|
||||||
|
wp->w_vsep_width = 0;
|
||||||
|
|
||||||
|
redraw_all_later(NOT_VALID);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* popup_close({id})
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
f_popup_close(typval_T *argvars, typval_T *rettv UNUSED)
|
||||||
|
{
|
||||||
|
int nr = (int)tv_get_number(argvars);
|
||||||
|
|
||||||
|
popup_close(nr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
popup_close(int nr)
|
||||||
|
{
|
||||||
|
win_T *wp;
|
||||||
|
win_T *prev = NULL;
|
||||||
|
|
||||||
|
for (wp = first_popupwin; wp != NULL; prev = wp, wp = wp->w_next)
|
||||||
|
if (wp->w_id == nr)
|
||||||
|
{
|
||||||
|
if (prev == NULL)
|
||||||
|
first_popupwin = wp->w_next;
|
||||||
|
else
|
||||||
|
prev->w_next = wp->w_next;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wp == NULL)
|
||||||
|
{
|
||||||
|
prev = NULL;
|
||||||
|
for (wp = first_tab_popupwin; wp != NULL; prev = wp, wp = wp->w_next)
|
||||||
|
if (wp->w_id == nr)
|
||||||
|
{
|
||||||
|
if (prev == NULL)
|
||||||
|
first_tab_popupwin = wp->w_next;
|
||||||
|
else
|
||||||
|
prev->w_next = wp->w_next;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (wp != NULL)
|
||||||
|
{
|
||||||
|
win_free_popup(wp);
|
||||||
|
redraw_all_later(NOT_VALID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
close_all_popups(void)
|
||||||
|
{
|
||||||
|
while (first_popupwin != NULL)
|
||||||
|
popup_close(first_popupwin->w_id);
|
||||||
|
while (first_tab_popupwin != NULL)
|
||||||
|
popup_close(first_tab_popupwin->w_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ex_popupclear(exarg_T *eap UNUSED)
|
||||||
|
{
|
||||||
|
close_all_popups();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // FEAT_TEXT_PROP
|
||||||
@ -195,6 +195,7 @@ void qsort(void *base, size_t elm_count, size_t elm_size, int (*cmp)(const void
|
|||||||
# include "termlib.pro"
|
# include "termlib.pro"
|
||||||
# endif
|
# endif
|
||||||
# ifdef FEAT_TEXT_PROP
|
# ifdef FEAT_TEXT_PROP
|
||||||
|
# include "popupwin.pro"
|
||||||
# include "textprop.pro"
|
# include "textprop.pro"
|
||||||
# endif
|
# endif
|
||||||
# include "ui.pro"
|
# include "ui.pro"
|
||||||
|
|||||||
@ -61,6 +61,7 @@ int bt_quickfix(buf_T *buf);
|
|||||||
int bt_terminal(buf_T *buf);
|
int bt_terminal(buf_T *buf);
|
||||||
int bt_help(buf_T *buf);
|
int bt_help(buf_T *buf);
|
||||||
int bt_prompt(buf_T *buf);
|
int bt_prompt(buf_T *buf);
|
||||||
|
int bt_popup(buf_T *buf);
|
||||||
int bt_nofile(buf_T *buf);
|
int bt_nofile(buf_T *buf);
|
||||||
int bt_dontwrite(buf_T *buf);
|
int bt_dontwrite(buf_T *buf);
|
||||||
int bt_dontwrite_msg(buf_T *buf);
|
int bt_dontwrite_msg(buf_T *buf);
|
||||||
|
|||||||
7
src/proto/popupwin.pro
Normal file
7
src/proto/popupwin.pro
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
/* popupwin.c */
|
||||||
|
void f_popup_create(typval_T *argvars, typval_T *rettv);
|
||||||
|
void f_popup_close(typval_T *argvars, typval_T *rettv);
|
||||||
|
void popup_close(int nr);
|
||||||
|
void close_all_popups(void);
|
||||||
|
void ex_popupclear(exarg_T *eap);
|
||||||
|
/* vim: set ft=c : */
|
||||||
@ -19,7 +19,8 @@ void close_others(int message, int forceit);
|
|||||||
void curwin_init(void);
|
void curwin_init(void);
|
||||||
void win_init_empty(win_T *wp);
|
void win_init_empty(win_T *wp);
|
||||||
int win_alloc_first(void);
|
int win_alloc_first(void);
|
||||||
void win_alloc_aucmd_win(void);
|
win_T *win_alloc_popup_win(void);
|
||||||
|
void win_init_popup_win(win_T *wp, buf_T *buf);
|
||||||
void win_init_size(void);
|
void win_init_size(void);
|
||||||
void free_tabpage(tabpage_T *tp);
|
void free_tabpage(tabpage_T *tp);
|
||||||
int win_new_tabpage(int after);
|
int win_new_tabpage(int after);
|
||||||
@ -42,6 +43,8 @@ win_T *win_horz_neighbor(tabpage_T *tp, win_T *wp, int left, long count);
|
|||||||
void win_enter(win_T *wp, int undo_sync);
|
void win_enter(win_T *wp, int undo_sync);
|
||||||
win_T *buf_jump_open_win(buf_T *buf);
|
win_T *buf_jump_open_win(buf_T *buf);
|
||||||
win_T *buf_jump_open_tab(buf_T *buf);
|
win_T *buf_jump_open_tab(buf_T *buf);
|
||||||
|
int win_unlisted(win_T *wp);
|
||||||
|
void win_free_popup(win_T *win);
|
||||||
void win_append(win_T *after, win_T *wp);
|
void win_append(win_T *after, win_T *wp);
|
||||||
void win_remove(win_T *wp, tabpage_T *tp);
|
void win_remove(win_T *wp, tabpage_T *tp);
|
||||||
int win_alloc_lines(win_T *wp);
|
int win_alloc_lines(win_T *wp);
|
||||||
|
|||||||
167
src/screen.c
167
src/screen.c
@ -121,6 +121,9 @@ static int redrawing_for_callback = 0;
|
|||||||
*/
|
*/
|
||||||
static schar_T *current_ScreenLine;
|
static schar_T *current_ScreenLine;
|
||||||
|
|
||||||
|
#ifdef FEAT_TEXT_PROP
|
||||||
|
static void update_popups(void);
|
||||||
|
#endif
|
||||||
static void win_update(win_T *wp);
|
static void win_update(win_T *wp);
|
||||||
static void win_redr_status(win_T *wp, int ignore_pum);
|
static void win_redr_status(win_T *wp, int ignore_pum);
|
||||||
static void win_draw_end(win_T *wp, int c1, int c2, int draw_margin, int row, int endrow, hlf_T hl);
|
static void win_draw_end(win_T *wp, int c1, int c2, int draw_margin, int row, int endrow, hlf_T hl);
|
||||||
@ -178,6 +181,10 @@ static int screen_char_attr = 0;
|
|||||||
# define HAS_RIGHTLEFT(x) FALSE
|
# define HAS_RIGHTLEFT(x) FALSE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// flags for screen_line()
|
||||||
|
#define SLF_RIGHTLEFT 1
|
||||||
|
#define SLF_POPUP 2
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Redraw the current window later, with update_screen(type).
|
* Redraw the current window later, with update_screen(type).
|
||||||
* Set must_redraw only if not already set to a higher value.
|
* Set must_redraw only if not already set to a higher value.
|
||||||
@ -406,7 +413,7 @@ redraw_asap(int type)
|
|||||||
mch_memmove(ScreenLines2 + off,
|
mch_memmove(ScreenLines2 + off,
|
||||||
screenline2 + r * cols,
|
screenline2 + r * cols,
|
||||||
(size_t)cols * sizeof(schar_T));
|
(size_t)cols * sizeof(schar_T));
|
||||||
screen_line(cmdline_row + r, 0, cols, cols, FALSE);
|
screen_line(cmdline_row + r, 0, cols, cols, 0);
|
||||||
}
|
}
|
||||||
ret = 4;
|
ret = 4;
|
||||||
}
|
}
|
||||||
@ -604,6 +611,11 @@ update_screen(int type_arg)
|
|||||||
curwin->w_lines_valid = 0; /* don't use w_lines[].wl_size now */
|
curwin->w_lines_valid = 0; /* don't use w_lines[].wl_size now */
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
#ifdef FEAT_TEXT_PROP
|
||||||
|
// TODO: avoid redrawing everything when there is a popup window.
|
||||||
|
if (first_popupwin != NULL || first_tab_popupwin != NULL)
|
||||||
|
type = NOT_VALID;
|
||||||
|
#endif
|
||||||
|
|
||||||
updating_screen = TRUE;
|
updating_screen = TRUE;
|
||||||
#ifdef FEAT_SYN_HL
|
#ifdef FEAT_SYN_HL
|
||||||
@ -811,6 +823,11 @@ update_screen(int type_arg)
|
|||||||
maybe_intro_message();
|
maybe_intro_message();
|
||||||
did_intro = TRUE;
|
did_intro = TRUE;
|
||||||
|
|
||||||
|
#ifdef FEAT_TEXT_PROP
|
||||||
|
// Display popup windows on top of the others.
|
||||||
|
update_popups();
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
/* Redraw the cursor and update the scrollbars when all screen updating is
|
/* Redraw the cursor and update the scrollbars when all screen updating is
|
||||||
* done. */
|
* done. */
|
||||||
@ -975,6 +992,50 @@ update_debug_sign(buf_T *buf, linenr_T lnum)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef FEAT_TEXT_PROP
|
||||||
|
static void
|
||||||
|
update_popups(void)
|
||||||
|
{
|
||||||
|
win_T *wp;
|
||||||
|
win_T *lowest_wp;
|
||||||
|
int lowest_zindex;
|
||||||
|
|
||||||
|
// Reset all the VALID_POPUP flags.
|
||||||
|
for (wp = first_popupwin; wp != NULL; wp = wp->w_next)
|
||||||
|
wp->w_valid &= ~VALID_POPUP;
|
||||||
|
for (wp = first_tab_popupwin; wp != NULL; wp = wp->w_next)
|
||||||
|
wp->w_valid &= ~VALID_POPUP;
|
||||||
|
|
||||||
|
// TODO: don't redraw every popup every time.
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
// Find the window with the lowest zindex that hasn't been updated yet,
|
||||||
|
// so that the window with a higher zindex is drawn later, thus goes on
|
||||||
|
// top.
|
||||||
|
lowest_zindex = INT_MAX;
|
||||||
|
lowest_wp = NULL;
|
||||||
|
for (wp = first_popupwin; wp != NULL; wp = wp->w_next)
|
||||||
|
if ((wp->w_valid & VALID_POPUP) == 0
|
||||||
|
&& wp->w_zindex < lowest_zindex)
|
||||||
|
{
|
||||||
|
lowest_zindex = wp->w_zindex;
|
||||||
|
lowest_wp = wp;
|
||||||
|
}
|
||||||
|
for (wp = first_tab_popupwin; wp != NULL; wp = wp->w_next)
|
||||||
|
if ((wp->w_valid & VALID_POPUP) == 0
|
||||||
|
&& wp->w_zindex < lowest_zindex)
|
||||||
|
{
|
||||||
|
lowest_zindex = wp->w_zindex;
|
||||||
|
lowest_wp = wp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lowest_wp == NULL)
|
||||||
|
break;
|
||||||
|
win_update(lowest_wp);
|
||||||
|
lowest_wp->w_valid |= VALID_POPUP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(FEAT_GUI) || defined(PROTO)
|
#if defined(FEAT_GUI) || defined(PROTO)
|
||||||
/*
|
/*
|
||||||
@ -2862,7 +2923,7 @@ fold_line(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
screen_line(row + W_WINROW(wp), wp->w_wincol, (int)wp->w_width,
|
screen_line(row + W_WINROW(wp), wp->w_wincol, (int)wp->w_width,
|
||||||
(int)wp->w_width, FALSE);
|
(int)wp->w_width, 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update w_cline_height and w_cline_folded if the cursor line was
|
* Update w_cline_height and w_cline_folded if the cursor line was
|
||||||
@ -3046,7 +3107,8 @@ win_line(
|
|||||||
int attr_pri = FALSE; /* char_attr has priority */
|
int attr_pri = FALSE; /* char_attr has priority */
|
||||||
int area_highlighting = FALSE; /* Visual or incsearch highlighting
|
int area_highlighting = FALSE; /* Visual or incsearch highlighting
|
||||||
in this line */
|
in this line */
|
||||||
int attr = 0; /* attributes for area highlighting */
|
int vi_attr = 0; /* attributes for Visual and incsearch
|
||||||
|
highlighting */
|
||||||
int area_attr = 0; /* attributes desired by highlighting */
|
int area_attr = 0; /* attributes desired by highlighting */
|
||||||
int search_attr = 0; /* attributes desired by 'hlsearch' */
|
int search_attr = 0; /* attributes desired by 'hlsearch' */
|
||||||
#ifdef FEAT_SYN_HL
|
#ifdef FEAT_SYN_HL
|
||||||
@ -3127,8 +3189,8 @@ win_line(
|
|||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_TERMINAL
|
#ifdef FEAT_TERMINAL
|
||||||
int get_term_attr = FALSE;
|
int get_term_attr = FALSE;
|
||||||
int term_attr = 0; /* background for terminal window */
|
|
||||||
#endif
|
#endif
|
||||||
|
int win_attr = 0; // background for whole window
|
||||||
|
|
||||||
/* draw_state: items that are drawn in sequence: */
|
/* draw_state: items that are drawn in sequence: */
|
||||||
#define WL_START 0 /* nothing done yet */
|
#define WL_START 0 /* nothing done yet */
|
||||||
@ -3164,6 +3226,7 @@ win_line(
|
|||||||
int feedback_col = 0;
|
int feedback_col = 0;
|
||||||
int feedback_old_attr = -1;
|
int feedback_old_attr = -1;
|
||||||
#endif
|
#endif
|
||||||
|
int screen_line_flags = 0;
|
||||||
|
|
||||||
#ifdef FEAT_CONCEAL
|
#ifdef FEAT_CONCEAL
|
||||||
int syntax_flags = 0;
|
int syntax_flags = 0;
|
||||||
@ -3244,7 +3307,7 @@ win_line(
|
|||||||
{
|
{
|
||||||
extra_check = TRUE;
|
extra_check = TRUE;
|
||||||
get_term_attr = TRUE;
|
get_term_attr = TRUE;
|
||||||
term_attr = term_get_attr(wp->w_buffer, lnum, -1);
|
win_attr = term_get_attr(wp->w_buffer, lnum, -1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -3362,13 +3425,13 @@ win_line(
|
|||||||
if (fromcol >= 0)
|
if (fromcol >= 0)
|
||||||
{
|
{
|
||||||
area_highlighting = TRUE;
|
area_highlighting = TRUE;
|
||||||
attr = HL_ATTR(HLF_V);
|
vi_attr = HL_ATTR(HLF_V);
|
||||||
#if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
|
#if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
|
||||||
if ((clip_star.available && !clip_star.owned
|
if ((clip_star.available && !clip_star.owned
|
||||||
&& clip_isautosel_star())
|
&& clip_isautosel_star())
|
||||||
|| (clip_plus.available && !clip_plus.owned
|
|| (clip_plus.available && !clip_plus.owned
|
||||||
&& clip_isautosel_plus()))
|
&& clip_isautosel_plus()))
|
||||||
attr = HL_ATTR(HLF_VNC);
|
vi_attr = HL_ATTR(HLF_VNC);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3398,7 +3461,7 @@ win_line(
|
|||||||
if (fromcol == tocol)
|
if (fromcol == tocol)
|
||||||
tocol = fromcol + 1;
|
tocol = fromcol + 1;
|
||||||
area_highlighting = TRUE;
|
area_highlighting = TRUE;
|
||||||
attr = HL_ATTR(HLF_I);
|
vi_attr = HL_ATTR(HLF_I);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3497,6 +3560,30 @@ win_line(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (*wp->w_p_wcr != NUL)
|
||||||
|
{
|
||||||
|
int attr = syn_name2attr(wp->w_p_wcr);
|
||||||
|
|
||||||
|
// 'wincolor' highlighting for the whole window
|
||||||
|
if (attr != 0)
|
||||||
|
{
|
||||||
|
win_attr = attr;
|
||||||
|
area_highlighting = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#ifdef FEAT_TEXT_PROP
|
||||||
|
if (bt_popup(wp->w_buffer))
|
||||||
|
{
|
||||||
|
screen_line_flags |= SLF_POPUP;
|
||||||
|
|
||||||
|
if (win_attr == 0)
|
||||||
|
{
|
||||||
|
win_attr = HL_ATTR(HLF_PNI);
|
||||||
|
area_highlighting = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 'nowrap' or 'wrap' and a single line that doesn't fit: Advance to the
|
* 'nowrap' or 'wrap' and a single line that doesn't fit: Advance to the
|
||||||
* first character to be displayed.
|
* first character to be displayed.
|
||||||
@ -3630,10 +3717,12 @@ win_line(
|
|||||||
/*
|
/*
|
||||||
* Handle highlighting the last used search pattern and matches.
|
* Handle highlighting the last used search pattern and matches.
|
||||||
* Do this for both search_hl and the match list.
|
* Do this for both search_hl and the match list.
|
||||||
|
* Not in a popup window.
|
||||||
*/
|
*/
|
||||||
cur = wp->w_match_head;
|
cur = wp->w_match_head;
|
||||||
shl_flag = FALSE;
|
shl_flag = FALSE;
|
||||||
while ((cur != NULL || shl_flag == FALSE) && !number_only)
|
while ((cur != NULL || shl_flag == FALSE) && !number_only
|
||||||
|
&& !(screen_line_flags & SLF_POPUP))
|
||||||
{
|
{
|
||||||
if (shl_flag == FALSE)
|
if (shl_flag == FALSE)
|
||||||
{
|
{
|
||||||
@ -3729,6 +3818,7 @@ win_line(
|
|||||||
|
|
||||||
off = (unsigned)(current_ScreenLine - ScreenLines);
|
off = (unsigned)(current_ScreenLine - ScreenLines);
|
||||||
col = 0;
|
col = 0;
|
||||||
|
|
||||||
#ifdef FEAT_RIGHTLEFT
|
#ifdef FEAT_RIGHTLEFT
|
||||||
if (wp->w_p_rl)
|
if (wp->w_p_rl)
|
||||||
{
|
{
|
||||||
@ -3737,6 +3827,7 @@ win_line(
|
|||||||
* rightmost column of the window. */
|
* rightmost column of the window. */
|
||||||
col = wp->w_width - 1;
|
col = wp->w_width - 1;
|
||||||
off += col;
|
off += col;
|
||||||
|
screen_line_flags |= SLF_RIGHTLEFT;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -4048,7 +4139,7 @@ win_line(
|
|||||||
char_attr = saved_char_attr;
|
char_attr = saved_char_attr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
char_attr = 0;
|
char_attr = win_attr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4064,7 +4155,7 @@ win_line(
|
|||||||
|| (number_only && draw_state > WL_NR))
|
|| (number_only && draw_state > WL_NR))
|
||||||
{
|
{
|
||||||
screen_line(screen_row, wp->w_wincol, col, -(int)wp->w_width,
|
screen_line(screen_row, wp->w_wincol, col, -(int)wp->w_width,
|
||||||
HAS_RIGHTLEFT(wp->w_p_rl));
|
screen_line_flags);
|
||||||
/* Pretend we have finished updating the window. Except when
|
/* Pretend we have finished updating the window. Except when
|
||||||
* 'cursorcolumn' is set. */
|
* 'cursorcolumn' is set. */
|
||||||
#ifdef FEAT_SYN_HL
|
#ifdef FEAT_SYN_HL
|
||||||
@ -4089,7 +4180,7 @@ win_line(
|
|||||||
|| ((int)vcol_prev == fromcol_prev
|
|| ((int)vcol_prev == fromcol_prev
|
||||||
&& vcol_prev < vcol /* not at margin */
|
&& vcol_prev < vcol /* not at margin */
|
||||||
&& vcol < tocol))
|
&& vcol < tocol))
|
||||||
area_attr = attr; /* start highlighting */
|
area_attr = vi_attr; /* start highlighting */
|
||||||
else if (area_attr != 0
|
else if (area_attr != 0
|
||||||
&& (vcol == tocol
|
&& (vcol == tocol
|
||||||
|| (noinvcur && (colnr_T)vcol == wp->w_virtcol)))
|
|| (noinvcur && (colnr_T)vcol == wp->w_virtcol)))
|
||||||
@ -4344,6 +4435,8 @@ win_line(
|
|||||||
char_attr = 0;
|
char_attr = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (char_attr == 0)
|
||||||
|
char_attr = win_attr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the next character to put on the screen.
|
* Get the next character to put on the screen.
|
||||||
@ -4672,9 +4765,15 @@ win_line(
|
|||||||
{
|
{
|
||||||
wp->w_s->b_syn_error = TRUE;
|
wp->w_s->b_syn_error = TRUE;
|
||||||
has_syntax = FALSE;
|
has_syntax = FALSE;
|
||||||
|
syntax_attr = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
did_emsg = save_did_emsg;
|
did_emsg = save_did_emsg;
|
||||||
|
|
||||||
|
// combine syntax attribute with 'wincolor'
|
||||||
|
if (win_attr != 0)
|
||||||
|
syntax_attr = hl_combine_attr(win_attr, syntax_attr);
|
||||||
|
|
||||||
#ifdef SYN_TIME_LIMIT
|
#ifdef SYN_TIME_LIMIT
|
||||||
if (wp->w_s->b_syn_slow)
|
if (wp->w_s->b_syn_slow)
|
||||||
has_syntax = FALSE;
|
has_syntax = FALSE;
|
||||||
@ -5149,7 +5248,7 @@ win_line(
|
|||||||
diff_hlf != (hlf_T)0 ||
|
diff_hlf != (hlf_T)0 ||
|
||||||
# endif
|
# endif
|
||||||
# ifdef FEAT_TERMINAL
|
# ifdef FEAT_TERMINAL
|
||||||
term_attr != 0 ||
|
win_attr != 0 ||
|
||||||
# endif
|
# endif
|
||||||
line_attr != 0
|
line_attr != 0
|
||||||
) && (
|
) && (
|
||||||
@ -5178,7 +5277,7 @@ win_line(
|
|||||||
if (diff_hlf == HLF_TXD)
|
if (diff_hlf == HLF_TXD)
|
||||||
{
|
{
|
||||||
diff_hlf = HLF_CHD;
|
diff_hlf = HLF_CHD;
|
||||||
if (attr == 0 || char_attr != attr)
|
if (vi_attr == 0 || char_attr != vi_attr)
|
||||||
{
|
{
|
||||||
char_attr = HL_ATTR(diff_hlf);
|
char_attr = HL_ATTR(diff_hlf);
|
||||||
if (wp->w_p_cul && lnum == wp->w_cursor.lnum)
|
if (wp->w_p_cul && lnum == wp->w_cursor.lnum)
|
||||||
@ -5188,9 +5287,9 @@ win_line(
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
# ifdef FEAT_TERMINAL
|
# ifdef FEAT_TERMINAL
|
||||||
if (term_attr != 0)
|
if (win_attr != 0)
|
||||||
{
|
{
|
||||||
char_attr = term_attr;
|
char_attr = win_attr;
|
||||||
if (wp->w_p_cul && lnum == wp->w_cursor.lnum)
|
if (wp->w_p_cul && lnum == wp->w_cursor.lnum)
|
||||||
char_attr = hl_combine_attr(char_attr,
|
char_attr = hl_combine_attr(char_attr,
|
||||||
HL_ATTR(HLF_CUL));
|
HL_ATTR(HLF_CUL));
|
||||||
@ -5550,7 +5649,8 @@ win_line(
|
|||||||
&& (int)wp->w_virtcol <
|
&& (int)wp->w_virtcol <
|
||||||
wp->w_width * (row - startrow + 1) + v
|
wp->w_width * (row - startrow + 1) + v
|
||||||
&& lnum != wp->w_cursor.lnum)
|
&& lnum != wp->w_cursor.lnum)
|
||||||
|| draw_color_col)
|
|| draw_color_col
|
||||||
|
|| win_attr != 0)
|
||||||
# ifdef FEAT_RIGHTLEFT
|
# ifdef FEAT_RIGHTLEFT
|
||||||
&& !wp->w_p_rl
|
&& !wp->w_p_rl
|
||||||
# endif
|
# endif
|
||||||
@ -5582,9 +5682,9 @@ win_line(
|
|||||||
else if (draw_color_col && VCOL_HLC == *color_cols)
|
else if (draw_color_col && VCOL_HLC == *color_cols)
|
||||||
ScreenAttrs[off++] = HL_ATTR(HLF_MC);
|
ScreenAttrs[off++] = HL_ATTR(HLF_MC);
|
||||||
else
|
else
|
||||||
ScreenAttrs[off++] = 0;
|
ScreenAttrs[off++] = win_attr;
|
||||||
|
|
||||||
if (VCOL_HLC >= rightmost_vcol)
|
if (VCOL_HLC >= rightmost_vcol && win_attr == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
++vcol;
|
++vcol;
|
||||||
@ -5593,7 +5693,7 @@ win_line(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
screen_line(screen_row, wp->w_wincol, col,
|
screen_line(screen_row, wp->w_wincol, col,
|
||||||
(int)wp->w_width, HAS_RIGHTLEFT(wp->w_p_rl));
|
(int)wp->w_width, screen_line_flags);
|
||||||
row++;
|
row++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -5893,11 +5993,11 @@ win_line(
|
|||||||
{
|
{
|
||||||
#ifdef FEAT_CONCEAL
|
#ifdef FEAT_CONCEAL
|
||||||
screen_line(screen_row, wp->w_wincol, col - boguscols,
|
screen_line(screen_row, wp->w_wincol, col - boguscols,
|
||||||
(int)wp->w_width, HAS_RIGHTLEFT(wp->w_p_rl));
|
(int)wp->w_width, screen_line_flags);
|
||||||
boguscols = 0;
|
boguscols = 0;
|
||||||
#else
|
#else
|
||||||
screen_line(screen_row, wp->w_wincol, col,
|
screen_line(screen_row, wp->w_wincol, col,
|
||||||
(int)wp->w_width, HAS_RIGHTLEFT(wp->w_p_rl));
|
(int)wp->w_width, screen_line_flags);
|
||||||
#endif
|
#endif
|
||||||
++row;
|
++row;
|
||||||
++screen_row;
|
++screen_row;
|
||||||
@ -6107,7 +6207,9 @@ screen_get_current_line_off()
|
|||||||
* "endcol" gives the columns where valid characters are.
|
* "endcol" gives the columns where valid characters are.
|
||||||
* "clear_width" is the width of the window. It's > 0 if the rest of the line
|
* "clear_width" is the width of the window. It's > 0 if the rest of the line
|
||||||
* needs to be cleared, negative otherwise.
|
* needs to be cleared, negative otherwise.
|
||||||
* "rlflag" is TRUE in a rightleft window:
|
* "flags" can have bits:
|
||||||
|
* SLF_POPUP popup window
|
||||||
|
* SLF_RIGHTLEFT rightleft window:
|
||||||
* When TRUE and "clear_width" > 0, clear columns 0 to "endcol"
|
* When TRUE and "clear_width" > 0, clear columns 0 to "endcol"
|
||||||
* When FALSE and "clear_width" > 0, clear columns "endcol" to "clear_width"
|
* When FALSE and "clear_width" > 0, clear columns "endcol" to "clear_width"
|
||||||
*/
|
*/
|
||||||
@ -6117,7 +6219,7 @@ screen_line(
|
|||||||
int coloff,
|
int coloff,
|
||||||
int endcol,
|
int endcol,
|
||||||
int clear_width,
|
int clear_width,
|
||||||
int rlflag UNUSED)
|
int flags UNUSED)
|
||||||
{
|
{
|
||||||
unsigned off_from;
|
unsigned off_from;
|
||||||
unsigned off_to;
|
unsigned off_to;
|
||||||
@ -6153,7 +6255,7 @@ screen_line(
|
|||||||
max_off_to = LineOffset[row] + screen_Columns;
|
max_off_to = LineOffset[row] + screen_Columns;
|
||||||
|
|
||||||
#ifdef FEAT_RIGHTLEFT
|
#ifdef FEAT_RIGHTLEFT
|
||||||
if (rlflag)
|
if (flags & SLF_RIGHTLEFT)
|
||||||
{
|
{
|
||||||
/* Clear rest first, because it's left of the text. */
|
/* Clear rest first, because it's left of the text. */
|
||||||
if (clear_width > 0)
|
if (clear_width > 0)
|
||||||
@ -6377,7 +6479,7 @@ screen_line(
|
|||||||
|
|
||||||
if (clear_width > 0
|
if (clear_width > 0
|
||||||
#ifdef FEAT_RIGHTLEFT
|
#ifdef FEAT_RIGHTLEFT
|
||||||
&& !rlflag
|
&& !(flags & SLF_RIGHTLEFT)
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -6444,10 +6546,15 @@ screen_line(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clear_width > 0)
|
if (clear_width > 0
|
||||||
|
#ifdef FEAT_TEXT_PROP
|
||||||
|
&& !(flags & SLF_POPUP) // no separator for popup window
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
/* For a window that's left of another, draw the separator char. */
|
// For a window that has a right neighbor, draw the separator char
|
||||||
if (col + coloff < Columns)
|
// right of the window contents.
|
||||||
|
if (coloff + col < Columns)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
@ -10784,7 +10891,7 @@ redraw_win_toolbar(win_T *wp)
|
|||||||
wp->w_winbar_items[item_idx].wb_menu = NULL; /* end marker */
|
wp->w_winbar_items[item_idx].wb_menu = NULL; /* end marker */
|
||||||
|
|
||||||
screen_line(wp->w_winrow, wp->w_wincol, (int)wp->w_width,
|
screen_line(wp->w_winrow, wp->w_wincol, (int)wp->w_width,
|
||||||
(int)wp->w_width, FALSE);
|
(int)wp->w_width, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -163,17 +163,19 @@ typedef struct
|
|||||||
{
|
{
|
||||||
#ifdef FEAT_ARABIC
|
#ifdef FEAT_ARABIC
|
||||||
int wo_arab;
|
int wo_arab;
|
||||||
# define w_p_arab w_onebuf_opt.wo_arab /* 'arabic' */
|
# define w_p_arab w_onebuf_opt.wo_arab // 'arabic'
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_LINEBREAK
|
#ifdef FEAT_LINEBREAK
|
||||||
int wo_bri;
|
int wo_bri;
|
||||||
# define w_p_bri w_onebuf_opt.wo_bri /* 'breakindent' */
|
# define w_p_bri w_onebuf_opt.wo_bri // 'breakindent'
|
||||||
char_u *wo_briopt;
|
char_u *wo_briopt;
|
||||||
# define w_p_briopt w_onebuf_opt.wo_briopt /* 'breakindentopt' */
|
# define w_p_briopt w_onebuf_opt.wo_briopt // 'breakindentopt'
|
||||||
#endif
|
#endif
|
||||||
|
char_u *wo_wcr;
|
||||||
|
# define w_p_wcr w_onebuf_opt.wo_wcr // 'wincolor'
|
||||||
#ifdef FEAT_DIFF
|
#ifdef FEAT_DIFF
|
||||||
int wo_diff;
|
int wo_diff;
|
||||||
# define w_p_diff w_onebuf_opt.wo_diff /* 'diff' */
|
# define w_p_diff w_onebuf_opt.wo_diff // 'diff'
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_FOLDING
|
#ifdef FEAT_FOLDING
|
||||||
long wo_fdc;
|
long wo_fdc;
|
||||||
@ -2592,19 +2594,22 @@ struct diffblock_S
|
|||||||
typedef struct tabpage_S tabpage_T;
|
typedef struct tabpage_S tabpage_T;
|
||||||
struct tabpage_S
|
struct tabpage_S
|
||||||
{
|
{
|
||||||
tabpage_T *tp_next; /* next tabpage or NULL */
|
tabpage_T *tp_next; // next tabpage or NULL
|
||||||
frame_T *tp_topframe; /* topframe for the windows */
|
frame_T *tp_topframe; // topframe for the windows
|
||||||
win_T *tp_curwin; /* current window in this Tab page */
|
win_T *tp_curwin; // current window in this Tab page
|
||||||
win_T *tp_prevwin; /* previous window in this Tab page */
|
win_T *tp_prevwin; // previous window in this Tab page
|
||||||
win_T *tp_firstwin; /* first window in this Tab page */
|
win_T *tp_firstwin; // first window in this Tab page
|
||||||
win_T *tp_lastwin; /* last window in this Tab page */
|
win_T *tp_lastwin; // last window in this Tab page
|
||||||
long tp_old_Rows; /* Rows when Tab page was left */
|
#ifdef FEAT_TEXT_PROP
|
||||||
long tp_old_Columns; /* Columns when Tab page was left */
|
win_T *tp_first_popupwin; // first popup window in this Tab page
|
||||||
long tp_ch_used; /* value of 'cmdheight' when frame size
|
#endif
|
||||||
was set */
|
long tp_old_Rows; // Rows when Tab page was left
|
||||||
|
long tp_old_Columns; // Columns when Tab page was left
|
||||||
|
long tp_ch_used; // value of 'cmdheight' when frame size
|
||||||
|
// was set
|
||||||
#ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
int tp_prev_which_scrollbars[3];
|
int tp_prev_which_scrollbars[3];
|
||||||
/* previous value of which_scrollbars */
|
// previous value of which_scrollbars
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char_u *tp_localdir; // absolute path of local directory or
|
char_u *tp_localdir; // absolute path of local directory or
|
||||||
@ -2615,18 +2620,18 @@ struct tabpage_S
|
|||||||
int tp_diff_invalid; // list of diffs is outdated
|
int tp_diff_invalid; // list of diffs is outdated
|
||||||
int tp_diff_update; // update diffs before redrawing
|
int tp_diff_update; // update diffs before redrawing
|
||||||
#endif
|
#endif
|
||||||
frame_T *(tp_snapshot[SNAP_COUNT]); /* window layout snapshots */
|
frame_T *(tp_snapshot[SNAP_COUNT]); // window layout snapshots
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
dictitem_T tp_winvar; /* variable for "t:" Dictionary */
|
dictitem_T tp_winvar; // variable for "t:" Dictionary
|
||||||
dict_T *tp_vars; /* internal variables, local to tab page */
|
dict_T *tp_vars; // internal variables, local to tab page
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_PYTHON
|
#ifdef FEAT_PYTHON
|
||||||
void *tp_python_ref; /* The Python value for this tab page */
|
void *tp_python_ref; // The Python value for this tab page
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_PYTHON3
|
#ifdef FEAT_PYTHON3
|
||||||
void *tp_python3_ref; /* The Python value for this tab page */
|
void *tp_python3_ref; // The Python value for this tab page
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2775,15 +2780,15 @@ struct window_S
|
|||||||
{
|
{
|
||||||
int w_id; /* unique window ID */
|
int w_id; /* unique window ID */
|
||||||
|
|
||||||
buf_T *w_buffer; /* buffer we are a window into (used
|
buf_T *w_buffer; /* buffer we are a window into */
|
||||||
often, keep it the first item!) */
|
|
||||||
|
win_T *w_prev; /* link to previous window */
|
||||||
|
win_T *w_next; /* link to next window */
|
||||||
|
|
||||||
#if defined(FEAT_SYN_HL) || defined(FEAT_SPELL)
|
#if defined(FEAT_SYN_HL) || defined(FEAT_SPELL)
|
||||||
synblock_T *w_s; /* for :ownsyntax */
|
synblock_T *w_s; /* for :ownsyntax */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
win_T *w_prev; /* link to previous window */
|
|
||||||
win_T *w_next; /* link to next window */
|
|
||||||
int w_closing; /* window is being closed, don't let
|
int w_closing; /* window is being closed, don't let
|
||||||
autocommands close it too. */
|
autocommands close it too. */
|
||||||
|
|
||||||
@ -2847,6 +2852,11 @@ struct window_S
|
|||||||
int w_width; /* Width of window, excluding separation. */
|
int w_width; /* Width of window, excluding separation. */
|
||||||
int w_vsep_width; /* Number of separator columns (0 or 1). */
|
int w_vsep_width; /* Number of separator columns (0 or 1). */
|
||||||
pos_save_T w_save_cursor; /* backup of cursor pos and topline */
|
pos_save_T w_save_cursor; /* backup of cursor pos and topline */
|
||||||
|
#ifdef FEAT_TEXT_PROP
|
||||||
|
int w_zindex;
|
||||||
|
int w_maxheight; // "maxheight" for popup window
|
||||||
|
int w_maxwidth; // "maxwidth" for popup window
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -3257,7 +3257,7 @@ update_system_term(term_T *term)
|
|||||||
else
|
else
|
||||||
pos.col = 0;
|
pos.col = 0;
|
||||||
|
|
||||||
screen_line(term->tl_toprow + pos.row, 0, pos.col, Columns, FALSE);
|
screen_line(term->tl_toprow + pos.row, 0, pos.col, Columns, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
term->tl_dirty_row_start = MAX_ROW;
|
term->tl_dirty_row_start = MAX_ROW;
|
||||||
@ -3368,7 +3368,7 @@ term_update_window(win_T *wp)
|
|||||||
#ifdef FEAT_MENU
|
#ifdef FEAT_MENU
|
||||||
+ winbar_height(wp)
|
+ winbar_height(wp)
|
||||||
#endif
|
#endif
|
||||||
, wp->w_wincol, pos.col, wp->w_width, FALSE);
|
, wp->w_wincol, pos.col, wp->w_width, 0);
|
||||||
}
|
}
|
||||||
term->tl_dirty_row_start = MAX_ROW;
|
term->tl_dirty_row_start = MAX_ROW;
|
||||||
term->tl_dirty_row_end = 0;
|
term->tl_dirty_row_end = 0;
|
||||||
|
|||||||
@ -196,6 +196,7 @@ NEW_TESTS = \
|
|||||||
test_perl \
|
test_perl \
|
||||||
test_plus_arg_edit \
|
test_plus_arg_edit \
|
||||||
test_popup \
|
test_popup \
|
||||||
|
test_popupwin \
|
||||||
test_preview \
|
test_preview \
|
||||||
test_profile \
|
test_profile \
|
||||||
test_prompt_buffer \
|
test_prompt_buffer \
|
||||||
@ -250,8 +251,8 @@ NEW_TESTS = \
|
|||||||
test_tagjump \
|
test_tagjump \
|
||||||
test_taglist \
|
test_taglist \
|
||||||
test_tcl \
|
test_tcl \
|
||||||
test_termencoding \
|
|
||||||
test_termcodes \
|
test_termcodes \
|
||||||
|
test_termencoding \
|
||||||
test_terminal \
|
test_terminal \
|
||||||
test_terminal_fail \
|
test_terminal_fail \
|
||||||
test_textformat \
|
test_textformat \
|
||||||
@ -377,6 +378,7 @@ NEW_TESTS_RES = \
|
|||||||
test_paste.res \
|
test_paste.res \
|
||||||
test_perl.res \
|
test_perl.res \
|
||||||
test_plus_arg_edit.res \
|
test_plus_arg_edit.res \
|
||||||
|
test_popupwin.res \
|
||||||
test_preview.res \
|
test_preview.res \
|
||||||
test_profile.res \
|
test_profile.res \
|
||||||
test_prompt_buffer.res \
|
test_prompt_buffer.res \
|
||||||
@ -409,8 +411,8 @@ NEW_TESTS_RES = \
|
|||||||
test_system.res \
|
test_system.res \
|
||||||
test_tab.res \
|
test_tab.res \
|
||||||
test_tcl.res \
|
test_tcl.res \
|
||||||
test_termencoding.res \
|
|
||||||
test_termcodes.res \
|
test_termcodes.res \
|
||||||
|
test_termencoding.res \
|
||||||
test_terminal.res \
|
test_terminal.res \
|
||||||
test_terminal_fail.res \
|
test_terminal_fail.res \
|
||||||
test_textformat.res \
|
test_textformat.res \
|
||||||
|
|||||||
10
src/testdir/dumps/Test_popupwin_01.dump
Normal file
10
src/testdir/dumps/Test_popupwin_01.dump
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
>1+0&#ffffff0| @73
|
||||||
|
|2| @73
|
||||||
|
|3| @8|h+0fd7ff255|e|l@1|o| |t|h|e|r|e| @8|r+0#0000001#ffd7ff255| |o|n|e| @8| +0#0000000#ffffff0@30
|
||||||
|
|4| @22|a+0#0000001#ffd7ff255|n|o|t|h|e|r| |t|w|o| @8| +0#0000000#ffffff0@30
|
||||||
|
|5| @22|a+0#0000001#ffd7ff255|n|o|t|h|e|r| |t|h|r|e@1| @6| +0#0000000#ffffff0@30
|
||||||
|
|6| @73
|
||||||
|
|7| @73
|
||||||
|
|8| @73
|
||||||
|
|9| @73
|
||||||
|
@57|1|,|1| @10|T|o|p|
|
||||||
26
src/testdir/test_popupwin.vim
Normal file
26
src/testdir/test_popupwin.vim
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
" Tests for popup windows
|
||||||
|
|
||||||
|
if !has('textprop')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
source screendump.vim
|
||||||
|
|
||||||
|
func Test_simple_popup()
|
||||||
|
if !CanRunVimInTerminal()
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
call writefile([
|
||||||
|
\ "call setline(1, range(1, 100))",
|
||||||
|
\ "let winid = popup_create('hello there', {'line': 3, 'col': 11})",
|
||||||
|
\ "hi PopupColor ctermbg=lightblue",
|
||||||
|
\ "call setwinvar(winid, '&wincolor', 'PopupColor')",
|
||||||
|
\ "let winid2 = popup_create(['another one', 'another two', 'another three'], {'line': 3, 'col': 25})",
|
||||||
|
\], 'XtestPopup')
|
||||||
|
let buf = RunVimInTerminal('-S XtestPopup', {'rows': 10})
|
||||||
|
call VerifyScreenDump(buf, 'Test_popupwin_01', {})
|
||||||
|
|
||||||
|
" clean up
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
call delete('XtestPopup')
|
||||||
|
endfunc
|
||||||
@ -767,6 +767,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1391,
|
||||||
/**/
|
/**/
|
||||||
1390,
|
1390,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
17
src/vim.h
17
src/vim.h
@ -604,14 +604,15 @@ extern int (*dyn_libintl_wputenv)(const wchar_t *envstring);
|
|||||||
* off off w_botline not valid
|
* off off w_botline not valid
|
||||||
* on off not possible
|
* on off not possible
|
||||||
*/
|
*/
|
||||||
#define VALID_WROW 0x01 /* w_wrow (window row) is valid */
|
#define VALID_WROW 0x01 // w_wrow (window row) is valid
|
||||||
#define VALID_WCOL 0x02 /* w_wcol (window col) is valid */
|
#define VALID_WCOL 0x02 // w_wcol (window col) is valid
|
||||||
#define VALID_VIRTCOL 0x04 /* w_virtcol (file col) is valid */
|
#define VALID_VIRTCOL 0x04 // w_virtcol (file col) is valid
|
||||||
#define VALID_CHEIGHT 0x08 /* w_cline_height and w_cline_folded valid */
|
#define VALID_CHEIGHT 0x08 // w_cline_height and w_cline_folded valid
|
||||||
#define VALID_CROW 0x10 /* w_cline_row is valid */
|
#define VALID_CROW 0x10 // w_cline_row is valid
|
||||||
#define VALID_BOTLINE 0x20 /* w_botine and w_empty_rows are valid */
|
#define VALID_BOTLINE 0x20 // w_botine and w_empty_rows are valid
|
||||||
#define VALID_BOTLINE_AP 0x40 /* w_botine is approximated */
|
#define VALID_BOTLINE_AP 0x40 // w_botine is approximated
|
||||||
#define VALID_TOPLINE 0x80 /* w_topline is valid (for cursor position) */
|
#define VALID_TOPLINE 0x80 // w_topline is valid (for cursor position)
|
||||||
|
#define VALID_POPUP 0x100 // popup has been redrawn
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Terminal highlighting attribute bits.
|
* Terminal highlighting attribute bits.
|
||||||
|
|||||||
178
src/window.c
178
src/window.c
@ -1362,6 +1362,21 @@ win_init_some(win_T *newp, win_T *oldp)
|
|||||||
win_copy_options(oldp, newp);
|
win_copy_options(oldp, newp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
win_valid_popup(win_T *win)
|
||||||
|
{
|
||||||
|
#ifdef FEAT_TEXT_PROP
|
||||||
|
win_T *wp;
|
||||||
|
|
||||||
|
for (wp = first_popupwin; wp != NULL; wp = wp->w_next)
|
||||||
|
if (wp == win)
|
||||||
|
return TRUE;
|
||||||
|
for (wp = first_tab_popupwin; wp != NULL; wp = wp->w_next)
|
||||||
|
if (wp == win)
|
||||||
|
return TRUE;
|
||||||
|
#endif
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if "win" is a pointer to an existing window in the current tab page.
|
* Check if "win" is a pointer to an existing window in the current tab page.
|
||||||
@ -1376,7 +1391,7 @@ win_valid(win_T *win)
|
|||||||
FOR_ALL_WINDOWS(wp)
|
FOR_ALL_WINDOWS(wp)
|
||||||
if (wp == win)
|
if (wp == win)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return win_valid_popup(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1398,7 +1413,7 @@ win_valid_any_tab(win_T *win)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return win_valid_popup(win);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2292,6 +2307,44 @@ close_last_window_tabpage(
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Close the buffer of "win" and unload it if "free_buf" is TRUE.
|
||||||
|
* "abort_if_last" is passed to close_buffer(): abort closing if all other
|
||||||
|
* windows are closed.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
win_close_buffer(win_T *win, int free_buf, int abort_if_last)
|
||||||
|
{
|
||||||
|
#ifdef FEAT_SYN_HL
|
||||||
|
// Free independent synblock before the buffer is freed.
|
||||||
|
if (win->w_buffer != NULL)
|
||||||
|
reset_synblock(win);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef FEAT_QUICKFIX
|
||||||
|
// When the quickfix/location list window is closed, unlist the buffer.
|
||||||
|
if (win->w_buffer != NULL && bt_quickfix(win->w_buffer))
|
||||||
|
win->w_buffer->b_p_bl = FALSE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Close the link to the buffer.
|
||||||
|
if (win->w_buffer != NULL)
|
||||||
|
{
|
||||||
|
bufref_T bufref;
|
||||||
|
|
||||||
|
set_bufref(&bufref, curbuf);
|
||||||
|
win->w_closing = TRUE;
|
||||||
|
close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0,
|
||||||
|
abort_if_last);
|
||||||
|
if (win_valid_any_tab(win))
|
||||||
|
win->w_closing = FALSE;
|
||||||
|
// Make sure curbuf is valid. It can become invalid if 'bufhidden' is
|
||||||
|
// "wipe".
|
||||||
|
if (!bufref_valid(&bufref))
|
||||||
|
curbuf = firstbuf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Close window "win". Only works for the current tab page.
|
* Close window "win". Only works for the current tab page.
|
||||||
* If "free_buf" is TRUE related buffer may be unloaded.
|
* If "free_buf" is TRUE related buffer may be unloaded.
|
||||||
@ -2319,9 +2372,9 @@ win_close(win_T *win, int free_buf)
|
|||||||
if (win->w_closing || (win->w_buffer != NULL
|
if (win->w_closing || (win->w_buffer != NULL
|
||||||
&& win->w_buffer->b_locked > 0))
|
&& win->w_buffer->b_locked > 0))
|
||||||
return FAIL; /* window is already being closed */
|
return FAIL; /* window is already being closed */
|
||||||
if (win == aucmd_win)
|
if (win_unlisted(win))
|
||||||
{
|
{
|
||||||
emsg(_("E813: Cannot close autocmd window"));
|
emsg(_("E813: Cannot close autocmd or popup window"));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
if ((firstwin == aucmd_win || lastwin == aucmd_win) && one_window())
|
if ((firstwin == aucmd_win || lastwin == aucmd_win) && one_window())
|
||||||
@ -2390,35 +2443,7 @@ win_close(win_T *win, int free_buf)
|
|||||||
out_flush();
|
out_flush();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_SYN_HL
|
win_close_buffer(win, free_buf, TRUE);
|
||||||
// Free independent synblock before the buffer is freed.
|
|
||||||
if (win->w_buffer != NULL)
|
|
||||||
reset_synblock(win);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_QUICKFIX
|
|
||||||
// When the quickfix/location list window is closed, unlist the buffer.
|
|
||||||
if (win->w_buffer != NULL && bt_quickfix(win->w_buffer))
|
|
||||||
win->w_buffer->b_p_bl = FALSE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Close the link to the buffer.
|
|
||||||
*/
|
|
||||||
if (win->w_buffer != NULL)
|
|
||||||
{
|
|
||||||
bufref_T bufref;
|
|
||||||
|
|
||||||
set_bufref(&bufref, curbuf);
|
|
||||||
win->w_closing = TRUE;
|
|
||||||
close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, TRUE);
|
|
||||||
if (win_valid_any_tab(win))
|
|
||||||
win->w_closing = FALSE;
|
|
||||||
/* Make sure curbuf is valid. It can become invalid if 'bufhidden' is
|
|
||||||
* "wipe". */
|
|
||||||
if (!bufref_valid(&bufref))
|
|
||||||
curbuf = firstbuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (only_one_window() && win_valid(win) && win->w_buffer == NULL
|
if (only_one_window() && win_valid(win) && win->w_buffer == NULL
|
||||||
&& (last_window() || curtab != prev_curtab
|
&& (last_window() || curtab != prev_curtab
|
||||||
@ -2627,6 +2652,9 @@ win_free_all(void)
|
|||||||
(void)win_free_mem(aucmd_win, &dummy, NULL);
|
(void)win_free_mem(aucmd_win, &dummy, NULL);
|
||||||
aucmd_win = NULL;
|
aucmd_win = NULL;
|
||||||
}
|
}
|
||||||
|
# ifdef FEAT_TEXT_PROP
|
||||||
|
close_all_popups();
|
||||||
|
# endif
|
||||||
|
|
||||||
while (firstwin != NULL)
|
while (firstwin != NULL)
|
||||||
(void)win_free_mem(firstwin, &dummy, NULL);
|
(void)win_free_mem(firstwin, &dummy, NULL);
|
||||||
@ -3458,7 +3486,7 @@ win_init_empty(win_T *wp)
|
|||||||
wp->w_topfill = 0;
|
wp->w_topfill = 0;
|
||||||
#endif
|
#endif
|
||||||
wp->w_botline = 2;
|
wp->w_botline = 2;
|
||||||
#ifdef FEAT_SYN_HL
|
#if defined(FEAT_SYN_HL) || defined(FEAT_SPELL)
|
||||||
wp->w_s = &wp->w_buffer->b_s;
|
wp->w_s = &wp->w_buffer->b_s;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -3484,19 +3512,41 @@ win_alloc_first(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Init "aucmd_win". This can only be done after the first
|
* Allocate and init a window that is not a regular window.
|
||||||
* window is fully initialized, thus it can't be in win_alloc_first().
|
* This can only be done after the first window is fully initialized, thus it
|
||||||
|
* can't be in win_alloc_first().
|
||||||
|
*/
|
||||||
|
win_T *
|
||||||
|
win_alloc_popup_win(void)
|
||||||
|
{
|
||||||
|
win_T *wp;
|
||||||
|
|
||||||
|
wp = win_alloc(NULL, TRUE);
|
||||||
|
if (wp != NULL)
|
||||||
|
{
|
||||||
|
// We need to initialize options with something, using the current
|
||||||
|
// window makes most sense.
|
||||||
|
win_init_some(wp, curwin);
|
||||||
|
|
||||||
|
RESET_BINDING(wp);
|
||||||
|
new_frame(wp);
|
||||||
|
}
|
||||||
|
return wp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize window "wp" to display buffer "buf".
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
win_alloc_aucmd_win(void)
|
win_init_popup_win(win_T *wp, buf_T *buf)
|
||||||
{
|
{
|
||||||
aucmd_win = win_alloc(NULL, TRUE);
|
wp->w_buffer = buf;
|
||||||
if (aucmd_win != NULL)
|
++buf->b_nwindows;
|
||||||
{
|
win_init_empty(wp); // set cursor and topline to safe values
|
||||||
win_init_some(aucmd_win, curwin);
|
|
||||||
RESET_BINDING(aucmd_win);
|
// Make sure w_localdir and globaldir are NULL to avoid a chdir() in
|
||||||
new_frame(aucmd_win);
|
// win_enter_ext().
|
||||||
}
|
VIM_CLEAR(wp->w_localdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3618,6 +3668,10 @@ free_tabpage(tabpage_T *tp)
|
|||||||
|
|
||||||
# ifdef FEAT_DIFF
|
# ifdef FEAT_DIFF
|
||||||
diff_clear(tp);
|
diff_clear(tp);
|
||||||
|
# endif
|
||||||
|
# ifdef FEAT_TEXT_PROP
|
||||||
|
while (tp->tp_first_popupwin != NULL)
|
||||||
|
popup_close(tp->tp_first_popupwin->w_id);
|
||||||
#endif
|
#endif
|
||||||
for (idx = 0; idx < SNAP_COUNT; ++idx)
|
for (idx = 0; idx < SNAP_COUNT; ++idx)
|
||||||
clear_snapshot(tp, idx);
|
clear_snapshot(tp, idx);
|
||||||
@ -4782,7 +4836,7 @@ win_free(
|
|||||||
vim_free(wp->w_p_cc_cols);
|
vim_free(wp->w_p_cc_cols);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (wp != aucmd_win)
|
if (win_valid_any_tab(wp))
|
||||||
win_remove(wp, tp);
|
win_remove(wp, tp);
|
||||||
if (autocmd_busy)
|
if (autocmd_busy)
|
||||||
{
|
{
|
||||||
@ -4795,6 +4849,28 @@ win_free(
|
|||||||
unblock_autocmds();
|
unblock_autocmds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return TRUE if "wp" is not in the list of windows: the autocmd window or a
|
||||||
|
* popup window.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
win_unlisted(win_T *wp)
|
||||||
|
{
|
||||||
|
return wp == aucmd_win || bt_popup(wp->w_buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Free a popup window. This does not take the window out of the window list
|
||||||
|
* and assumes there is only one toplevel frame, no split.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
win_free_popup(win_T *win)
|
||||||
|
{
|
||||||
|
win_close_buffer(win, TRUE, FALSE);
|
||||||
|
vim_free(win->w_frame);
|
||||||
|
win_free(win, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Append window "wp" in the window list after window "after".
|
* Append window "wp" in the window list after window "after".
|
||||||
*/
|
*/
|
||||||
@ -6182,7 +6258,7 @@ min_rows(void)
|
|||||||
/*
|
/*
|
||||||
* Return TRUE if there is only one window (in the current tab page), not
|
* Return TRUE if there is only one window (in the current tab page), not
|
||||||
* counting a help or preview window, unless it is the current window.
|
* counting a help or preview window, unless it is the current window.
|
||||||
* Does not count "aucmd_win".
|
* Does not count unlisted windows.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
only_one_window(void)
|
only_one_window(void)
|
||||||
@ -6974,6 +7050,16 @@ win_id2wp(int id)
|
|||||||
FOR_ALL_TAB_WINDOWS(tp, wp)
|
FOR_ALL_TAB_WINDOWS(tp, wp)
|
||||||
if (wp->w_id == id)
|
if (wp->w_id == id)
|
||||||
return wp;
|
return wp;
|
||||||
|
#ifdef FEAT_TEXT_PROP
|
||||||
|
// popup windows are in a separate list
|
||||||
|
FOR_ALL_TABPAGES(tp)
|
||||||
|
for (wp = tp->tp_first_popupwin; wp != NULL; wp = wp->w_next)
|
||||||
|
if (wp->w_id == id)
|
||||||
|
return wp;
|
||||||
|
for (wp = first_popupwin; wp != NULL; wp = wp->w_next)
|
||||||
|
if (wp->w_id == id)
|
||||||
|
return wp;
|
||||||
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user