mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Merge remote-tracking branch 'vim/master'
This commit is contained in:
@@ -120,6 +120,7 @@ SRC_ALL = \
|
||||
src/testdir/sautest/autoload/*.vim \
|
||||
src/testdir/runtest.vim \
|
||||
src/testdir/summarize.vim \
|
||||
src/testdir/check.vim \
|
||||
src/testdir/shared.vim \
|
||||
src/testdir/screendump.vim \
|
||||
src/testdir/view_util.vim \
|
||||
|
||||
+27
-9
@@ -1,4 +1,4 @@
|
||||
*autocmd.txt* For Vim version 8.1. Last change: 2019 Jun 02
|
||||
*autocmd.txt* For Vim version 8.1. Last change: 2019 Jun 15
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -873,15 +873,33 @@ MenuPopup Just before showing the popup menu (under the
|
||||
*OptionSet*
|
||||
OptionSet After setting an option. The pattern is
|
||||
matched against the long option name.
|
||||
The |v:option_old| variable indicates the
|
||||
old option value, |v:option_new| variable
|
||||
indicates the newly set value, the
|
||||
|v:option_type| variable indicates whether
|
||||
it's global or local scoped and |<amatch>|
|
||||
indicates what option has been set.
|
||||
|<amatch>| indicates what option has been set.
|
||||
|
||||
Is not triggered on startup and for the 'key'
|
||||
option for obvious reasons.
|
||||
|v:option_type| indicates whether it's global
|
||||
or local scoped
|
||||
|v:option_command| indicates what type of
|
||||
set/let command was used (follow the tag to
|
||||
see the table).
|
||||
|v:option_new| indicates the newly set value.
|
||||
|v:option_oldlocal| hass the old local value.
|
||||
|v:option_oldglobal| hass the old global
|
||||
value
|
||||
|v:option_old| indicates the old option value.
|
||||
|
||||
|v:option_oldlocal| is only set when |:set|
|
||||
or |:setlocal| or a |modeline| was used to set
|
||||
the option. Similarly |v:option_oldglobal| is
|
||||
only set when |:set| or |:setglobal| was used.
|
||||
|
||||
Note that when setting a |global-local| string
|
||||
option with |:set|, then |v:option_old| is the
|
||||
old global value. However, for all other kinds
|
||||
of options (local string options, global-local
|
||||
number options, ...) it is the old local
|
||||
value.
|
||||
|
||||
OptionSet is not triggered on startup and for
|
||||
the 'key' option for obvious reasons.
|
||||
|
||||
Usage example: Check for the existence of the
|
||||
directory in the 'backupdir' and 'undodir'
|
||||
|
||||
+58
-2
@@ -1943,10 +1943,29 @@ v:option_new New value of the option. Valid while executing an |OptionSet|
|
||||
autocommand.
|
||||
*v:option_old*
|
||||
v:option_old Old value of the option. Valid while executing an |OptionSet|
|
||||
autocommand.
|
||||
autocommand. Depending on the command used for setting and the
|
||||
kind of option this is either the local old value or the
|
||||
global old value.
|
||||
*v:option_oldlocal*
|
||||
v:option_oldlocal
|
||||
Old local value of the option. Valid while executing an
|
||||
|OptionSet| autocommand.
|
||||
*v:option_oldglobal*
|
||||
v:option_oldglobal
|
||||
Old global value of the option. Valid while executing an
|
||||
|OptionSet| autocommand.
|
||||
*v:option_type*
|
||||
v:option_type Scope of the set command. Valid while executing an
|
||||
|OptionSet| autocommand. Can be either "global" or "local"
|
||||
*v:option_command*
|
||||
v:option_command
|
||||
Command used to set the option. Valid while executing an
|
||||
|OptionSet| autocommand.
|
||||
value option was set via ~
|
||||
"setlocal" |:setlocal| or ":let l:xxx"
|
||||
"setglobal" |:setglobal| or ":let g:xxx"
|
||||
"set" |:set| or |:let|
|
||||
"modeline" |modeline|
|
||||
*v:operator* *operator-variable*
|
||||
v:operator The last operator given in Normal mode. This is a single
|
||||
character except for commands starting with <g> or <z>,
|
||||
@@ -2173,6 +2192,17 @@ v:version Version number of Vim: Major version number times 100 plus
|
||||
version 5.0 and 5.1 may have a patch 123, but these are
|
||||
completely different.
|
||||
|
||||
*v:versionlong* *versionlong-variable*
|
||||
v:versionlong Like v:version, but also including the patchlevel. Version
|
||||
8.1 with patch 1234 has value 8011234. This can be used like
|
||||
this: >
|
||||
if v:versionlong >= 8011234
|
||||
< However, if there are gaps in the list of patches included
|
||||
this will not work well. This can happen if a recent patch
|
||||
was included into an older version, e.g. for a security fix.
|
||||
Use the has() function to make sure the patch is actually
|
||||
included.
|
||||
|
||||
*v:vim_did_enter* *vim_did_enter-variable*
|
||||
v:vim_did_enter Zero until most of startup is done. It is set to one just
|
||||
before |VimEnter| autocommands are triggered.
|
||||
@@ -11592,7 +11622,33 @@ text...
|
||||
No error message is given for a non-existing
|
||||
variable, also without !.
|
||||
If the system does not support deleting an environment
|
||||
variable, it is made emtpy.
|
||||
variable, it is made empty.
|
||||
|
||||
*:cons* *:const*
|
||||
:cons[t] {var-name} = {expr1}
|
||||
:cons[t] [{name1}, {name2}, ...] = {expr1}
|
||||
:cons[t] [{name}, ..., ; {lastname}] = {expr1}
|
||||
:cons[t] {var-name} =<< [trim] {marker}
|
||||
text...
|
||||
text...
|
||||
{marker}
|
||||
Similar to |:let|, but additionally lock the variable
|
||||
after setting the value. This is the same as locking
|
||||
the variable with |:lockvar| just after |:let|, thus: >
|
||||
:const x = 1
|
||||
< is equivalent to: >
|
||||
:let x = 1
|
||||
:lockvar 1 x
|
||||
< This is useful if you want to make sure the variable
|
||||
is not modified.
|
||||
*E995*
|
||||
|:const| does not allow to for changing a variable. >
|
||||
:let x = 1
|
||||
:const x = 2 " Error!
|
||||
< *E996*
|
||||
Note that environment variables, option values and
|
||||
register values cannot be used here, since they cannot
|
||||
be locked.
|
||||
|
||||
:lockv[ar][!] [depth] {name} ... *:lockvar* *:lockv*
|
||||
Lock the internal variable {name}. Locking means that
|
||||
|
||||
+165
-51
@@ -1,4 +1,4 @@
|
||||
*popup.txt* For Vim version 8.1. Last change: 2019 Jun 10
|
||||
*popup.txt* For Vim version 8.1. Last change: 2019 Jun 15
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -36,15 +36,16 @@ The default color used is "Pmenu". If you prefer something else use the
|
||||
hi MyPopupColor ctermbg=lightblue guibg=lightblue
|
||||
call setwinvar(winid, '&wincolor', 'MyPopupColor')
|
||||
|
||||
'hlsearch' and match highlighting are not displayed in a popup window.
|
||||
'hlsearch' highlighting is not displayed in a popup window.
|
||||
|
||||
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.
|
||||
Popup windows can also overlap each other.
|
||||
Popup windows can also overlap each other. The "zindex" property specifies
|
||||
what goes on top of what.
|
||||
|
||||
The popup window contains a buffer, and that buffer is always associated with
|
||||
the popup window. The window cannot be used in Normal, Visual or Insert mode,
|
||||
it does not get keyboard focus. You can use functions like `setbufline()` to
|
||||
the popup window. The window cannot be in Normal, Visual or Insert mode, it
|
||||
does not get keyboard focus. You can use functions like `setbufline()` to
|
||||
change the text in the buffer. There are more differences from how this
|
||||
window and buffer behave compared to regular windows and buffers, see
|
||||
|popup-buffer|.
|
||||
@@ -63,7 +64,7 @@ property.
|
||||
|
||||
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 or the "minwidth" property.
|
||||
increase the width or use the "minwidth" property.
|
||||
|
||||
By default the 'wrap' option is set, so that no text disappears. Otherwise,
|
||||
if there is not enough space then the window is shifted left in order to
|
||||
@@ -79,26 +80,38 @@ window it will be placed below the cursor position.
|
||||
When the screen scrolls up for output of an Ex command, popups move too, so
|
||||
that they will not cover the output.
|
||||
|
||||
The current cursor position is displayed even when it is under a popup window.
|
||||
That way you can still see where it is, even though you cannot see the text
|
||||
that it is in.
|
||||
|
||||
|
||||
|
||||
IMPLEMENTATION:
|
||||
- buffers remain after a popup was deleted.
|
||||
TODO:
|
||||
- Why does 'nrformats' leak from the popup window buffer???
|
||||
- Disable commands, feedkeys(), CTRL-W, etc. in a popup window.
|
||||
Use ERROR_IF_POPUP_WINDOW for more commands.
|
||||
- Add 'balloonpopup': instead of showing text, let the callback open a popup
|
||||
window and return the window ID. The popup will then be closed when the
|
||||
mouse moves, except when it moves inside the popup.
|
||||
- For the "moved" property also include mouse movement?
|
||||
- Make redrawing more efficient and avoid flicker:
|
||||
- put popup menu also put in popup_mask?
|
||||
- Disable commands, feedkeys(), CTRL-W, etc. in a popup window.
|
||||
Use NOT_IN_POPUP_WINDOW for more commands.
|
||||
- Invoke filter with character before mapping?
|
||||
- Figure out the size and position better.
|
||||
if wrapping splits a double-wide character
|
||||
if wrapping inserts indent
|
||||
- When drawing on top half a double-wide character, display ">" or "<" in the
|
||||
incomplete cell.
|
||||
- Can the buffer be re-used, to avoid using up lots of buffer numbers?
|
||||
- Implement all the unimplemented options and features.
|
||||
- Use a popup window for the "info" item of completion instead of using a
|
||||
preview window. Ideas in issue #4544.
|
||||
How to add highlighting?
|
||||
- When the lines do not fit show a scrollbar (like in the popup menu).
|
||||
Use the mouse wheel for scrolling.
|
||||
- Implement:
|
||||
tabpage option with number
|
||||
flip option
|
||||
transparent text property
|
||||
|
||||
|
||||
==============================================================================
|
||||
@@ -106,7 +119,35 @@ IMPLEMENTATION:
|
||||
|
||||
THIS IS UNDER DESIGN - ANYTHING MAY STILL CHANGE
|
||||
|
||||
[functions to be moved to eval.txt later, keep overview of functions here]
|
||||
Creating a popup window:
|
||||
|popup_create()| centered in the screen
|
||||
|popup_atcursor()| just above the cursor position, closes when
|
||||
the cursor moves away
|
||||
|popup_notifiation()| show a notification for three seconds
|
||||
|popup_dialog()| centered with padding and border
|
||||
|popup_menu()| prompt for selecting an item from a list
|
||||
|
||||
Manipulating a popup window:
|
||||
|popup_hide()| hide a popup temporarily
|
||||
|popup_show()| show a previously hidden popup
|
||||
|popup_move()| change the position and size of a popup
|
||||
|popup_setoptions()| override options of a popup
|
||||
|popup_settext()| replace the popup buffer contents
|
||||
|
||||
Closing popup windows:
|
||||
|popup_close()| close one popup
|
||||
|popup_clear()| close all popups
|
||||
|
||||
Filter functions:
|
||||
|popup_filter_menu()| select from a list of items
|
||||
|popup_filter_yesno()| blocks until 'y' or 'n' is pressed
|
||||
|
||||
Other:
|
||||
|popup_getoptions()| get current options for a popup
|
||||
|popup_getpos()| get actual position and size of a popup
|
||||
|
||||
|
||||
[functions help to be moved to eval.txt later]
|
||||
|
||||
popup_atcursor({text}, {options}) *popup_atcursor()*
|
||||
Show the {text} above the cursor, and close it when the cursor
|
||||
@@ -154,33 +195,49 @@ popup_create({text}, {options}) *popup_create()*
|
||||
|
||||
|
||||
popup_dialog({text}, {options}) *popup_dialog()*
|
||||
{not implemented yet}
|
||||
Just like |popup_create()| but with these default options: >
|
||||
call popup_create({text}, {
|
||||
\ 'pos': 'center',
|
||||
\ 'zindex': 200,
|
||||
\ 'drag': 1,
|
||||
\ 'border': [],
|
||||
\ 'padding': [],
|
||||
\})
|
||||
< Use {options} to change the properties.
|
||||
< Use {options} to change the properties. E.g. add a 'filter'
|
||||
option with value 'popup_filter_yesno'. Example: >
|
||||
call popup_create('do you want to quit (Yes/no)?', {
|
||||
\ 'filter': 'popup_filter_yesno',
|
||||
\ 'callback': 'QuitCallback',
|
||||
\ })
|
||||
|
||||
< By default the dialog can be dragged, so that text below it
|
||||
can be read if needed.
|
||||
|
||||
|
||||
popup_filter_menu({id}, {key}) *popup_filter_menu()*
|
||||
{not implemented yet}
|
||||
Filter that can be used for a popup. It handles the cursor
|
||||
keys to move the selected index in the popup. Space and Enter
|
||||
can be used to select an item. Invokes the "callback" of the
|
||||
popup menu with the index of the selected line as the second
|
||||
argument.
|
||||
Filter that can be used for a popup. These keys can be used:
|
||||
j <Down> select item below
|
||||
k <Up> select item above
|
||||
<Space> <Enter> accept current selection
|
||||
x Esc CTRL-C cancel the menu
|
||||
Other keys are ignored.
|
||||
|
||||
A match is set on that line to highlight it, see
|
||||
|popup_menu()|.
|
||||
|
||||
When the current selection is accepted the "callback" of the
|
||||
popup menu is invoked with the index of the selected line as
|
||||
the second argument. The first entry has index one.
|
||||
Cancelling the menu invokes the callback with -1.
|
||||
|
||||
|
||||
popup_filter_yesno({id}, {key}) *popup_filter_yesno()*
|
||||
{not implemented yet}
|
||||
Filter that can be used for a popup. It handles only the keys
|
||||
'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'
|
||||
as the second argument. Pressing Esc and CTRL-C works like
|
||||
pressing 'n'.
|
||||
as the second argument. Pressing Esc and 'x' works like
|
||||
pressing 'n'. CTRL-C invokes the callback with -1. Other
|
||||
keys are ignored.
|
||||
|
||||
|
||||
popup_getoptions({id}) *popup_getoptions()*
|
||||
@@ -188,11 +245,15 @@ popup_getoptions({id}) *popup_getoptions()*
|
||||
A zero value means the option was not set. For "zindex" the
|
||||
default value is returned, not zero.
|
||||
|
||||
The "highlight" entry is omitted, use the 'wincolor' option
|
||||
for that: >
|
||||
let hl = getwinvar(winid, '&wincolor')
|
||||
The "moved" entry is a list with minimum and maximum column,
|
||||
[0, 0] when not set.
|
||||
|
||||
< If popup window {id} is not found an empty Dict is returned.
|
||||
"border" and "padding" are not included when all values are
|
||||
zero. When all values are one then an empty list is included.
|
||||
|
||||
"borderhighlight" is not included when all values are empty.
|
||||
|
||||
If popup window {id} is not found an empty Dict is returned.
|
||||
|
||||
|
||||
popup_getpos({id}) *popup_getpos()*
|
||||
@@ -225,7 +286,6 @@ popup_hide({id}) *popup_hide()*
|
||||
|
||||
|
||||
popup_menu({text}, {options}) *popup_menu()*
|
||||
{not implemented yet}
|
||||
Show the {text} near the cursor, handle selecting one of the
|
||||
items with cursorkeys, and close it an item is selected with
|
||||
Space or Enter. {text} should have multiple lines to make this
|
||||
@@ -233,36 +293,56 @@ popup_menu({text}, {options}) *popup_menu()*
|
||||
call popup_create({text}, {
|
||||
\ 'pos': 'center',
|
||||
\ 'zindex': 200,
|
||||
\ 'drag': 1,
|
||||
\ 'wrap': 0,
|
||||
\ 'border': [],
|
||||
\ 'padding': [],
|
||||
\ 'filter': 'popup_filter_menu',
|
||||
\ })
|
||||
< Use {options} to change the properties. Should at least set
|
||||
< The current line is highlighted with a match using
|
||||
PopupSelected, or |PmenuSel| if that is not defined.
|
||||
|
||||
Use {options} to change the properties. Should at least set
|
||||
"callback" to a function that handles the selected item.
|
||||
|
||||
|
||||
popup_move({id}, {options}) *popup_move()*
|
||||
Move popup {id} to the position speficied with {options}.
|
||||
Move popup {id} to the position specified with {options}.
|
||||
{options} may contain the items from |popup_create()| that
|
||||
specify the popup position: "line", "col", "pos", "maxheight",
|
||||
"minheight", "maxwidth" and "minwidth".
|
||||
specify the popup position:
|
||||
line
|
||||
col
|
||||
pos
|
||||
maxheight
|
||||
minheight
|
||||
maxwidth
|
||||
minwidth
|
||||
fixed
|
||||
For {id} see `popup_hide()`.
|
||||
For other options see |popup_setoptions()|.
|
||||
|
||||
|
||||
popup_notification({text}, {options}) *popup_notification()*
|
||||
{not implemented yet}
|
||||
Show the {text} for 3 seconds at the top of the Vim window.
|
||||
This works like: >
|
||||
call popup_create({text}, {
|
||||
\ 'line': 1,
|
||||
\ 'col': 10,
|
||||
\ 'minwidth': 20,
|
||||
\ 'time': 3000,
|
||||
\ 'tab': -1,
|
||||
\ 'zindex': 200,
|
||||
\ 'tabpage': -1,
|
||||
\ 'zindex': 300,
|
||||
\ 'drag': 1,
|
||||
\ 'highlight': 'WarningMsg',
|
||||
\ 'border': [],
|
||||
\ 'padding': [0,1,0,1],
|
||||
\ })
|
||||
< Use {options} to change the properties.
|
||||
< The PopupNotification highlight group is used instead of
|
||||
WarningMsg if it is defined.
|
||||
|
||||
The position will be adjusted to avoid overlap with other
|
||||
notifications.
|
||||
Use {options} to change the properties.
|
||||
|
||||
|
||||
popup_show({id}) *popup_show()*
|
||||
@@ -271,9 +351,32 @@ popup_show({id}) *popup_show()*
|
||||
|
||||
|
||||
popup_setoptions({id}, {options}) *popup_setoptions()*
|
||||
{not implemented yet}
|
||||
Override options in popup {id} with entries in {options}.
|
||||
These options can be set:
|
||||
flip
|
||||
firstline
|
||||
title
|
||||
wrap
|
||||
drag
|
||||
highlight
|
||||
padding
|
||||
border
|
||||
borderhighlight
|
||||
borderchars
|
||||
zindex
|
||||
time
|
||||
moved
|
||||
filter
|
||||
callback
|
||||
The options from |popup_move()| can also be used.
|
||||
For "hidden" use |popup_hide()| and |popup_show()|.
|
||||
"tabpage" cannot be changed.
|
||||
|
||||
popup_settext({id}, {text}) *popup_settext()*
|
||||
Set the text of the buffer in poup win {id}. {text} is the
|
||||
same as supplied to |popup_create()|.
|
||||
Does not change the window size or position, other than caused
|
||||
by the different text.
|
||||
|
||||
|
||||
POPUP BUFFER AND WINDOW *popup-buffer*
|
||||
@@ -309,8 +412,9 @@ need them.
|
||||
|
||||
POPUP_CREATE() ARGUMENTS *popup_create-usage*
|
||||
|
||||
The first argument of |popup_create()| specifies the text to be displayed, and
|
||||
optionally text properties. It is in one of three forms:
|
||||
The first argument of |popup_create()| (and the second argument to
|
||||
|popup_setttext()|) specifies the text to be displayed, and optionally text
|
||||
properties. It is in one of three forms:
|
||||
- a string
|
||||
- a list of strings
|
||||
- a list of dictionaries, where each dictionary has these entries:
|
||||
@@ -348,7 +452,9 @@ The second argument of |popup_create()| is a dictionary with options:
|
||||
flip When TRUE (the default) and the position is relative
|
||||
to the cursor, flip to below or above the cursor to
|
||||
avoid overlap with the |popupmenu-completion| or
|
||||
another popup with a higher "zindex".
|
||||
another popup with a higher "zindex". When there is
|
||||
no space above/below the cursor then show the popup to
|
||||
the side of the popup or popup menu.
|
||||
{not implemented yet}
|
||||
maxheight Maximum height of the contents, excluding border and
|
||||
padding.
|
||||
@@ -358,20 +464,29 @@ The second argument of |popup_create()| is a dictionary with options:
|
||||
padding.
|
||||
minwidth Minimum width of the contents, excluding border and
|
||||
padding.
|
||||
firstline First buffer line to display. When larger than one it
|
||||
looks like the text scrolled up. When out of range
|
||||
the last buffer line will at the top of the window.
|
||||
hidden When TRUE the popup exists but is not displayed; use
|
||||
`popup_show()` to unhide it.
|
||||
{not implemented yet}
|
||||
tab When -1: display the popup on all tabs.
|
||||
tabpage When -1: display the popup on all tabs.
|
||||
When 0 (the default): display the popup on the current
|
||||
tab.
|
||||
tab page.
|
||||
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 page is used.
|
||||
{only -1 and 0 are implemented}
|
||||
title Text to be displayed above the first item in the
|
||||
popup, on top of any border. If there is no top
|
||||
border on line of padding is added to put the title on.
|
||||
{not implemented yet}
|
||||
border one line of padding is added to put the title
|
||||
on. You might want to add one or more spaces at the
|
||||
start and end as padding.
|
||||
wrap TRUE to make the lines wrap (default TRUE).
|
||||
drag TRUE to allow the popup to be dragged with the mouse
|
||||
by grabbing at at the border. Has no effect if the
|
||||
popup does not have a border. As soon as dragging
|
||||
starts and "pos" is "center" it is changed to
|
||||
"topleft".
|
||||
highlight Highlight group name to use for the text, stored in
|
||||
the 'wincolor' option.
|
||||
padding List with numbers, defining the padding
|
||||
@@ -402,7 +517,7 @@ The second argument of |popup_create()| is a dictionary with options:
|
||||
By default a double line is used all around when
|
||||
'encoding' is "utf-8", otherwise ASCII characters are
|
||||
used.
|
||||
zindex Priority for the popup, default 50. Mininum value is
|
||||
zindex Priority for the popup, default 50. Minimum value is
|
||||
1, maximum value is 32000.
|
||||
time Time in milliseconds after which the popup will close.
|
||||
When omitted |popup_close()| must be used.
|
||||
@@ -465,7 +580,7 @@ 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
|
||||
key, e.g.: >
|
||||
key as a string, e.g.: >
|
||||
func MyFilter(winid, key)
|
||||
if a:key == "\<F2>"
|
||||
" do something
|
||||
@@ -500,15 +615,14 @@ Vim recognizes the Esc key. If you do use Esc, it is recommended to set the
|
||||
|
||||
POPUP CALLBACK *popup-callback*
|
||||
|
||||
A callback that is invoked when the popup closes. Used by
|
||||
|popup_filter_menu()|.
|
||||
A callback that is invoked when the popup closes.
|
||||
|
||||
The callback is invoked with two arguments: the ID of the popup window and the
|
||||
result, which could be an index in the popup lines, or whatever was passed as
|
||||
the second argument of `popup_close()`.
|
||||
|
||||
If the popup is closed because the cursor moved, the number -1 is passed to
|
||||
the callback.
|
||||
If the popup is force-closed, e.g. because the cursor moved or CTRL-C was
|
||||
pressed, the number -1 is passed to the callback.
|
||||
|
||||
==============================================================================
|
||||
3. Examples *popup-examples*
|
||||
|
||||
@@ -336,7 +336,10 @@ New Vim variables: ~
|
||||
|v:null| an empty String, used for JSON
|
||||
|v:option_new| new value of the option, used by |OptionSet|
|
||||
|v:option_old| old value of the option, used by |OptionSet|
|
||||
|v:option_oldlocal| old local value of the option, used by |OptionSet|
|
||||
|v:option_oldglobal| old global value of the option, used by |OptionSet|
|
||||
|v:option_type| scope of the set command, used by |OptionSet|
|
||||
|v:option_command| command used to set the option, used by |OptionSet|
|
||||
|v:progpath| the command with which Vim was invoked
|
||||
|v:t_bool| value of Boolean type
|
||||
|v:t_channel| value of Channel type
|
||||
|
||||
+6
-1
@@ -528,6 +528,11 @@ CClink = $(CC)
|
||||
# though you have /dev/sysmouse and includes.
|
||||
#CONF_OPT_SYSMOUSE = --disable-sysmouse
|
||||
|
||||
# libcanberra - For sound support. Default is on for big features.
|
||||
# Uncomment one of the two to chose otherwise.
|
||||
# CONF_OPT_CANBERRA = --enable-canberra
|
||||
# CONF_OPT_CANBERRA = --disable-canberra
|
||||
|
||||
# FEATURES - For creating Vim with more or less features
|
||||
# Uncomment one of these lines when you want to include few to many features.
|
||||
# The default is "huge" for most systems.
|
||||
@@ -1969,7 +1974,7 @@ config auto/config.mk: auto/configure config.mk.in config.h.in
|
||||
$(CONF_ARGS4) $(CONF_ARGS5) $(CONF_ARGS6) \
|
||||
$(CONF_OPT_MZSCHEME) $(CONF_OPT_PLTHOME) \
|
||||
$(CONF_OPT_LUA) $(CONF_OPT_LUA_PREFIX) \
|
||||
$(CONF_OPT_SYSMOUSE); \
|
||||
$(CONF_OPT_SYSMOUSE) $(CONF_OPT_CANBERRA); \
|
||||
fi
|
||||
|
||||
# Use "make reconfig" to rerun configure without cached values.
|
||||
|
||||
Vendored
+43
-24
@@ -844,6 +844,7 @@ enable_desktop_database_update
|
||||
with_motif_lib
|
||||
with_tlib
|
||||
enable_largefile
|
||||
enable_canberra
|
||||
enable_acl
|
||||
enable_gpm
|
||||
enable_sysmouse
|
||||
@@ -1510,6 +1511,7 @@ Optional Features:
|
||||
--disable-icon-cache-update update disabled
|
||||
--disable-desktop-database-update update disabled
|
||||
--disable-largefile omit support for large files
|
||||
--disable-canberra Do not use libcanberra.
|
||||
--disable-acl No check for ACL support.
|
||||
--disable-gpm Don't use gpm (Linux mouse daemon).
|
||||
--disable-sysmouse Don't use sysmouse (mouse in *BSD console).
|
||||
@@ -13036,40 +13038,56 @@ rm -rf conftest*
|
||||
fi
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-canberra argument" >&5
|
||||
$as_echo_n "checking --enable-canberra argument... " >&6; }
|
||||
# Check whether --enable-canberra was given.
|
||||
if test "${enable_canberra+set}" = set; then :
|
||||
enableval=$enable_canberra;
|
||||
else
|
||||
enable_canberra="maybe"
|
||||
fi
|
||||
|
||||
if test "x$PKG_CONFIG" != "xno"; then
|
||||
canberra_lib=`$PKG_CONFIG --libs libcanberrax 2>/dev/null`
|
||||
canberra_cflags=`$PKG_CONFIG --cflags libcanberrax 2>/dev/null`
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: canberra_lib: $canberra_lib" >&5
|
||||
$as_echo "canberra_lib: $canberra_lib" >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: canberra_cflags: $canberra_cflags" >&5
|
||||
$as_echo "canberra_cflags: $canberra_cflags" >&6; }
|
||||
|
||||
if test "$enable_canberra" = "maybe"; then
|
||||
if test "$features" = "big" -o "$features" = "huge"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Defaulting to yes" >&5
|
||||
$as_echo "Defaulting to yes" >&6; }
|
||||
enable_canberra="yes"
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Defaulting to no" >&5
|
||||
$as_echo "Defaulting to no" >&6; }
|
||||
enable_canberra="no"
|
||||
fi
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_canberra" >&5
|
||||
$as_echo "$enable_canberra" >&6; }
|
||||
fi
|
||||
if test "x$canberra_lib" = "x"; then
|
||||
canberra_lib=-lcanberra
|
||||
canberra_cflags=-D_REENTRANT
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: canberra_lib: $canberra_lib" >&5
|
||||
$as_echo "canberra_lib: $canberra_lib" >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: canberra_cflags: $canberra_cflags" >&5
|
||||
$as_echo "canberra_cflags: $canberra_cflags" >&6; }
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcanberra" >&5
|
||||
if test "$enable_canberra" = "yes"; then
|
||||
if test "x$PKG_CONFIG" != "xno"; then
|
||||
canberra_lib=`$PKG_CONFIG --libs libcanberra 2>/dev/null`
|
||||
canberra_cflags=`$PKG_CONFIG --cflags libcanberra 2>/dev/null`
|
||||
fi
|
||||
if test "x$canberra_lib" = "x"; then
|
||||
canberra_lib=-lcanberra
|
||||
canberra_cflags=-D_REENTRANT
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcanberra" >&5
|
||||
$as_echo_n "checking for libcanberra... " >&6; }
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $canberra_cflags"
|
||||
LIBS="$LIBS $canberra_lib"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $canberra_cflags"
|
||||
LIBS="$LIBS $canberra_lib"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
# include <canberra.h>
|
||||
# include <canberra.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
ca_context *hello;
|
||||
ca_context_create(&hello);
|
||||
ca_context *hello;
|
||||
ca_context_create(&hello);
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
@@ -13084,6 +13102,7 @@ $as_echo "no" >&6; }; CFLAGS="$ac_save_CFLAGS"; LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
fi
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for st_blksize" >&5
|
||||
|
||||
+3
-2
@@ -49,7 +49,7 @@ get_beval_info(
|
||||
col = X_2_COL(beval->x);
|
||||
}
|
||||
#endif
|
||||
wp = mouse_find_win(&row, &col);
|
||||
wp = mouse_find_win(&row, &col, FAIL_POPUP);
|
||||
if (wp != NULL && row >= 0 && row < wp->w_height && col < wp->w_width)
|
||||
{
|
||||
/* Found a window and the cursor is in the text. Now find the line
|
||||
@@ -141,6 +141,7 @@ get_beval_info(
|
||||
|
||||
/*
|
||||
* Show a balloon with "mesg" or "list".
|
||||
* Hide the balloon when both are NULL.
|
||||
*/
|
||||
void
|
||||
post_balloon(BalloonEval *beval UNUSED, char_u *mesg, list_T *list UNUSED)
|
||||
@@ -153,7 +154,7 @@ post_balloon(BalloonEval *beval UNUSED, char_u *mesg, list_T *list UNUSED)
|
||||
# endif
|
||||
# ifdef FEAT_BEVAL_GUI
|
||||
if (gui.in_use)
|
||||
/* GUI can't handle a list */
|
||||
// GUI can't handle a list
|
||||
gui_mch_post_balloon(beval, mesg);
|
||||
# endif
|
||||
}
|
||||
|
||||
+11
-2
@@ -5708,7 +5708,7 @@ bt_popup(buf_T *buf)
|
||||
* buffer. This means the buffer name is not a file name.
|
||||
*/
|
||||
int
|
||||
bt_nofile(buf_T *buf)
|
||||
bt_nofilename(buf_T *buf)
|
||||
{
|
||||
return buf != NULL && ((buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f')
|
||||
|| buf->b_p_bt[0] == 'a'
|
||||
@@ -5716,6 +5716,15 @@ bt_nofile(buf_T *buf)
|
||||
|| buf->b_p_bt[0] == 'p');
|
||||
}
|
||||
|
||||
/*
|
||||
* Return TRUE if "buf" has 'buftype' set to "nofile".
|
||||
*/
|
||||
int
|
||||
bt_nofile(buf_T *buf)
|
||||
{
|
||||
return buf != NULL && buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f';
|
||||
}
|
||||
|
||||
/*
|
||||
* Return TRUE if "buf" is a "nowrite", "nofile", "terminal" or "prompt"
|
||||
* buffer.
|
||||
@@ -5782,7 +5791,7 @@ buf_spname(buf_T *buf)
|
||||
|
||||
/* There is no _file_ when 'buftype' is "nofile", b_sfname
|
||||
* contains the name as specified by the user. */
|
||||
if (bt_nofile(buf))
|
||||
if (bt_nofilename(buf))
|
||||
{
|
||||
#ifdef FEAT_TERMINAL
|
||||
if (buf->b_term != NULL)
|
||||
|
||||
+35
-18
@@ -3836,27 +3836,44 @@ dnl define _LARGE_FILES, _FILE_OFFSET_BITS and _LARGEFILE_SOURCE when
|
||||
dnl appropriate, so that off_t is 64 bits when needed.
|
||||
AC_SYS_LARGEFILE
|
||||
|
||||
AC_MSG_CHECKING(--enable-canberra argument)
|
||||
AC_ARG_ENABLE(canberra,
|
||||
[ --disable-canberra Do not use libcanberra.],
|
||||
, [enable_canberra="maybe"])
|
||||
|
||||
if test "x$PKG_CONFIG" != "xno"; then
|
||||
canberra_lib=`$PKG_CONFIG --libs libcanberra 2>/dev/null`
|
||||
canberra_cflags=`$PKG_CONFIG --cflags libcanberra 2>/dev/null`
|
||||
if test "$enable_canberra" = "maybe"; then
|
||||
if test "$features" = "big" -o "$features" = "huge"; then
|
||||
AC_MSG_RESULT(Defaulting to yes)
|
||||
enable_canberra="yes"
|
||||
else
|
||||
AC_MSG_RESULT(Defaulting to no)
|
||||
enable_canberra="no"
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT($enable_canberra)
|
||||
fi
|
||||
if test "x$canberra_lib" = "x"; then
|
||||
canberra_lib=-lcanberra
|
||||
canberra_cflags=-D_REENTRANT
|
||||
if test "$enable_canberra" = "yes"; then
|
||||
if test "x$PKG_CONFIG" != "xno"; then
|
||||
canberra_lib=`$PKG_CONFIG --libs libcanberra 2>/dev/null`
|
||||
canberra_cflags=`$PKG_CONFIG --cflags libcanberra 2>/dev/null`
|
||||
fi
|
||||
if test "x$canberra_lib" = "x"; then
|
||||
canberra_lib=-lcanberra
|
||||
canberra_cflags=-D_REENTRANT
|
||||
fi
|
||||
AC_MSG_CHECKING(for libcanberra)
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $canberra_cflags"
|
||||
LIBS="$LIBS $canberra_lib"
|
||||
AC_TRY_LINK([
|
||||
# include <canberra.h>
|
||||
], [
|
||||
ca_context *hello;
|
||||
ca_context_create(&hello);],
|
||||
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_CANBERRA),
|
||||
AC_MSG_RESULT(no); CFLAGS="$ac_save_CFLAGS"; LIBS="$ac_save_LIBS")
|
||||
fi
|
||||
AC_MSG_CHECKING(for libcanberra)
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $canberra_cflags"
|
||||
LIBS="$LIBS $canberra_lib"
|
||||
AC_TRY_LINK([
|
||||
# include <canberra.h>
|
||||
], [
|
||||
ca_context *hello;
|
||||
ca_context_create(&hello);],
|
||||
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_CANBERRA),
|
||||
AC_MSG_RESULT(no); CFLAGS="$ac_save_CFLAGS"; LIBS="$ac_save_LIBS")
|
||||
|
||||
|
||||
dnl fstatfs() can take 2 to 4 arguments, try to use st_blksize if possible
|
||||
|
||||
+21
@@ -447,6 +447,27 @@ dict_add_list(dict_T *d, char *key, list_T *list)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a callback to dictionary "d".
|
||||
* Returns FAIL when out of memory and when key already exists.
|
||||
*/
|
||||
int
|
||||
dict_add_callback(dict_T *d, char *key, callback_T *cb)
|
||||
{
|
||||
dictitem_T *item;
|
||||
|
||||
item = dictitem_alloc((char_u *)key);
|
||||
if (item == NULL)
|
||||
return FAIL;
|
||||
put_callback(cb, &item->di_tv);
|
||||
if (dict_add(d, item) == FAIL)
|
||||
{
|
||||
dictitem_free(item);
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initializes "iter" for iterating over dictionary items with
|
||||
* dict_iterate_next().
|
||||
|
||||
+1
-1
@@ -5280,7 +5280,7 @@ ins_mousescroll(int dir)
|
||||
col = mouse_col;
|
||||
|
||||
/* find the window at the pointer coordinates */
|
||||
wp = mouse_find_win(&row, &col);
|
||||
wp = mouse_find_win(&row, &col, FAIL_POPUP);
|
||||
if (wp == NULL)
|
||||
return;
|
||||
curwin = wp;
|
||||
|
||||
+126
-32
@@ -28,6 +28,7 @@ static char *e_missbrac = N_("E111: Missing ']'");
|
||||
static char *e_dictrange = N_("E719: Cannot use [:] with a Dictionary");
|
||||
static char *e_letwrong = N_("E734: Wrong variable type for %s=");
|
||||
static char *e_illvar = N_("E461: Illegal variable name: %s");
|
||||
static char *e_cannot_mod = N_("E995: Cannot modify existing variable");
|
||||
#ifdef FEAT_FLOAT
|
||||
static char *e_float_as_string = N_("E806: using Float as a String");
|
||||
#endif
|
||||
@@ -171,6 +172,9 @@ static struct vimvar
|
||||
{VV_NAME("completed_item", VAR_DICT), VV_RO},
|
||||
{VV_NAME("option_new", VAR_STRING), VV_RO},
|
||||
{VV_NAME("option_old", VAR_STRING), VV_RO},
|
||||
{VV_NAME("option_oldlocal", VAR_STRING), VV_RO},
|
||||
{VV_NAME("option_oldglobal", VAR_STRING), VV_RO},
|
||||
{VV_NAME("option_command", VAR_STRING), VV_RO},
|
||||
{VV_NAME("option_type", VAR_STRING), VV_RO},
|
||||
{VV_NAME("errors", VAR_LIST), 0},
|
||||
{VV_NAME("false", VAR_SPECIAL), VV_RO},
|
||||
@@ -193,9 +197,10 @@ static struct vimvar
|
||||
{VV_NAME("termrfgresp", VAR_STRING), VV_RO},
|
||||
{VV_NAME("termrbgresp", VAR_STRING), VV_RO},
|
||||
{VV_NAME("termu7resp", VAR_STRING), VV_RO},
|
||||
{VV_NAME("termstyleresp", VAR_STRING), VV_RO},
|
||||
{VV_NAME("termblinkresp", VAR_STRING), VV_RO},
|
||||
{VV_NAME("event", VAR_DICT), VV_RO},
|
||||
{VV_NAME("termstyleresp", VAR_STRING), VV_RO},
|
||||
{VV_NAME("termblinkresp", VAR_STRING), VV_RO},
|
||||
{VV_NAME("event", VAR_DICT), VV_RO},
|
||||
{VV_NAME("versionlong", VAR_NUMBER), VV_RO},
|
||||
};
|
||||
|
||||
/* shorthand */
|
||||
@@ -211,7 +216,8 @@ static struct vimvar
|
||||
static dictitem_T vimvars_var; /* variable used for v: */
|
||||
#define vimvarht vimvardict.dv_hashtab
|
||||
|
||||
static int ex_let_vars(char_u *arg, typval_T *tv, int copy, int semicolon, int var_count, char_u *nextchars);
|
||||
static void ex_let_const(exarg_T *eap, int is_const);
|
||||
static int ex_let_vars(char_u *arg, typval_T *tv, int copy, int semicolon, int var_count, int is_const, char_u *nextchars);
|
||||
static char_u *skip_var_list(char_u *arg, int *var_count, int *semicolon);
|
||||
static char_u *skip_var_one(char_u *arg);
|
||||
static void list_glob_vars(int *first);
|
||||
@@ -221,8 +227,8 @@ static void list_tab_vars(int *first);
|
||||
static void list_vim_vars(int *first);
|
||||
static void list_script_vars(int *first);
|
||||
static char_u *list_arg_vars(exarg_T *eap, char_u *arg, int *first);
|
||||
static char_u *ex_let_one(char_u *arg, typval_T *tv, int copy, char_u *endchars, char_u *op);
|
||||
static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, int copy, char_u *op);
|
||||
static char_u *ex_let_one(char_u *arg, typval_T *tv, int copy, int is_const, char_u *endchars, char_u *op);
|
||||
static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, int copy, int is_const, char_u *op);
|
||||
static int tv_op(typval_T *tv1, typval_T *tv2, char_u *op);
|
||||
static void ex_unletlock(exarg_T *eap, char_u *argstart, int deep);
|
||||
static int do_unlet_var(lval_T *lp, char_u *name_end, int forceit);
|
||||
@@ -247,6 +253,7 @@ static typval_T *alloc_string_tv(char_u *string);
|
||||
static void delete_var(hashtab_T *ht, hashitem_T *hi);
|
||||
static void list_one_var(dictitem_T *v, char *prefix, int *first);
|
||||
static void list_one_var_a(char *prefix, char_u *name, int type, char_u *string, int *first);
|
||||
static void set_var_const(char_u *name, typval_T *tv, int copy, int is_const);
|
||||
static int tv_check_lock(typval_T *tv, char_u *name, int use_gettext);
|
||||
static char_u *find_option_end(char_u **arg, int *opt_flags);
|
||||
|
||||
@@ -333,7 +340,7 @@ eval_init(void)
|
||||
for (i = 0; i < VV_LEN; ++i)
|
||||
{
|
||||
p = &vimvars[i];
|
||||
if (STRLEN(p->vv_name) > 16)
|
||||
if (STRLEN(p->vv_name) > DICTITEM16_KEY_LEN)
|
||||
{
|
||||
iemsg("INTERNAL: name too long, increase size of dictitem16_T");
|
||||
getout(1);
|
||||
@@ -354,6 +361,7 @@ eval_init(void)
|
||||
hash_add(&compat_hashtab, p->vv_di.di_key);
|
||||
}
|
||||
vimvars[VV_VERSION].vv_nr = VIM_VERSION_100;
|
||||
vimvars[VV_VERSIONLONG].vv_nr = VIM_VERSION_100 * 10000 + highest_patch();
|
||||
|
||||
set_vim_var_nr(VV_SEARCHFORWARD, 1L);
|
||||
set_vim_var_nr(VV_HLSEARCH, 1L);
|
||||
@@ -524,9 +532,9 @@ var_redir_start(char_u *name, int append)
|
||||
tv.v_type = VAR_STRING;
|
||||
tv.vval.v_string = (char_u *)"";
|
||||
if (append)
|
||||
set_var_lval(redir_lval, redir_endp, &tv, TRUE, (char_u *)".");
|
||||
set_var_lval(redir_lval, redir_endp, &tv, TRUE, FALSE, (char_u *)".");
|
||||
else
|
||||
set_var_lval(redir_lval, redir_endp, &tv, TRUE, (char_u *)"=");
|
||||
set_var_lval(redir_lval, redir_endp, &tv, TRUE, FALSE, (char_u *)"=");
|
||||
clear_lval(redir_lval);
|
||||
err = did_emsg;
|
||||
did_emsg |= save_emsg;
|
||||
@@ -599,7 +607,8 @@ var_redir_stop(void)
|
||||
redir_endp = get_lval(redir_varname, NULL, redir_lval,
|
||||
FALSE, FALSE, 0, FNE_CHECK_START);
|
||||
if (redir_endp != NULL && redir_lval->ll_name != NULL)
|
||||
set_var_lval(redir_lval, redir_endp, &tv, FALSE, (char_u *)".");
|
||||
set_var_lval(redir_lval, redir_endp, &tv, FALSE, FALSE,
|
||||
(char_u *)".");
|
||||
clear_lval(redir_lval);
|
||||
}
|
||||
|
||||
@@ -1335,6 +1344,24 @@ heredoc_get(exarg_T *eap, char_u *cmd)
|
||||
*/
|
||||
void
|
||||
ex_let(exarg_T *eap)
|
||||
{
|
||||
ex_let_const(eap, FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* ":const" list all variable values
|
||||
* ":const var1 var2" list variable values
|
||||
* ":const var = expr" assignment command.
|
||||
* ":const [var1, var2] = expr" unpack list.
|
||||
*/
|
||||
void
|
||||
ex_const(exarg_T *eap)
|
||||
{
|
||||
ex_let_const(eap, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
ex_let_const(exarg_T *eap, int is_const)
|
||||
{
|
||||
char_u *arg = eap->arg;
|
||||
char_u *expr = NULL;
|
||||
@@ -1394,7 +1421,7 @@ ex_let(exarg_T *eap)
|
||||
op[0] = '=';
|
||||
op[1] = NUL;
|
||||
(void)ex_let_vars(eap->arg, &rettv, FALSE, semicolon, var_count,
|
||||
op);
|
||||
is_const, op);
|
||||
clear_tv(&rettv);
|
||||
}
|
||||
}
|
||||
@@ -1427,7 +1454,7 @@ ex_let(exarg_T *eap)
|
||||
else if (i != FAIL)
|
||||
{
|
||||
(void)ex_let_vars(eap->arg, &rettv, FALSE, semicolon, var_count,
|
||||
op);
|
||||
is_const, op);
|
||||
clear_tv(&rettv);
|
||||
}
|
||||
}
|
||||
@@ -1445,9 +1472,10 @@ ex_let(exarg_T *eap)
|
||||
ex_let_vars(
|
||||
char_u *arg_start,
|
||||
typval_T *tv,
|
||||
int copy, /* copy values from "tv", don't move */
|
||||
int semicolon, /* from skip_var_list() */
|
||||
int var_count, /* from skip_var_list() */
|
||||
int copy, // copy values from "tv", don't move
|
||||
int semicolon, // from skip_var_list()
|
||||
int var_count, // from skip_var_list()
|
||||
int is_const, // lock variables for const
|
||||
char_u *nextchars)
|
||||
{
|
||||
char_u *arg = arg_start;
|
||||
@@ -1461,7 +1489,7 @@ ex_let_vars(
|
||||
/*
|
||||
* ":let var = expr" or ":for var in list"
|
||||
*/
|
||||
if (ex_let_one(arg, tv, copy, nextchars, nextchars) == NULL)
|
||||
if (ex_let_one(arg, tv, copy, is_const, nextchars, nextchars) == NULL)
|
||||
return FAIL;
|
||||
return OK;
|
||||
}
|
||||
@@ -1491,7 +1519,8 @@ ex_let_vars(
|
||||
while (*arg != ']')
|
||||
{
|
||||
arg = skipwhite(arg + 1);
|
||||
arg = ex_let_one(arg, &item->li_tv, TRUE, (char_u *)",;]", nextchars);
|
||||
arg = ex_let_one(arg, &item->li_tv, TRUE, is_const,
|
||||
(char_u *)",;]", nextchars);
|
||||
item = item->li_next;
|
||||
if (arg == NULL)
|
||||
return FAIL;
|
||||
@@ -1515,8 +1544,8 @@ ex_let_vars(
|
||||
ltv.vval.v_list = l;
|
||||
l->lv_refcount = 1;
|
||||
|
||||
arg = ex_let_one(skipwhite(arg + 1), <v, FALSE,
|
||||
(char_u *)"]", nextchars);
|
||||
arg = ex_let_one(skipwhite(arg + 1), <v, FALSE, is_const,
|
||||
(char_u *)"]", nextchars);
|
||||
clear_tv(<v);
|
||||
if (arg == NULL)
|
||||
return FAIL;
|
||||
@@ -1803,11 +1832,12 @@ list_arg_vars(exarg_T *eap, char_u *arg, int *first)
|
||||
*/
|
||||
static char_u *
|
||||
ex_let_one(
|
||||
char_u *arg, /* points to variable name */
|
||||
typval_T *tv, /* value to assign to variable */
|
||||
int copy, /* copy value from "tv" */
|
||||
char_u *endchars, /* valid chars after variable name or NULL */
|
||||
char_u *op) /* "+", "-", "." or NULL*/
|
||||
char_u *arg, // points to variable name
|
||||
typval_T *tv, // value to assign to variable
|
||||
int copy, // copy value from "tv"
|
||||
int is_const, // lock variable for const
|
||||
char_u *endchars, // valid chars after variable name or NULL
|
||||
char_u *op) // "+", "-", "." or NULL
|
||||
{
|
||||
int c1;
|
||||
char_u *name;
|
||||
@@ -1822,6 +1852,11 @@ ex_let_one(
|
||||
*/
|
||||
if (*arg == '$')
|
||||
{
|
||||
if (is_const)
|
||||
{
|
||||
emsg(_("E996: Cannot lock an environment variable"));
|
||||
return NULL;
|
||||
}
|
||||
/* Find the end of the name. */
|
||||
++arg;
|
||||
name = arg;
|
||||
@@ -1877,6 +1912,11 @@ ex_let_one(
|
||||
*/
|
||||
else if (*arg == '&')
|
||||
{
|
||||
if (is_const)
|
||||
{
|
||||
emsg(_("E996: Cannot lock an option"));
|
||||
return NULL;
|
||||
}
|
||||
/* Find the end of the name. */
|
||||
p = find_option_end(&arg, &opt_flags);
|
||||
if (p == NULL || (endchars != NULL
|
||||
@@ -1941,6 +1981,11 @@ ex_let_one(
|
||||
*/
|
||||
else if (*arg == '@')
|
||||
{
|
||||
if (is_const)
|
||||
{
|
||||
emsg(_("E996: Cannot lock a register"));
|
||||
return NULL;
|
||||
}
|
||||
++arg;
|
||||
if (op != NULL && vim_strchr((char_u *)"+-*/%", *op) != NULL)
|
||||
semsg(_(e_letwrong), op);
|
||||
@@ -1986,7 +2031,7 @@ ex_let_one(
|
||||
emsg(_(e_letunexp));
|
||||
else
|
||||
{
|
||||
set_var_lval(&lv, p, tv, copy, op);
|
||||
set_var_lval(&lv, p, tv, copy, is_const, op);
|
||||
arg_end = p;
|
||||
}
|
||||
}
|
||||
@@ -2428,6 +2473,7 @@ set_var_lval(
|
||||
char_u *endp,
|
||||
typval_T *rettv,
|
||||
int copy,
|
||||
int is_const, // Disallow to modify existing variable for :const
|
||||
char_u *op)
|
||||
{
|
||||
int cc;
|
||||
@@ -2493,6 +2539,13 @@ set_var_lval(
|
||||
{
|
||||
typval_T tv;
|
||||
|
||||
if (is_const)
|
||||
{
|
||||
emsg(_(e_cannot_mod));
|
||||
*endp = cc;
|
||||
return;
|
||||
}
|
||||
|
||||
// handle +=, -=, *=, /=, %= and .=
|
||||
di = NULL;
|
||||
if (get_var_tv(lp->ll_name, (int)STRLEN(lp->ll_name),
|
||||
@@ -2507,7 +2560,7 @@ set_var_lval(
|
||||
}
|
||||
}
|
||||
else
|
||||
set_var(lp->ll_name, rettv, copy);
|
||||
set_var_const(lp->ll_name, rettv, copy, is_const);
|
||||
*endp = cc;
|
||||
}
|
||||
else if (var_check_lock(lp->ll_newkey == NULL
|
||||
@@ -2519,6 +2572,12 @@ set_var_lval(
|
||||
listitem_T *ll_li = lp->ll_li;
|
||||
int ll_n1 = lp->ll_n1;
|
||||
|
||||
if (is_const)
|
||||
{
|
||||
emsg(_("E996: Cannot lock a range"));
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check whether any of the list items is locked
|
||||
*/
|
||||
@@ -2572,6 +2631,11 @@ set_var_lval(
|
||||
/*
|
||||
* Assign to a List or Dictionary item.
|
||||
*/
|
||||
if (is_const)
|
||||
{
|
||||
emsg(_("E996: Cannot lock a list or dict"));
|
||||
return;
|
||||
}
|
||||
if (lp->ll_newkey != NULL)
|
||||
{
|
||||
if (op != NULL && *op != '=')
|
||||
@@ -2858,8 +2922,8 @@ next_for_item(void *fi_void, char_u *arg)
|
||||
tv.v_lock = VAR_FIXED;
|
||||
tv.vval.v_number = blob_get(fi->fi_blob, fi->fi_bi);
|
||||
++fi->fi_bi;
|
||||
return ex_let_vars(arg, &tv, TRUE,
|
||||
fi->fi_semicolon, fi->fi_varcount, NULL) == OK;
|
||||
return ex_let_vars(arg, &tv, TRUE, fi->fi_semicolon,
|
||||
fi->fi_varcount, FALSE, NULL) == OK;
|
||||
}
|
||||
|
||||
item = fi->fi_lw.lw_item;
|
||||
@@ -2868,8 +2932,8 @@ next_for_item(void *fi_void, char_u *arg)
|
||||
else
|
||||
{
|
||||
fi->fi_lw.lw_item = item->li_next;
|
||||
result = (ex_let_vars(arg, &item->li_tv, TRUE,
|
||||
fi->fi_semicolon, fi->fi_varcount, NULL) == OK);
|
||||
result = (ex_let_vars(arg, &item->li_tv, TRUE, fi->fi_semicolon,
|
||||
fi->fi_varcount, FALSE, NULL) == OK);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -8049,7 +8113,22 @@ list_one_var_a(
|
||||
set_var(
|
||||
char_u *name,
|
||||
typval_T *tv,
|
||||
int copy) /* make copy of value in "tv" */
|
||||
int copy) // make copy of value in "tv"
|
||||
{
|
||||
set_var_const(name, tv, copy, FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set variable "name" to value in "tv".
|
||||
* If the variable already exists and "is_const" is FALSE the value is updated.
|
||||
* Otherwise the variable is created.
|
||||
*/
|
||||
static void
|
||||
set_var_const(
|
||||
char_u *name,
|
||||
typval_T *tv,
|
||||
int copy, // make copy of value in "tv"
|
||||
int is_const) // disallow to modify existing variable
|
||||
{
|
||||
dictitem_T *v;
|
||||
char_u *varname;
|
||||
@@ -8073,6 +8152,12 @@ set_var(
|
||||
|
||||
if (v != NULL)
|
||||
{
|
||||
if (is_const)
|
||||
{
|
||||
emsg(_(e_cannot_mod));
|
||||
return;
|
||||
}
|
||||
|
||||
/* existing variable, need to clear the value */
|
||||
if (var_check_ro(v->di_flags, name, FALSE)
|
||||
|| var_check_lock(v->di_tv.v_lock, name, FALSE))
|
||||
@@ -8150,6 +8235,8 @@ set_var(
|
||||
return;
|
||||
}
|
||||
v->di_flags = DI_FLAGS_ALLOC;
|
||||
if (is_const)
|
||||
v->di_flags |= DI_FLAGS_LOCK;
|
||||
}
|
||||
|
||||
if (copy || tv->v_type == VAR_NUMBER || tv->v_type == VAR_FLOAT)
|
||||
@@ -8160,6 +8247,9 @@ set_var(
|
||||
v->di_tv.v_lock = 0;
|
||||
init_tv(tv);
|
||||
}
|
||||
|
||||
if (is_const)
|
||||
v->di_tv.v_lock |= VAR_LOCKED;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -9413,14 +9503,18 @@ last_set_msg(sctx_T script_ctx)
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset v:option_new, v:option_old and v:option_type.
|
||||
* reset v:option_new, v:option_old, v:option_oldlocal, v:option_oldglobal,
|
||||
* v:option_type, and v:option_command.
|
||||
*/
|
||||
void
|
||||
reset_v_option_vars(void)
|
||||
{
|
||||
set_vim_var_string(VV_OPTION_NEW, NULL, -1);
|
||||
set_vim_var_string(VV_OPTION_OLD, NULL, -1);
|
||||
set_vim_var_string(VV_OPTION_OLDLOCAL, NULL, -1);
|
||||
set_vim_var_string(VV_OPTION_OLDGLOBAL, NULL, -1);
|
||||
set_vim_var_string(VV_OPTION_TYPE, NULL, -1);
|
||||
set_vim_var_string(VV_OPTION_COMMAND, NULL, -1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+17
-4
@@ -815,10 +815,17 @@ static struct fst
|
||||
{"popup_clear", 0, 0, f_popup_clear},
|
||||
{"popup_close", 1, 2, f_popup_close},
|
||||
{"popup_create", 2, 2, f_popup_create},
|
||||
{"popup_dialog", 2, 2, f_popup_dialog},
|
||||
{"popup_filter_menu", 2, 2, f_popup_filter_menu},
|
||||
{"popup_filter_yesno", 2, 2, f_popup_filter_yesno},
|
||||
{"popup_getoptions", 1, 1, f_popup_getoptions},
|
||||
{"popup_getpos", 1, 1, f_popup_getpos},
|
||||
{"popup_hide", 1, 1, f_popup_hide},
|
||||
{"popup_menu", 2, 2, f_popup_menu},
|
||||
{"popup_move", 2, 2, f_popup_move},
|
||||
{"popup_notification", 2, 2, f_popup_notification},
|
||||
{"popup_setoptions", 2, 2, f_popup_setoptions},
|
||||
{"popup_settext", 2, 2, f_popup_settext},
|
||||
{"popup_show", 1, 1, f_popup_show},
|
||||
#endif
|
||||
#ifdef FEAT_FLOAT
|
||||
@@ -1942,7 +1949,7 @@ find_buffer(typval_T *avar)
|
||||
if (buf->b_fname != NULL
|
||||
&& (path_with_url(buf->b_fname)
|
||||
#ifdef FEAT_QUICKFIX
|
||||
|| bt_nofile(buf)
|
||||
|| bt_nofilename(buf)
|
||||
#endif
|
||||
)
|
||||
&& STRCMP(buf->b_fname, avar->vval.v_string) == 0)
|
||||
@@ -5162,12 +5169,18 @@ f_getchar(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
/* Find the window at the mouse coordinates and compute the
|
||||
* text position. */
|
||||
win = mouse_find_win(&row, &col);
|
||||
win = mouse_find_win(&row, &col, FIND_POPUP);
|
||||
if (win == NULL)
|
||||
return;
|
||||
(void)mouse_comp_pos(win, &row, &col, &lnum);
|
||||
for (wp = firstwin; wp != win; wp = wp->w_next)
|
||||
++winnr;
|
||||
# ifdef FEAT_TEXT_PROP
|
||||
if (bt_popup(win->w_buffer))
|
||||
winnr = 0;
|
||||
else
|
||||
# endif
|
||||
for (wp = firstwin; wp != win && wp != NULL;
|
||||
wp = wp->w_next)
|
||||
++winnr;
|
||||
set_vim_var_nr(VV_MOUSE_WIN, winnr);
|
||||
set_vim_var_nr(VV_MOUSE_WINID, win->w_id);
|
||||
set_vim_var_nr(VV_MOUSE_LNUM, lnum);
|
||||
|
||||
+25
-25
@@ -8,29 +8,29 @@ static const unsigned short cmdidxs1[26] =
|
||||
/* a */ 0,
|
||||
/* b */ 19,
|
||||
/* c */ 42,
|
||||
/* d */ 107,
|
||||
/* e */ 129,
|
||||
/* f */ 149,
|
||||
/* g */ 165,
|
||||
/* h */ 171,
|
||||
/* i */ 180,
|
||||
/* j */ 198,
|
||||
/* k */ 200,
|
||||
/* l */ 205,
|
||||
/* m */ 267,
|
||||
/* n */ 287,
|
||||
/* o */ 307,
|
||||
/* p */ 319,
|
||||
/* q */ 358,
|
||||
/* r */ 361,
|
||||
/* s */ 381,
|
||||
/* t */ 449,
|
||||
/* u */ 494,
|
||||
/* v */ 505,
|
||||
/* w */ 523,
|
||||
/* x */ 537,
|
||||
/* y */ 547,
|
||||
/* z */ 548
|
||||
/* d */ 108,
|
||||
/* e */ 130,
|
||||
/* f */ 150,
|
||||
/* g */ 166,
|
||||
/* h */ 172,
|
||||
/* i */ 181,
|
||||
/* j */ 199,
|
||||
/* k */ 201,
|
||||
/* l */ 206,
|
||||
/* m */ 268,
|
||||
/* n */ 288,
|
||||
/* o */ 308,
|
||||
/* p */ 320,
|
||||
/* q */ 359,
|
||||
/* r */ 362,
|
||||
/* s */ 382,
|
||||
/* t */ 450,
|
||||
/* u */ 495,
|
||||
/* v */ 506,
|
||||
/* w */ 524,
|
||||
/* x */ 538,
|
||||
/* y */ 548,
|
||||
/* z */ 549
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -43,7 +43,7 @@ static const unsigned char cmdidxs2[26][26] =
|
||||
{ /* a b c d e f g h i j k l m n o p q r s t u v w x y z */
|
||||
/* a */ { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 6, 0, 0, 0, 7, 15, 0, 16, 0, 0, 0, 0, 0 },
|
||||
/* b */ { 2, 0, 0, 4, 5, 7, 0, 0, 0, 0, 0, 8, 9, 10, 11, 12, 0, 13, 0, 0, 0, 0, 22, 0, 0, 0 },
|
||||
/* c */ { 3, 12, 16, 18, 20, 22, 25, 0, 0, 0, 0, 33, 37, 40, 46, 55, 57, 58, 59, 0, 61, 0, 64, 0, 0, 0 },
|
||||
/* c */ { 3, 12, 16, 18, 20, 22, 25, 0, 0, 0, 0, 33, 37, 40, 46, 56, 58, 59, 60, 0, 62, 0, 65, 0, 0, 0 },
|
||||
/* d */ { 0, 0, 0, 0, 0, 0, 0, 0, 6, 15, 0, 16, 0, 0, 17, 0, 0, 19, 20, 0, 0, 0, 0, 0, 0, 0 },
|
||||
/* e */ { 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0 },
|
||||
/* f */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 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 }
|
||||
};
|
||||
|
||||
static const int command_count = 561;
|
||||
static const int command_count = 562;
|
||||
|
||||
+1
-1
@@ -3399,7 +3399,7 @@ check_overwrite(
|
||||
|| (buf->b_flags & BF_READERR))
|
||||
&& !p_wa
|
||||
#ifdef FEAT_QUICKFIX
|
||||
&& !bt_nofile(buf)
|
||||
&& !bt_nofilename(buf)
|
||||
#endif
|
||||
&& vim_fexists(ffname))
|
||||
{
|
||||
|
||||
@@ -401,6 +401,9 @@ EX(CMD_continue, "continue", ex_continue,
|
||||
EX(CMD_confirm, "confirm", ex_wrongmodifier,
|
||||
NEEDARG|EXTRA|NOTRLCOM|CMDWIN,
|
||||
ADDR_NONE),
|
||||
EX(CMD_const, "const", ex_const,
|
||||
EXTRA|NOTRLCOM|SBOXOK|CMDWIN,
|
||||
ADDR_NONE),
|
||||
EX(CMD_copen, "copen", ex_copen,
|
||||
RANGE|COUNT|TRLBAR,
|
||||
ADDR_OTHER),
|
||||
|
||||
+1
-1
@@ -1937,7 +1937,7 @@ do_argfile(exarg_T *eap, int argn)
|
||||
char_u *p;
|
||||
int old_arg_idx = curwin->w_arg_idx;
|
||||
|
||||
if (NOT_IN_POPUP_WINDOW)
|
||||
if (ERROR_IF_POPUP_WINDOW)
|
||||
return;
|
||||
if (argn < 0 || argn >= ARGCOUNT)
|
||||
{
|
||||
|
||||
+10
-8
@@ -297,6 +297,7 @@ static void ex_tag_cmd(exarg_T *eap, char_u *name);
|
||||
# define ex_endtry ex_ni
|
||||
# define ex_endfunction ex_ni
|
||||
# define ex_let ex_ni
|
||||
# define ex_const ex_ni
|
||||
# define ex_unlet ex_ni
|
||||
# define ex_lockvar ex_ni
|
||||
# define ex_unlockvar ex_ni
|
||||
@@ -4867,6 +4868,7 @@ replace_makeprg(exarg_T *eap, char_u *p, char_u **cmdlinep)
|
||||
|
||||
/*
|
||||
* Expand file name in Ex command argument.
|
||||
* When an error is detected, "errormsgp" is set to a non-NULL pointer.
|
||||
* Return FAIL for failure, OK otherwise.
|
||||
*/
|
||||
int
|
||||
@@ -5467,7 +5469,7 @@ ex_doautocmd(exarg_T *eap)
|
||||
static void
|
||||
ex_bunload(exarg_T *eap)
|
||||
{
|
||||
if (NOT_IN_POPUP_WINDOW)
|
||||
if (ERROR_IF_POPUP_WINDOW)
|
||||
return;
|
||||
eap->errmsg = do_bufdel(
|
||||
eap->cmdidx == CMD_bdelete ? DOBUF_DEL
|
||||
@@ -5483,7 +5485,7 @@ ex_bunload(exarg_T *eap)
|
||||
static void
|
||||
ex_buffer(exarg_T *eap)
|
||||
{
|
||||
if (NOT_IN_POPUP_WINDOW)
|
||||
if (ERROR_IF_POPUP_WINDOW)
|
||||
return;
|
||||
if (*eap->arg)
|
||||
eap->errmsg = e_trailing;
|
||||
@@ -6787,7 +6789,7 @@ ex_splitview(exarg_T *eap)
|
||||
|| eap->cmdidx == CMD_tabfind
|
||||
|| eap->cmdidx == CMD_tabnew;
|
||||
|
||||
if (NOT_IN_POPUP_WINDOW)
|
||||
if (ERROR_IF_POPUP_WINDOW)
|
||||
return;
|
||||
|
||||
#ifdef FEAT_GUI
|
||||
@@ -6917,7 +6919,7 @@ ex_tabnext(exarg_T *eap)
|
||||
{
|
||||
int tab_number;
|
||||
|
||||
if (NOT_IN_POPUP_WINDOW)
|
||||
if (ERROR_IF_POPUP_WINDOW)
|
||||
return;
|
||||
switch (eap->cmdidx)
|
||||
{
|
||||
@@ -7170,7 +7172,7 @@ do_exedit(
|
||||
int need_hide;
|
||||
int exmode_was = exmode_active;
|
||||
|
||||
if (NOT_IN_POPUP_WINDOW)
|
||||
if (ERROR_IF_POPUP_WINDOW)
|
||||
return;
|
||||
/*
|
||||
* ":vi" command ends Ex mode.
|
||||
@@ -9940,7 +9942,7 @@ makeopens(
|
||||
&& wp->w_buffer->b_ffname != NULL
|
||||
&& !bt_help(wp->w_buffer)
|
||||
#ifdef FEAT_QUICKFIX
|
||||
&& !bt_nofile(wp->w_buffer)
|
||||
&& !bt_nofilename(wp->w_buffer)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
@@ -10267,7 +10269,7 @@ ses_do_win(win_T *wp)
|
||||
if (wp->w_buffer->b_fname == NULL
|
||||
#ifdef FEAT_QUICKFIX
|
||||
/* When 'buftype' is "nofile" can't restore the window contents. */
|
||||
|| bt_nofile(wp->w_buffer)
|
||||
|| bt_nofilename(wp->w_buffer)
|
||||
#endif
|
||||
)
|
||||
return (ssop_flags & SSOP_BLANK);
|
||||
@@ -10354,7 +10356,7 @@ put_view(
|
||||
*/
|
||||
if (wp->w_buffer->b_ffname != NULL
|
||||
# ifdef FEAT_QUICKFIX
|
||||
&& !bt_nofile(wp->w_buffer)
|
||||
&& !bt_nofilename(wp->w_buffer)
|
||||
# endif
|
||||
)
|
||||
{
|
||||
|
||||
+1
-1
@@ -666,7 +666,7 @@
|
||||
/*
|
||||
* sound - currently only with libcanberra
|
||||
*/
|
||||
#if !defined(FEAT_SOUND) && defined(FEAT_BIG) && defined(HAVE_CANBERRA)
|
||||
#if !defined(FEAT_SOUND) && defined(HAVE_CANBERRA)
|
||||
# define FEAT_SOUND
|
||||
#endif
|
||||
|
||||
|
||||
+5
-5
@@ -3160,7 +3160,7 @@ buf_write(
|
||||
&& whole
|
||||
&& buf == curbuf
|
||||
#ifdef FEAT_QUICKFIX
|
||||
&& !bt_nofile(buf)
|
||||
&& !bt_nofilename(buf)
|
||||
#endif
|
||||
&& !filtering
|
||||
&& (!append || vim_strchr(p_cpo, CPO_FNAMEAPP) != NULL)
|
||||
@@ -3237,7 +3237,7 @@ buf_write(
|
||||
sfname, sfname, FALSE, curbuf, eap)))
|
||||
{
|
||||
#ifdef FEAT_QUICKFIX
|
||||
if (overwriting && bt_nofile(curbuf))
|
||||
if (overwriting && bt_nofilename(curbuf))
|
||||
nofile_err = TRUE;
|
||||
else
|
||||
#endif
|
||||
@@ -3270,7 +3270,7 @@ buf_write(
|
||||
else
|
||||
{
|
||||
#ifdef FEAT_QUICKFIX
|
||||
if (overwriting && bt_nofile(curbuf))
|
||||
if (overwriting && bt_nofilename(curbuf))
|
||||
nofile_err = TRUE;
|
||||
else
|
||||
#endif
|
||||
@@ -3284,7 +3284,7 @@ buf_write(
|
||||
sfname, sfname, FALSE, curbuf, eap)))
|
||||
{
|
||||
#ifdef FEAT_QUICKFIX
|
||||
if (overwriting && bt_nofile(curbuf))
|
||||
if (overwriting && bt_nofilename(curbuf))
|
||||
nofile_err = TRUE;
|
||||
else
|
||||
#endif
|
||||
@@ -6087,7 +6087,7 @@ shorten_buf_fname(buf_T *buf, char_u *dirname, int force)
|
||||
|
||||
if (buf->b_fname != NULL
|
||||
#ifdef FEAT_QUICKFIX
|
||||
&& !bt_nofile(buf)
|
||||
&& !bt_nofilename(buf)
|
||||
#endif
|
||||
&& !path_with_url(buf->b_fname)
|
||||
&& (force
|
||||
|
||||
+5
-4
@@ -545,11 +545,11 @@ EXTERN int gui_win_y INIT(= -1);
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_CLIPBOARD
|
||||
EXTERN VimClipboard clip_star; /* PRIMARY selection in X11 */
|
||||
EXTERN Clipboard_T clip_star; // PRIMARY selection in X11
|
||||
# ifdef FEAT_X11
|
||||
EXTERN VimClipboard clip_plus; /* CLIPBOARD selection in X11 */
|
||||
EXTERN Clipboard_T clip_plus; // CLIPBOARD selection in X11
|
||||
# else
|
||||
# define clip_plus clip_star /* there is only one clipboard */
|
||||
# define clip_plus clip_star // there is only one clipboard
|
||||
# define ONE_CLIPBOARD
|
||||
# endif
|
||||
|
||||
@@ -599,7 +599,8 @@ EXTERN win_T *aucmd_win; /* window used in aucmd_prepbuf() */
|
||||
EXTERN int aucmd_win_used INIT(= FALSE); /* aucmd_win is being used */
|
||||
|
||||
#ifdef FEAT_TEXT_PROP
|
||||
EXTERN win_T *first_popupwin; // first global popup window
|
||||
EXTERN win_T *first_popupwin; // first global popup window
|
||||
EXTERN win_T *popup_dragwin INIT(= NULL); // popup window being dragged
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -4976,7 +4976,7 @@ xy2win(int x, int y)
|
||||
if (row < 0 || col < 0) /* before first window */
|
||||
return NULL;
|
||||
# endif
|
||||
wp = mouse_find_win(&row, &col);
|
||||
wp = mouse_find_win(&row, &col, FALSE);
|
||||
if (wp == NULL)
|
||||
return NULL;
|
||||
#ifdef FEAT_MOUSESHAPE
|
||||
@@ -5435,7 +5435,7 @@ gui_wingoto_xy(int x, int y)
|
||||
|
||||
if (row >= 0 && col >= 0)
|
||||
{
|
||||
wp = mouse_find_win(&row, &col);
|
||||
wp = mouse_find_win(&row, &col, FAIL_POPUP);
|
||||
if (wp != NULL && wp != curwin)
|
||||
win_goto(wp);
|
||||
}
|
||||
|
||||
+7
-7
@@ -1394,7 +1394,7 @@ selection_received_cb(GtkWidget *widget UNUSED,
|
||||
guint time_ UNUSED,
|
||||
gpointer user_data UNUSED)
|
||||
{
|
||||
VimClipboard *cbd;
|
||||
Clipboard_T *cbd;
|
||||
char_u *text;
|
||||
char_u *tmpbuf = NULL;
|
||||
guchar *tmpbuf_utf8 = NULL;
|
||||
@@ -1511,7 +1511,7 @@ selection_get_cb(GtkWidget *widget UNUSED,
|
||||
int length;
|
||||
int motion_type;
|
||||
GdkAtom type;
|
||||
VimClipboard *cbd;
|
||||
Clipboard_T *cbd;
|
||||
|
||||
if (gtk_selection_data_get_selection(selection_data)
|
||||
== clip_plus.gtk_sel_atom)
|
||||
@@ -6602,7 +6602,7 @@ gui_mch_insert_lines(int row, int num_lines)
|
||||
* X Selection stuff, for cutting and pasting text to other windows.
|
||||
*/
|
||||
void
|
||||
clip_mch_request_selection(VimClipboard *cbd)
|
||||
clip_mch_request_selection(Clipboard_T *cbd)
|
||||
{
|
||||
GdkAtom target;
|
||||
unsigned i;
|
||||
@@ -6639,7 +6639,7 @@ clip_mch_request_selection(VimClipboard *cbd)
|
||||
* Disown the selection.
|
||||
*/
|
||||
void
|
||||
clip_mch_lose_selection(VimClipboard *cbd UNUSED)
|
||||
clip_mch_lose_selection(Clipboard_T *cbd UNUSED)
|
||||
{
|
||||
if (!in_selection_clear_event)
|
||||
{
|
||||
@@ -6652,7 +6652,7 @@ clip_mch_lose_selection(VimClipboard *cbd UNUSED)
|
||||
* Own the selection and return OK if it worked.
|
||||
*/
|
||||
int
|
||||
clip_mch_own_selection(VimClipboard *cbd)
|
||||
clip_mch_own_selection(Clipboard_T *cbd)
|
||||
{
|
||||
int success;
|
||||
|
||||
@@ -6667,13 +6667,13 @@ clip_mch_own_selection(VimClipboard *cbd)
|
||||
* will fill in the selection only when requested by another app.
|
||||
*/
|
||||
void
|
||||
clip_mch_set_selection(VimClipboard *cbd UNUSED)
|
||||
clip_mch_set_selection(Clipboard_T *cbd UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
#if (defined(FEAT_XCLIPBOARD) && defined(USE_SYSTEM)) || defined(PROTO)
|
||||
int
|
||||
clip_gtk_owner_exists(VimClipboard *cbd)
|
||||
clip_gtk_owner_exists(Clipboard_T *cbd)
|
||||
{
|
||||
return gdk_selection_owner_get(cbd->gtk_sel_atom) != NULL;
|
||||
}
|
||||
|
||||
+4
-4
@@ -4444,7 +4444,7 @@ gui_mch_insert_lines(int row, int num_lines)
|
||||
*/
|
||||
|
||||
void
|
||||
clip_mch_request_selection(VimClipboard *cbd)
|
||||
clip_mch_request_selection(Clipboard_T *cbd)
|
||||
{
|
||||
|
||||
Handle textOfClip;
|
||||
@@ -4534,7 +4534,7 @@ clip_mch_request_selection(VimClipboard *cbd)
|
||||
}
|
||||
|
||||
void
|
||||
clip_mch_lose_selection(VimClipboard *cbd)
|
||||
clip_mch_lose_selection(Clipboard_T *cbd)
|
||||
{
|
||||
/*
|
||||
* TODO: Really nothing to do?
|
||||
@@ -4542,7 +4542,7 @@ clip_mch_lose_selection(VimClipboard *cbd)
|
||||
}
|
||||
|
||||
int
|
||||
clip_mch_own_selection(VimClipboard *cbd)
|
||||
clip_mch_own_selection(Clipboard_T *cbd)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
@@ -4551,7 +4551,7 @@ clip_mch_own_selection(VimClipboard *cbd)
|
||||
* Send the current selection to the clipboard.
|
||||
*/
|
||||
void
|
||||
clip_mch_set_selection(VimClipboard *cbd)
|
||||
clip_mch_set_selection(Clipboard_T *cbd)
|
||||
{
|
||||
Handle textOfClip;
|
||||
long scrapSize;
|
||||
|
||||
+4
-4
@@ -2872,26 +2872,26 @@ gui_x11_check_copy_area(void)
|
||||
*/
|
||||
|
||||
void
|
||||
clip_mch_lose_selection(VimClipboard *cbd)
|
||||
clip_mch_lose_selection(Clipboard_T *cbd)
|
||||
{
|
||||
clip_x11_lose_selection(vimShell, cbd);
|
||||
}
|
||||
|
||||
int
|
||||
clip_mch_own_selection(VimClipboard *cbd)
|
||||
clip_mch_own_selection(Clipboard_T *cbd)
|
||||
{
|
||||
return clip_x11_own_selection(vimShell, cbd);
|
||||
}
|
||||
|
||||
void
|
||||
clip_mch_request_selection(VimClipboard *cbd)
|
||||
clip_mch_request_selection(Clipboard_T *cbd)
|
||||
{
|
||||
clip_x11_request_selection(vimShell, gui.dpy, cbd);
|
||||
}
|
||||
|
||||
void
|
||||
clip_mch_set_selection(
|
||||
VimClipboard *cbd)
|
||||
Clipboard_T *cbd)
|
||||
{
|
||||
clip_x11_set_selection(cbd);
|
||||
}
|
||||
|
||||
+3
-2
@@ -340,8 +340,9 @@
|
||||
/* Wether a command index indicates a user command. */
|
||||
#define IS_USER_CMDIDX(idx) ((int)(idx) < 0)
|
||||
|
||||
// Give an error in curwin is a popup window and evaluate to TRUE.
|
||||
#ifdef FEAT_TEXT_PROP
|
||||
# define NOT_IN_POPUP_WINDOW not_in_popup_window()
|
||||
# define ERROR_IF_POPUP_WINDOW error_if_popup_window()
|
||||
#else
|
||||
# define NOT_IN_POPUP_WINDOW 0
|
||||
# define ERROR_IF_POPUP_WINDOW 0
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -4528,7 +4528,7 @@ nv_mousescroll(cmdarg_T *cap)
|
||||
col = mouse_col;
|
||||
|
||||
/* find the window at the pointer coordinates */
|
||||
wp = mouse_find_win(&row, &col);
|
||||
wp = mouse_find_win(&row, &col, FAIL_POPUP);
|
||||
if (wp == NULL)
|
||||
return;
|
||||
curwin = wp;
|
||||
|
||||
@@ -6460,7 +6460,7 @@ x11_export_final_selection(void)
|
||||
#endif
|
||||
|
||||
void
|
||||
clip_free_selection(VimClipboard *cbd)
|
||||
clip_free_selection(Clipboard_T *cbd)
|
||||
{
|
||||
yankreg_T *y_ptr = y_current;
|
||||
|
||||
@@ -6477,7 +6477,7 @@ clip_free_selection(VimClipboard *cbd)
|
||||
* Get the selected text and put it in register '*' or '+'.
|
||||
*/
|
||||
void
|
||||
clip_get_selection(VimClipboard *cbd)
|
||||
clip_get_selection(Clipboard_T *cbd)
|
||||
{
|
||||
yankreg_T *old_y_previous, *old_y_current;
|
||||
pos_T old_cursor;
|
||||
@@ -6542,7 +6542,7 @@ clip_yank_selection(
|
||||
int type,
|
||||
char_u *str,
|
||||
long len,
|
||||
VimClipboard *cbd)
|
||||
Clipboard_T *cbd)
|
||||
{
|
||||
yankreg_T *y_ptr;
|
||||
|
||||
@@ -6562,7 +6562,7 @@ clip_yank_selection(
|
||||
* Returns the motion type, or -1 for failure.
|
||||
*/
|
||||
int
|
||||
clip_convert_selection(char_u **str, long_u *len, VimClipboard *cbd)
|
||||
clip_convert_selection(char_u **str, long_u *len, Clipboard_T *cbd)
|
||||
{
|
||||
char_u *p;
|
||||
int lnum;
|
||||
|
||||
+175
-17
@@ -625,7 +625,7 @@ static struct vimoption options[] =
|
||||
(char_u *)"~",
|
||||
#endif
|
||||
(char_u *)0L} SCTX_INIT},
|
||||
{"backupskip", "bsk", P_STRING|P_VI_DEF|P_ONECOMMA,
|
||||
{"backupskip", "bsk", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP,
|
||||
#ifdef FEAT_WILDIGN
|
||||
(char_u *)&p_bsk, PV_NONE,
|
||||
{(char_u *)"", (char_u *)0L}
|
||||
@@ -4440,12 +4440,25 @@ set_title_defaults(void)
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_EVAL)
|
||||
/*
|
||||
* Trigger the OptionSet autocommand.
|
||||
* "opt_idx" is the index of the option being set.
|
||||
* "opt_flags" can be OPT_LOCAL etc.
|
||||
* "oldval" the old value
|
||||
* "oldval_l" the old local value (only non-NULL if global and local value
|
||||
* are set)
|
||||
* "oldval_g" the old global value (only non-NULL if global and local value
|
||||
* are set)
|
||||
* "newval" the new value
|
||||
*/
|
||||
static void
|
||||
trigger_optionsset_string(
|
||||
int opt_idx,
|
||||
int opt_flags,
|
||||
char_u *oldval,
|
||||
char_u *newval)
|
||||
char_u *oldval,
|
||||
char_u *oldval_l,
|
||||
char_u *oldval_g,
|
||||
char_u *newval)
|
||||
{
|
||||
// Don't do this recursively.
|
||||
if (oldval != NULL && newval != NULL
|
||||
@@ -4458,6 +4471,27 @@ trigger_optionsset_string(
|
||||
set_vim_var_string(VV_OPTION_OLD, oldval, -1);
|
||||
set_vim_var_string(VV_OPTION_NEW, newval, -1);
|
||||
set_vim_var_string(VV_OPTION_TYPE, buf_type, -1);
|
||||
if (opt_flags & OPT_LOCAL)
|
||||
{
|
||||
set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"setlocal", -1);
|
||||
set_vim_var_string(VV_OPTION_OLDLOCAL, oldval, -1);
|
||||
}
|
||||
if (opt_flags & OPT_GLOBAL)
|
||||
{
|
||||
set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"setglobal", -1);
|
||||
set_vim_var_string(VV_OPTION_OLDGLOBAL, oldval, -1);
|
||||
}
|
||||
if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
|
||||
{
|
||||
set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"set", -1);
|
||||
set_vim_var_string(VV_OPTION_OLDLOCAL, oldval_l, -1);
|
||||
set_vim_var_string(VV_OPTION_OLDGLOBAL, oldval_g, -1);
|
||||
}
|
||||
if (opt_flags & OPT_MODELINE)
|
||||
{
|
||||
set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"modeline", -1);
|
||||
set_vim_var_string(VV_OPTION_OLDLOCAL, oldval, -1);
|
||||
}
|
||||
apply_autocmds(EVENT_OPTIONSET,
|
||||
(char_u *)options[opt_idx].fullname, NULL, FALSE, NULL);
|
||||
reset_v_option_vars();
|
||||
@@ -4911,7 +4945,8 @@ do_set(
|
||||
* hex numbers. */
|
||||
vim_str2nr(arg, NULL, &i, STR2NR_ALL,
|
||||
&value, NULL, 0, TRUE);
|
||||
if (i == 0 || (arg[i] != NUL && !VIM_ISWHITE(arg[i])))
|
||||
if (i == 0 || (arg[i] != NUL
|
||||
&& !VIM_ISWHITE(arg[i])))
|
||||
{
|
||||
errmsg = N_("E521: Number required after =");
|
||||
goto skip;
|
||||
@@ -4939,8 +4974,12 @@ do_set(
|
||||
char_u *oldval = NULL; /* previous value if *varp */
|
||||
char_u *newval;
|
||||
char_u *origval = NULL;
|
||||
char_u *origval_l = NULL;
|
||||
char_u *origval_g = NULL;
|
||||
#if defined(FEAT_EVAL)
|
||||
char_u *saved_origval = NULL;
|
||||
char_u *saved_origval_l = NULL;
|
||||
char_u *saved_origval_g = NULL;
|
||||
char_u *saved_newval = NULL;
|
||||
#endif
|
||||
unsigned newlen;
|
||||
@@ -4960,8 +4999,23 @@ do_set(
|
||||
* new value is valid. */
|
||||
oldval = *(char_u **)varp;
|
||||
|
||||
/* When setting the local value of a global
|
||||
* option, the old value may be the global value. */
|
||||
if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
|
||||
{
|
||||
origval_l = *(char_u **)get_varp_scope(
|
||||
&(options[opt_idx]), OPT_LOCAL);
|
||||
origval_g = *(char_u **)get_varp_scope(
|
||||
&(options[opt_idx]), OPT_GLOBAL);
|
||||
|
||||
// A global-local string option might have an empty
|
||||
// option as value to indicate that the global
|
||||
// value should be used.
|
||||
if (((int)options[opt_idx].indir & PV_BOTH)
|
||||
&& origval_l == empty_option)
|
||||
origval_l = origval_g;
|
||||
}
|
||||
|
||||
// When setting the local value of a global
|
||||
// option, the old value may be the global value.
|
||||
if (((int)options[opt_idx].indir & PV_BOTH)
|
||||
&& (opt_flags & OPT_LOCAL))
|
||||
origval = *(char_u **)get_varp(
|
||||
@@ -5047,6 +5101,10 @@ do_set(
|
||||
vim_free(oldval);
|
||||
if (origval == oldval)
|
||||
origval = *(char_u **)varp;
|
||||
if (origval_l == oldval)
|
||||
origval_l = *(char_u **)varp;
|
||||
if (origval_g == oldval)
|
||||
origval_g = *(char_u **)varp;
|
||||
oldval = *(char_u **)varp;
|
||||
}
|
||||
/*
|
||||
@@ -5304,6 +5362,10 @@ do_set(
|
||||
/* newval (and varp) may become invalid if the
|
||||
* buffer is closed by autocommands. */
|
||||
saved_newval = vim_strsave(newval);
|
||||
if (origval_l != NULL)
|
||||
saved_origval_l = vim_strsave(origval_l);
|
||||
if (origval_g != NULL)
|
||||
saved_origval_g = vim_strsave(origval_g);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -5337,9 +5399,13 @@ do_set(
|
||||
|
||||
#if defined(FEAT_EVAL)
|
||||
if (errmsg == NULL)
|
||||
trigger_optionsset_string(opt_idx, opt_flags,
|
||||
saved_origval, saved_newval);
|
||||
trigger_optionsset_string(
|
||||
opt_idx, opt_flags, saved_origval,
|
||||
saved_origval_l, saved_origval_g,
|
||||
saved_newval);
|
||||
vim_free(saved_origval);
|
||||
vim_free(saved_origval_l);
|
||||
vim_free(saved_origval_g);
|
||||
vim_free(saved_newval);
|
||||
#endif
|
||||
/* If error detected, print the error message. */
|
||||
@@ -6178,7 +6244,11 @@ set_string_option(
|
||||
char_u **varp;
|
||||
char_u *oldval;
|
||||
#if defined(FEAT_EVAL)
|
||||
char_u *oldval_l = NULL;
|
||||
char_u *oldval_g = NULL;
|
||||
char_u *saved_oldval = NULL;
|
||||
char_u *saved_oldval_l = NULL;
|
||||
char_u *saved_oldval_g = NULL;
|
||||
char_u *saved_newval = NULL;
|
||||
#endif
|
||||
char *r = NULL;
|
||||
@@ -6196,6 +6266,15 @@ set_string_option(
|
||||
? OPT_GLOBAL : OPT_LOCAL)
|
||||
: opt_flags);
|
||||
oldval = *varp;
|
||||
#if defined(FEAT_EVAL)
|
||||
if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
|
||||
{
|
||||
oldval_l = *(char_u **)get_varp_scope(&(options[opt_idx]),
|
||||
OPT_LOCAL);
|
||||
oldval_g = *(char_u **)get_varp_scope(&(options[opt_idx]),
|
||||
OPT_GLOBAL);
|
||||
}
|
||||
#endif
|
||||
*varp = s;
|
||||
|
||||
#if defined(FEAT_EVAL)
|
||||
@@ -6205,6 +6284,10 @@ set_string_option(
|
||||
# endif
|
||||
)
|
||||
{
|
||||
if (oldval_l != NULL)
|
||||
saved_oldval_l = vim_strsave(oldval_l);
|
||||
if (oldval_g != NULL)
|
||||
saved_oldval_g = vim_strsave(oldval_g);
|
||||
saved_oldval = vim_strsave(oldval);
|
||||
saved_newval = vim_strsave(s);
|
||||
}
|
||||
@@ -6217,8 +6300,11 @@ set_string_option(
|
||||
/* call autocommand after handling side effects */
|
||||
if (r == NULL)
|
||||
trigger_optionsset_string(opt_idx, opt_flags,
|
||||
saved_oldval, saved_newval);
|
||||
saved_oldval, saved_oldval_l,
|
||||
saved_oldval_g, saved_newval);
|
||||
vim_free(saved_oldval);
|
||||
vim_free(saved_oldval_l);
|
||||
vim_free(saved_oldval_g);
|
||||
vim_free(saved_newval);
|
||||
#endif
|
||||
}
|
||||
@@ -8564,6 +8650,9 @@ set_bool_option(
|
||||
int opt_flags) /* OPT_LOCAL and/or OPT_GLOBAL */
|
||||
{
|
||||
int old_value = *(int *)varp;
|
||||
#if defined(FEAT_EVAL)
|
||||
int old_global_value = 0;
|
||||
#endif
|
||||
|
||||
/* Disallow changing some options from secure mode */
|
||||
if ((secure
|
||||
@@ -8573,6 +8662,15 @@ set_bool_option(
|
||||
) && (options[opt_idx].flags & P_SECURE))
|
||||
return e_secure;
|
||||
|
||||
#if defined(FEAT_EVAL)
|
||||
// Save the global value before changing anything. This is needed as for
|
||||
// a global-only option setting the "local value" in fact sets the global
|
||||
// value (since there is only one value).
|
||||
if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
|
||||
old_global_value = *(int *)get_varp_scope(&(options[opt_idx]),
|
||||
OPT_GLOBAL);
|
||||
#endif
|
||||
|
||||
*(int *)varp = value; /* set the new value */
|
||||
#ifdef FEAT_EVAL
|
||||
/* Remember where the option was set. */
|
||||
@@ -9146,15 +9244,40 @@ set_bool_option(
|
||||
// Don't do this while starting up or recursively.
|
||||
if (!starting && *get_vim_var_str(VV_OPTION_TYPE) == NUL)
|
||||
{
|
||||
char_u buf_old[2], buf_new[2], buf_type[7];
|
||||
char_u buf_old[2], buf_old_global[2], buf_new[2], buf_type[7];
|
||||
|
||||
vim_snprintf((char *)buf_old, 2, "%d", old_value ? TRUE: FALSE);
|
||||
vim_snprintf((char *)buf_old_global, 2, "%d",
|
||||
old_global_value ? TRUE: FALSE);
|
||||
vim_snprintf((char *)buf_new, 2, "%d", value ? TRUE: FALSE);
|
||||
vim_snprintf((char *)buf_type, 7, "%s", (opt_flags & OPT_LOCAL) ? "local" : "global");
|
||||
vim_snprintf((char *)buf_type, 7, "%s",
|
||||
(opt_flags & OPT_LOCAL) ? "local" : "global");
|
||||
set_vim_var_string(VV_OPTION_NEW, buf_new, -1);
|
||||
set_vim_var_string(VV_OPTION_OLD, buf_old, -1);
|
||||
set_vim_var_string(VV_OPTION_TYPE, buf_type, -1);
|
||||
apply_autocmds(EVENT_OPTIONSET, (char_u *) options[opt_idx].fullname, NULL, FALSE, NULL);
|
||||
if (opt_flags & OPT_LOCAL)
|
||||
{
|
||||
set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"setlocal", -1);
|
||||
set_vim_var_string(VV_OPTION_OLDLOCAL, buf_old, -1);
|
||||
}
|
||||
if (opt_flags & OPT_GLOBAL)
|
||||
{
|
||||
set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"setglobal", -1);
|
||||
set_vim_var_string(VV_OPTION_OLDGLOBAL, buf_old, -1);
|
||||
}
|
||||
if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
|
||||
{
|
||||
set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"set", -1);
|
||||
set_vim_var_string(VV_OPTION_OLDLOCAL, buf_old, -1);
|
||||
set_vim_var_string(VV_OPTION_OLDGLOBAL, buf_old_global, -1);
|
||||
}
|
||||
if (opt_flags & OPT_MODELINE)
|
||||
{
|
||||
set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"modeline", -1);
|
||||
set_vim_var_string(VV_OPTION_OLDLOCAL, buf_old, -1);
|
||||
}
|
||||
apply_autocmds(EVENT_OPTIONSET, (char_u *)options[opt_idx].fullname,
|
||||
NULL, FALSE, NULL);
|
||||
reset_v_option_vars();
|
||||
}
|
||||
#endif
|
||||
@@ -9184,8 +9307,12 @@ set_num_option(
|
||||
{
|
||||
char *errmsg = NULL;
|
||||
long old_value = *(long *)varp;
|
||||
long old_Rows = Rows; /* remember old Rows */
|
||||
long old_Columns = Columns; /* remember old Columns */
|
||||
#if defined(FEAT_EVAL)
|
||||
long old_global_value = 0; // only used when setting a local and
|
||||
// global option
|
||||
#endif
|
||||
long old_Rows = Rows; // remember old Rows
|
||||
long old_Columns = Columns; // remember old Columns
|
||||
long *pp = (long *)varp;
|
||||
|
||||
/* Disallow changing some options from secure mode. */
|
||||
@@ -9196,6 +9323,15 @@ set_num_option(
|
||||
) && (options[opt_idx].flags & P_SECURE))
|
||||
return e_secure;
|
||||
|
||||
#if defined(FEAT_EVAL)
|
||||
// Save the global value before changing anything. This is needed as for
|
||||
// a global-only option setting the "local value" infact sets the global
|
||||
// value (since there is only one value).
|
||||
if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
|
||||
old_global_value = *(long *)get_varp_scope(&(options[opt_idx]),
|
||||
OPT_GLOBAL);
|
||||
#endif
|
||||
|
||||
*pp = value;
|
||||
#ifdef FEAT_EVAL
|
||||
/* Remember where the option was set. */
|
||||
@@ -9742,15 +9878,37 @@ set_num_option(
|
||||
// Don't do this while starting up, failure or recursively.
|
||||
if (!starting && errmsg == NULL && *get_vim_var_str(VV_OPTION_TYPE) == NUL)
|
||||
{
|
||||
char_u buf_old[11], buf_new[11], buf_type[7];
|
||||
|
||||
char_u buf_old[11], buf_old_global[11], buf_new[11], buf_type[7];
|
||||
vim_snprintf((char *)buf_old, 10, "%ld", old_value);
|
||||
vim_snprintf((char *)buf_old_global, 10, "%ld", old_global_value);
|
||||
vim_snprintf((char *)buf_new, 10, "%ld", value);
|
||||
vim_snprintf((char *)buf_type, 7, "%s", (opt_flags & OPT_LOCAL) ? "local" : "global");
|
||||
set_vim_var_string(VV_OPTION_NEW, buf_new, -1);
|
||||
set_vim_var_string(VV_OPTION_OLD, buf_old, -1);
|
||||
set_vim_var_string(VV_OPTION_TYPE, buf_type, -1);
|
||||
apply_autocmds(EVENT_OPTIONSET, (char_u *) options[opt_idx].fullname, NULL, FALSE, NULL);
|
||||
if (opt_flags & OPT_LOCAL)
|
||||
{
|
||||
set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"setlocal", -1);
|
||||
set_vim_var_string(VV_OPTION_OLDLOCAL, buf_old, -1);
|
||||
}
|
||||
if (opt_flags & OPT_GLOBAL)
|
||||
{
|
||||
set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"setglobal", -1);
|
||||
set_vim_var_string(VV_OPTION_OLDGLOBAL, buf_old, -1);
|
||||
}
|
||||
if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
|
||||
{
|
||||
set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"set", -1);
|
||||
set_vim_var_string(VV_OPTION_OLDLOCAL, buf_old, -1);
|
||||
set_vim_var_string(VV_OPTION_OLDGLOBAL, buf_old_global, -1);
|
||||
}
|
||||
if (opt_flags & OPT_MODELINE)
|
||||
{
|
||||
set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"modeline", -1);
|
||||
set_vim_var_string(VV_OPTION_OLDLOCAL, buf_old, -1);
|
||||
}
|
||||
apply_autocmds(EVENT_OPTIONSET, (char_u *)options[opt_idx].fullname,
|
||||
NULL, FALSE, NULL);
|
||||
reset_v_option_vars();
|
||||
}
|
||||
#endif
|
||||
|
||||
+4
-4
@@ -40,13 +40,13 @@
|
||||
NSString *VimPboardType = @"VimPboardType";
|
||||
|
||||
void
|
||||
clip_mch_lose_selection(VimClipboard *cbd UNUSED)
|
||||
clip_mch_lose_selection(Clipboard_T *cbd UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
clip_mch_own_selection(VimClipboard *cbd UNUSED)
|
||||
clip_mch_own_selection(Clipboard_T *cbd UNUSED)
|
||||
{
|
||||
/* This is called whenever there is a new selection and 'guioptions'
|
||||
* contains the "a" flag (automatically copy selection). Return TRUE, else
|
||||
@@ -58,7 +58,7 @@ clip_mch_own_selection(VimClipboard *cbd UNUSED)
|
||||
|
||||
|
||||
void
|
||||
clip_mch_request_selection(VimClipboard *cbd)
|
||||
clip_mch_request_selection(Clipboard_T *cbd)
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
@@ -148,7 +148,7 @@ releasepool:
|
||||
* Send the current selection to the clipboard.
|
||||
*/
|
||||
void
|
||||
clip_mch_set_selection(VimClipboard *cbd)
|
||||
clip_mch_set_selection(Clipboard_T *cbd)
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
|
||||
+4
-4
@@ -48,18 +48,18 @@ void qnx_clip_init(void)
|
||||
|
||||
/* No support for owning the clipboard */
|
||||
int
|
||||
clip_mch_own_selection(VimClipboard *cbd)
|
||||
clip_mch_own_selection(Clipboard_T *cbd)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
clip_mch_lose_selection(VimClipboard *cbd)
|
||||
clip_mch_lose_selection(Clipboard_T *cbd)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
clip_mch_request_selection(VimClipboard *cbd)
|
||||
clip_mch_request_selection(Clipboard_T *cbd)
|
||||
{
|
||||
int type = MLINE, clip_length = 0, is_type_set = FALSE;
|
||||
void *cbdata;
|
||||
@@ -102,7 +102,7 @@ clip_mch_request_selection(VimClipboard *cbd)
|
||||
}
|
||||
|
||||
void
|
||||
clip_mch_set_selection(VimClipboard *cbd)
|
||||
clip_mch_set_selection(Clipboard_T *cbd)
|
||||
{
|
||||
int type;
|
||||
long_u len;
|
||||
|
||||
+4
-4
@@ -7797,7 +7797,7 @@ xterm_update(void)
|
||||
}
|
||||
|
||||
int
|
||||
clip_xterm_own_selection(VimClipboard *cbd)
|
||||
clip_xterm_own_selection(Clipboard_T *cbd)
|
||||
{
|
||||
if (xterm_Shell != (Widget)0)
|
||||
return clip_x11_own_selection(xterm_Shell, cbd);
|
||||
@@ -7805,21 +7805,21 @@ clip_xterm_own_selection(VimClipboard *cbd)
|
||||
}
|
||||
|
||||
void
|
||||
clip_xterm_lose_selection(VimClipboard *cbd)
|
||||
clip_xterm_lose_selection(Clipboard_T *cbd)
|
||||
{
|
||||
if (xterm_Shell != (Widget)0)
|
||||
clip_x11_lose_selection(xterm_Shell, cbd);
|
||||
}
|
||||
|
||||
void
|
||||
clip_xterm_request_selection(VimClipboard *cbd)
|
||||
clip_xterm_request_selection(Clipboard_T *cbd)
|
||||
{
|
||||
if (xterm_Shell != (Widget)0)
|
||||
clip_x11_request_selection(xterm_Shell, xterm_dpy, cbd);
|
||||
}
|
||||
|
||||
void
|
||||
clip_xterm_set_selection(VimClipboard *cbd)
|
||||
clip_xterm_set_selection(Clipboard_T *cbd)
|
||||
{
|
||||
clip_x11_set_selection(cbd);
|
||||
}
|
||||
|
||||
+1
-1
@@ -727,7 +727,7 @@ pum_set_selected(int n, int repeat)
|
||||
if (!resized
|
||||
&& curbuf->b_nwindows == 1
|
||||
&& curbuf->b_fname == NULL
|
||||
&& curbuf->b_p_bt[0] == 'n' && curbuf->b_p_bt[2] == 'f'
|
||||
&& bt_nofile(curbuf)
|
||||
&& curbuf->b_p_bh[0] == 'w')
|
||||
{
|
||||
/* Already a "wipeout" buffer, make it empty. */
|
||||
|
||||
+1080
-165
File diff suppressed because it is too large
Load Diff
+4
-4
@@ -323,10 +323,10 @@ extern char *vim_SelFile(Widget toplevel, char *prompt, char *init_path, int (*s
|
||||
#endif
|
||||
#if defined(MACOS_X_DARWIN) && defined(FEAT_CLIPBOARD) && !defined(FEAT_GUI)
|
||||
/* functions in os_macosx.m */
|
||||
void clip_mch_lose_selection(VimClipboard *cbd);
|
||||
int clip_mch_own_selection(VimClipboard *cbd);
|
||||
void clip_mch_request_selection(VimClipboard *cbd);
|
||||
void clip_mch_set_selection(VimClipboard *cbd);
|
||||
void clip_mch_lose_selection(Clipboard_T *cbd);
|
||||
int clip_mch_own_selection(Clipboard_T *cbd);
|
||||
void clip_mch_request_selection(Clipboard_T *cbd);
|
||||
void clip_mch_set_selection(Clipboard_T *cbd);
|
||||
#endif
|
||||
#if defined(MACOS_X) && defined(FEAT_GUI)
|
||||
void macosx_fork();
|
||||
|
||||
@@ -62,6 +62,7 @@ int bt_terminal(buf_T *buf);
|
||||
int bt_help(buf_T *buf);
|
||||
int bt_prompt(buf_T *buf);
|
||||
int bt_popup(buf_T *buf);
|
||||
int bt_nofilename(buf_T *buf);
|
||||
int bt_nofile(buf_T *buf);
|
||||
int bt_dontwrite(buf_T *buf);
|
||||
int bt_dontwrite_msg(buf_T *buf);
|
||||
|
||||
@@ -18,6 +18,7 @@ int dict_add_special(dict_T *d, char *key, varnumber_T nr);
|
||||
int dict_add_string(dict_T *d, char *key, char_u *str);
|
||||
int dict_add_string_len(dict_T *d, char *key, char_u *str, int len);
|
||||
int dict_add_list(dict_T *d, char *key, list_T *list);
|
||||
int dict_add_callback(dict_T *d, char *key, callback_T *cb);
|
||||
void dict_iterate_start(typval_T *var, dict_iterator_T *iter);
|
||||
char_u *dict_iterate_next(dict_iterator_T *iter, typval_T **tv_result);
|
||||
int dict_add_dict(dict_T *d, char *key, dict_T *dict);
|
||||
|
||||
@@ -28,6 +28,7 @@ void *call_func_retstr(char_u *func, int argc, typval_T *argv);
|
||||
void *call_func_retlist(char_u *func, int argc, typval_T *argv);
|
||||
int eval_foldexpr(char_u *arg, int *cp);
|
||||
void ex_let(exarg_T *eap);
|
||||
void ex_const(exarg_T *eap);
|
||||
void list_hashtable_vars(hashtab_T *ht, char *prefix, int empty, int *first);
|
||||
char_u *get_lval(char_u *name, typval_T *rettv, lval_T *lp, int unlet, int skip, int flags, int fne_flags);
|
||||
void clear_lval(lval_T *lp);
|
||||
|
||||
@@ -59,11 +59,11 @@ void gui_mch_clear_block(int row1arg, int col1arg, int row2arg, int col2arg);
|
||||
void gui_mch_clear_all(void);
|
||||
void gui_mch_delete_lines(int row, int num_lines);
|
||||
void gui_mch_insert_lines(int row, int num_lines);
|
||||
void clip_mch_request_selection(VimClipboard *cbd);
|
||||
void clip_mch_lose_selection(VimClipboard *cbd);
|
||||
int clip_mch_own_selection(VimClipboard *cbd);
|
||||
void clip_mch_set_selection(VimClipboard *cbd);
|
||||
int clip_gtk_owner_exists(VimClipboard *cbd);
|
||||
void clip_mch_request_selection(Clipboard_T *cbd);
|
||||
void clip_mch_lose_selection(Clipboard_T *cbd);
|
||||
int clip_mch_own_selection(Clipboard_T *cbd);
|
||||
void clip_mch_set_selection(Clipboard_T *cbd);
|
||||
int clip_gtk_owner_exists(Clipboard_T *cbd);
|
||||
void gui_mch_menu_grey(vimmenu_T *menu, int grey);
|
||||
void gui_mch_menu_hidden(vimmenu_T *menu, int hidden);
|
||||
void gui_mch_draw_menubar(void);
|
||||
|
||||
@@ -111,10 +111,10 @@ void mch_post_buffer_write (buf_T *buf);
|
||||
|
||||
void mch_errmsg(char *str);
|
||||
void mch_display_error(void);
|
||||
void clip_mch_lose_selection(VimClipboard *cbd);
|
||||
void clip_mch_request_selection(VimClipboard *cbd);
|
||||
void clip_mch_set_selection(VimClipboard *cbd);
|
||||
int clip_mch_own_selection(VimClipboard *cbd);
|
||||
void clip_mch_lose_selection(Clipboard_T *cbd);
|
||||
void clip_mch_request_selection(Clipboard_T *cbd);
|
||||
void clip_mch_set_selection(Clipboard_T *cbd);
|
||||
int clip_mch_own_selection(Clipboard_T *cbd);
|
||||
|
||||
pascal OSErr FindProcessBySignature( const OSType targetType,
|
||||
const OSType targetCreator, ProcessSerialNumberPtr psnPtr );
|
||||
|
||||
@@ -43,13 +43,13 @@ gui_mch_update_tabline(void);
|
||||
void
|
||||
gui_mch_show_tabline(int showit);
|
||||
void
|
||||
clip_mch_lose_selection(VimClipboard *cbd);
|
||||
clip_mch_lose_selection(Clipboard_T *cbd);
|
||||
int
|
||||
clip_mch_own_selection(VimClipboard *cbd);
|
||||
clip_mch_own_selection(Clipboard_T *cbd);
|
||||
void
|
||||
clip_mch_request_selection(VimClipboard *cbd);
|
||||
clip_mch_request_selection(Clipboard_T *cbd);
|
||||
void
|
||||
clip_mch_set_selection(VimClipboard *cbd);
|
||||
clip_mch_set_selection(Clipboard_T *cbd);
|
||||
void
|
||||
gui_mch_add_menu(vimmenu_T *menu, int idx);
|
||||
void
|
||||
|
||||
@@ -46,10 +46,10 @@ void gui_mch_clear_block(int row1, int col1, int row2, int col2);
|
||||
void gui_mch_clear_all(void);
|
||||
void gui_mch_delete_lines(int row, int num_lines);
|
||||
void gui_mch_insert_lines(int row, int num_lines);
|
||||
void clip_mch_lose_selection(VimClipboard *cbd);
|
||||
int clip_mch_own_selection(VimClipboard *cbd);
|
||||
void clip_mch_request_selection(VimClipboard *cbd);
|
||||
void clip_mch_set_selection(VimClipboard *cbd);
|
||||
void clip_mch_lose_selection(Clipboard_T *cbd);
|
||||
int clip_mch_own_selection(Clipboard_T *cbd);
|
||||
void clip_mch_request_selection(Clipboard_T *cbd);
|
||||
void clip_mch_set_selection(Clipboard_T *cbd);
|
||||
void gui_mch_menu_grey(vimmenu_T *menu, int grey);
|
||||
void gui_mch_menu_hidden(vimmenu_T *menu, int hidden);
|
||||
void gui_mch_draw_menubar(void);
|
||||
|
||||
+4
-4
@@ -53,10 +53,10 @@ int read_viminfo_register(vir_T *virp, int force);
|
||||
void handle_viminfo_register(garray_T *values, int force);
|
||||
void write_viminfo_registers(FILE *fp);
|
||||
void x11_export_final_selection(void);
|
||||
void clip_free_selection(VimClipboard *cbd);
|
||||
void clip_get_selection(VimClipboard *cbd);
|
||||
void clip_yank_selection(int type, char_u *str, long len, VimClipboard *cbd);
|
||||
int clip_convert_selection(char_u **str, long_u *len, VimClipboard *cbd);
|
||||
void clip_free_selection(Clipboard_T *cbd);
|
||||
void clip_get_selection(Clipboard_T *cbd);
|
||||
void clip_yank_selection(int type, char_u *str, long len, Clipboard_T *cbd);
|
||||
int clip_convert_selection(char_u **str, long_u *len, Clipboard_T *cbd);
|
||||
void dnd_yank_drag_data(char_u *str, long len);
|
||||
char_u get_reg_type(int regname, long *reglen);
|
||||
char_u *get_reg_contents(int regname, int flags);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* os_qnx.c */
|
||||
void qnx_init(void);
|
||||
void qnx_clip_init (void);
|
||||
int clip_mch_own_selection(VimClipboard *cbd);
|
||||
void clip_mch_lose_selection(VimClipboard *cbd);
|
||||
void clip_mch_request_selection(VimClipboard *cbd);
|
||||
void clip_mch_set_selection(VimClipboard *cbd);
|
||||
int clip_mch_own_selection(Clipboard_T *cbd);
|
||||
void clip_mch_lose_selection(Clipboard_T *cbd);
|
||||
void clip_mch_request_selection(Clipboard_T *cbd);
|
||||
void clip_mch_set_selection(Clipboard_T *cbd);
|
||||
/* vim: set ft=c : */
|
||||
|
||||
@@ -79,10 +79,10 @@ void setup_term_clip(void);
|
||||
void start_xterm_trace(int button);
|
||||
void stop_xterm_trace(void);
|
||||
void clear_xterm_clip(void);
|
||||
int clip_xterm_own_selection(VimClipboard *cbd);
|
||||
void clip_xterm_lose_selection(VimClipboard *cbd);
|
||||
void clip_xterm_request_selection(VimClipboard *cbd);
|
||||
void clip_xterm_set_selection(VimClipboard *cbd);
|
||||
int clip_xterm_own_selection(Clipboard_T *cbd);
|
||||
void clip_xterm_lose_selection(Clipboard_T *cbd);
|
||||
void clip_xterm_request_selection(Clipboard_T *cbd);
|
||||
void clip_xterm_set_selection(Clipboard_T *cbd);
|
||||
int xsmp_handle_requests(void);
|
||||
void xsmp_init(void);
|
||||
void xsmp_close(void);
|
||||
|
||||
+15
-2
@@ -1,21 +1,34 @@
|
||||
/* popupwin.c */
|
||||
int popup_on_border(win_T *wp, int row, int col);
|
||||
void popup_start_drag(win_T *wp);
|
||||
void popup_drag(win_T *wp);
|
||||
int popup_height(win_T *wp);
|
||||
int popup_width(win_T *wp);
|
||||
void popup_adjust_position(win_T *wp);
|
||||
void f_popup_clear(typval_T *argvars, typval_T *rettv);
|
||||
void f_popup_create(typval_T *argvars, typval_T *rettv);
|
||||
void f_popup_atcursor(typval_T *argvars, typval_T *rettv);
|
||||
int popup_any_visible(void);
|
||||
void f_popup_filter_menu(typval_T *argvars, typval_T *rettv);
|
||||
void f_popup_filter_yesno(typval_T *argvars, typval_T *rettv);
|
||||
void f_popup_dialog(typval_T *argvars, typval_T *rettv);
|
||||
void f_popup_menu(typval_T *argvars, typval_T *rettv);
|
||||
void f_popup_notification(typval_T *argvars, typval_T *rettv);
|
||||
void f_popup_close(typval_T *argvars, typval_T *rettv);
|
||||
void f_popup_hide(typval_T *argvars, typval_T *rettv);
|
||||
void f_popup_show(typval_T *argvars, typval_T *rettv);
|
||||
void f_popup_settext(typval_T *argvars, typval_T *rettv);
|
||||
void popup_close(int id);
|
||||
void popup_close_tabpage(tabpage_T *tp, int id);
|
||||
void close_all_popups(void);
|
||||
void f_popup_move(typval_T *argvars, typval_T *rettv);
|
||||
void f_popup_setoptions(typval_T *argvars, typval_T *rettv);
|
||||
void f_popup_getpos(typval_T *argvars, typval_T *rettv);
|
||||
void f_popup_getoptions(typval_T *argvars, typval_T *rettv);
|
||||
int not_in_popup_window(void);
|
||||
int error_if_popup_window(void);
|
||||
void popup_reset_handled(void);
|
||||
win_T *find_next_popup(int lowest);
|
||||
int popup_do_filter(int c);
|
||||
void popup_check_cursor_pos(void);
|
||||
void may_update_popup_mask(int type);
|
||||
void update_popups(void (*win_update)(win_T *wp));
|
||||
/* vim: set ft=c : */
|
||||
|
||||
@@ -16,6 +16,7 @@ int update_screen(int type_arg);
|
||||
int conceal_cursor_line(win_T *wp);
|
||||
void conceal_check_cursor_line(void);
|
||||
void update_debug_sign(buf_T *buf, linenr_T lnum);
|
||||
int get_wcr_attr(win_T *wp);
|
||||
void updateWindow(win_T *wp);
|
||||
int screen_get_current_line_off(void);
|
||||
void screen_line(int row, int coloff, int endcol, int clear_width, int flags);
|
||||
|
||||
+16
-16
@@ -15,9 +15,9 @@ int ui_get_winpos(int *x, int *y, varnumber_T timeout);
|
||||
void ui_breakcheck(void);
|
||||
void ui_breakcheck_force(int force);
|
||||
void clip_init(int can_use);
|
||||
void clip_update_selection(VimClipboard *clip);
|
||||
void clip_own_selection(VimClipboard *cbd);
|
||||
void clip_lose_selection(VimClipboard *cbd);
|
||||
void clip_update_selection(Clipboard_T *clip);
|
||||
void clip_own_selection(Clipboard_T *cbd);
|
||||
void clip_lose_selection(Clipboard_T *cbd);
|
||||
void start_global_changes(void);
|
||||
int is_clipboard_needs_update(void);
|
||||
void end_global_changes(void);
|
||||
@@ -28,15 +28,15 @@ void clip_modeless(int button, int is_click, int is_drag);
|
||||
void clip_start_selection(int col, int row, int repeated_click);
|
||||
void clip_process_selection(int button, int col, int row, int_u repeated_click);
|
||||
void clip_may_redraw_selection(int row, int col, int len);
|
||||
void clip_clear_selection(VimClipboard *cbd);
|
||||
void clip_clear_selection(Clipboard_T *cbd);
|
||||
void clip_may_clear_selection(int row1, int row2);
|
||||
void clip_scroll_selection(int rows);
|
||||
void clip_copy_modeless_selection(int both);
|
||||
int clip_gen_own_selection(VimClipboard *cbd);
|
||||
void clip_gen_lose_selection(VimClipboard *cbd);
|
||||
void clip_gen_set_selection(VimClipboard *cbd);
|
||||
void clip_gen_request_selection(VimClipboard *cbd);
|
||||
int clip_gen_owner_exists(VimClipboard *cbd);
|
||||
int clip_gen_own_selection(Clipboard_T *cbd);
|
||||
void clip_gen_lose_selection(Clipboard_T *cbd);
|
||||
void clip_gen_set_selection(Clipboard_T *cbd);
|
||||
void clip_gen_request_selection(Clipboard_T *cbd);
|
||||
int clip_gen_owner_exists(Clipboard_T *cbd);
|
||||
int vim_is_input_buf_full(void);
|
||||
int vim_is_input_buf_empty(void);
|
||||
int vim_free_in_input_buf(void);
|
||||
@@ -57,15 +57,15 @@ int check_row(int row);
|
||||
void open_app_context(void);
|
||||
void x11_setup_atoms(Display *dpy);
|
||||
void x11_setup_selection(Widget w);
|
||||
void clip_x11_request_selection(Widget myShell, Display *dpy, VimClipboard *cbd);
|
||||
void clip_x11_lose_selection(Widget myShell, VimClipboard *cbd);
|
||||
int clip_x11_own_selection(Widget myShell, VimClipboard *cbd);
|
||||
void clip_x11_set_selection(VimClipboard *cbd);
|
||||
int clip_x11_owner_exists(VimClipboard *cbd);
|
||||
void yank_cut_buffer0(Display *dpy, VimClipboard *cbd);
|
||||
void clip_x11_request_selection(Widget myShell, Display *dpy, Clipboard_T *cbd);
|
||||
void clip_x11_lose_selection(Widget myShell, Clipboard_T *cbd);
|
||||
int clip_x11_own_selection(Widget myShell, Clipboard_T *cbd);
|
||||
void clip_x11_set_selection(Clipboard_T *cbd);
|
||||
int clip_x11_owner_exists(Clipboard_T *cbd);
|
||||
void yank_cut_buffer0(Display *dpy, Clipboard_T *cbd);
|
||||
int jump_to_mouse(int flags, int *inclusive, int which_button);
|
||||
int mouse_comp_pos(win_T *win, int *rowp, int *colp, linenr_T *lnump);
|
||||
win_T *mouse_find_win(int *rowp, int *colp);
|
||||
win_T *mouse_find_win(int *rowp, int *colp, mouse_find_T popup);
|
||||
int get_fpos_of_mouse(pos_T *mpos);
|
||||
int vcol2col(win_T *wp, linenr_T lnum, int vcol);
|
||||
void ui_focus_change(int in_focus);
|
||||
|
||||
@@ -4,10 +4,10 @@ int utf16_to_utf8(short_u *instr, int inlen, char_u *outstr);
|
||||
void MultiByteToWideChar_alloc(UINT cp, DWORD flags, LPCSTR in, int inlen, LPWSTR *out, int *outlen);
|
||||
void WideCharToMultiByte_alloc(UINT cp, DWORD flags, LPCWSTR in, int inlen, LPSTR *out, int *outlen, LPCSTR def, LPBOOL useddef);
|
||||
void win_clip_init(void);
|
||||
int clip_mch_own_selection(VimClipboard *cbd);
|
||||
void clip_mch_lose_selection(VimClipboard *cbd);
|
||||
void clip_mch_request_selection(VimClipboard *cbd);
|
||||
void clip_mch_set_selection(VimClipboard *cbd);
|
||||
int clip_mch_own_selection(Clipboard_T *cbd);
|
||||
void clip_mch_lose_selection(Clipboard_T *cbd);
|
||||
void clip_mch_request_selection(Clipboard_T *cbd);
|
||||
void clip_mch_set_selection(Clipboard_T *cbd);
|
||||
short_u *enc_to_utf16(char_u *str, int *lenp);
|
||||
char_u *utf16_to_enc(short_u *str, int *lenp);
|
||||
void acp_to_enc(char_u *str, int str_size, char_u **out, int *outlen);
|
||||
|
||||
@@ -3,6 +3,7 @@ void do_window(int nchar, long Prenum, int xchar);
|
||||
void get_wincmd_addr_type(char_u *arg, exarg_T *eap);
|
||||
int win_split(int size, int flags);
|
||||
int win_split_ins(int size, int flags, win_T *new_wp, int dir);
|
||||
int win_valid_popup(win_T *win);
|
||||
int win_valid(win_T *win);
|
||||
int win_valid_any_tab(win_T *win);
|
||||
int win_count(void);
|
||||
|
||||
+1
-1
@@ -4135,7 +4135,7 @@ qf_open_new_cwindow(qf_info_T *qi, int height)
|
||||
// Set the options for the quickfix buffer/window (if not already done)
|
||||
// Do this even if the quickfix buffer was already present, as an autocmd
|
||||
// might have previously deleted (:bdelete) the quickfix buffer.
|
||||
if (curbuf->b_p_bt[0] != 'q')
|
||||
if (!bt_quickfix(curbuf))
|
||||
qf_set_cwindow_options();
|
||||
|
||||
// Only set the height when still in the same tab page and there is no
|
||||
|
||||
+11
-310
@@ -121,10 +121,6 @@ static int redrawing_for_callback = 0;
|
||||
*/
|
||||
static schar_T *current_ScreenLine;
|
||||
|
||||
#ifdef FEAT_TEXT_PROP
|
||||
static void may_update_popup_mask(int type);
|
||||
static void update_popups(void);
|
||||
#endif
|
||||
static void win_update(win_T *wp);
|
||||
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);
|
||||
@@ -830,7 +826,7 @@ update_screen(int type_arg)
|
||||
|
||||
#ifdef FEAT_TEXT_PROP
|
||||
// Display popup windows on top of the windows.
|
||||
update_popups();
|
||||
update_popups(win_update);
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_GUI
|
||||
@@ -1005,7 +1001,7 @@ update_debug_sign(buf_T *buf, linenr_T lnum)
|
||||
* Get 'wincolor' attribute for window "wp". If not set and "wp" is a popup
|
||||
* window then get the "Pmenu" highlight attribute.
|
||||
*/
|
||||
static int
|
||||
int
|
||||
get_wcr_attr(win_T *wp)
|
||||
{
|
||||
int wcr_attr = 0;
|
||||
@@ -1019,306 +1015,6 @@ get_wcr_attr(win_T *wp)
|
||||
return wcr_attr;
|
||||
}
|
||||
|
||||
#ifdef FEAT_TEXT_PROP
|
||||
|
||||
/*
|
||||
* Update "popup_mask" if needed.
|
||||
* Also recomputes the popup size and positions.
|
||||
* Also updates "popup_visible".
|
||||
* Also marks window lines for redrawing.
|
||||
*/
|
||||
static void
|
||||
may_update_popup_mask(int type)
|
||||
{
|
||||
win_T *wp;
|
||||
short *mask;
|
||||
int line, col;
|
||||
|
||||
if (popup_mask_tab != curtab)
|
||||
popup_mask_refresh = TRUE;
|
||||
if (!popup_mask_refresh)
|
||||
{
|
||||
// Check if any buffer has changed.
|
||||
for (wp = first_popupwin; wp != NULL; wp = wp->w_next)
|
||||
if (wp->w_popup_last_changedtick != CHANGEDTICK(wp->w_buffer))
|
||||
popup_mask_refresh = TRUE;
|
||||
for (wp = curtab->tp_first_popupwin; wp != NULL; wp = wp->w_next)
|
||||
if (wp->w_popup_last_changedtick != CHANGEDTICK(wp->w_buffer))
|
||||
popup_mask_refresh = TRUE;
|
||||
if (!popup_mask_refresh)
|
||||
return;
|
||||
}
|
||||
|
||||
// Need to update the mask, something has changed.
|
||||
popup_mask_refresh = FALSE;
|
||||
popup_mask_tab = curtab;
|
||||
popup_visible = FALSE;
|
||||
|
||||
// If redrawing everything, just update "popup_mask".
|
||||
// If redrawing only what is needed, update "popup_mask_next" and then
|
||||
// compare with "popup_mask" to see what changed.
|
||||
if (type >= SOME_VALID)
|
||||
mask = popup_mask;
|
||||
else
|
||||
mask = popup_mask_next;
|
||||
vim_memset(mask, 0, screen_Rows * screen_Columns * sizeof(short));
|
||||
|
||||
// Find the window with the lowest zindex that hasn't been handled yet,
|
||||
// so that the window with a higher zindex overwrites the value in
|
||||
// popup_mask.
|
||||
popup_reset_handled();
|
||||
while ((wp = find_next_popup(TRUE)) != NULL)
|
||||
{
|
||||
int height_extra, width_extra;
|
||||
|
||||
popup_visible = TRUE;
|
||||
|
||||
// Recompute the position if the text changed.
|
||||
if (wp->w_popup_last_changedtick != CHANGEDTICK(wp->w_buffer))
|
||||
popup_adjust_position(wp);
|
||||
|
||||
// the width and height are for the inside, add the padding and
|
||||
// border
|
||||
height_extra = wp->w_popup_padding[0] + wp->w_popup_border[0]
|
||||
+ wp->w_popup_padding[2] + wp->w_popup_border[2];
|
||||
width_extra = wp->w_popup_padding[3] + wp->w_popup_border[3]
|
||||
+ wp->w_popup_padding[1] + wp->w_popup_border[1];
|
||||
|
||||
for (line = wp->w_winrow;
|
||||
line < wp->w_winrow + wp->w_height + height_extra
|
||||
&& line < screen_Rows; ++line)
|
||||
for (col = wp->w_wincol;
|
||||
col < wp->w_wincol + wp->w_width + width_extra
|
||||
&& col < screen_Columns; ++col)
|
||||
mask[line * screen_Columns + col] = wp->w_zindex;
|
||||
}
|
||||
|
||||
// Only check which lines are to be updated if not already
|
||||
// updating all lines.
|
||||
if (mask == popup_mask_next)
|
||||
for (line = 0; line < screen_Rows; ++line)
|
||||
{
|
||||
int col_done = 0;
|
||||
|
||||
for (col = 0; col < screen_Columns; ++col)
|
||||
{
|
||||
int off = line * screen_Columns + col;
|
||||
|
||||
if (popup_mask[off] != popup_mask_next[off])
|
||||
{
|
||||
popup_mask[off] = popup_mask_next[off];
|
||||
|
||||
// The screen position "line" / "col" needs to be redrawn.
|
||||
// Figure out what window that is and update w_redraw_top
|
||||
// and w_redr_bot. Only needs to be done for each window
|
||||
// line.
|
||||
if (col >= col_done)
|
||||
{
|
||||
linenr_T lnum;
|
||||
int line_cp = line;
|
||||
int col_cp = col;
|
||||
|
||||
// find the window where the row is in
|
||||
wp = mouse_find_win(&line_cp, &col_cp);
|
||||
if (wp != NULL)
|
||||
{
|
||||
if (line_cp >= wp->w_height)
|
||||
// In (or below) status line
|
||||
wp->w_redr_status = TRUE;
|
||||
// compute the position in the buffer line from the
|
||||
// position on the screen
|
||||
else if (mouse_comp_pos(wp, &line_cp, &col_cp,
|
||||
&lnum))
|
||||
// past bottom
|
||||
wp->w_redr_status = TRUE;
|
||||
else
|
||||
redrawWinline(wp, lnum);
|
||||
|
||||
// This line is going to be redrawn, no need to
|
||||
// check until the right side of the window.
|
||||
col_done = wp->w_wincol + wp->w_width - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return a string of "len" spaces in IObuff.
|
||||
*/
|
||||
static char_u *
|
||||
get_spaces(int len)
|
||||
{
|
||||
vim_memset(IObuff, ' ', (size_t)len);
|
||||
IObuff[len] = NUL;
|
||||
return IObuff;
|
||||
}
|
||||
|
||||
static void
|
||||
update_popups(void)
|
||||
{
|
||||
win_T *wp;
|
||||
int top_off;
|
||||
int left_off;
|
||||
int total_width;
|
||||
int total_height;
|
||||
int popup_attr;
|
||||
int border_attr[4];
|
||||
int border_char[8];
|
||||
char_u buf[MB_MAXBYTES];
|
||||
int row;
|
||||
int i;
|
||||
|
||||
// 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.
|
||||
popup_reset_handled();
|
||||
while ((wp = find_next_popup(TRUE)) != NULL)
|
||||
{
|
||||
// This drawing uses the zindex of the popup window, so that it's on
|
||||
// top of the text but doesn't draw when another popup with higher
|
||||
// zindex is on top of the character.
|
||||
screen_zindex = wp->w_zindex;
|
||||
|
||||
// adjust w_winrow and w_wincol for border and padding, since
|
||||
// win_update() doesn't handle them.
|
||||
top_off = wp->w_popup_padding[0] + wp->w_popup_border[0];
|
||||
left_off = wp->w_popup_padding[3] + wp->w_popup_border[3];
|
||||
wp->w_winrow += top_off;
|
||||
wp->w_wincol += left_off;
|
||||
|
||||
// Draw the popup text.
|
||||
win_update(wp);
|
||||
|
||||
wp->w_winrow -= top_off;
|
||||
wp->w_wincol -= left_off;
|
||||
|
||||
total_width = wp->w_popup_border[3] + wp->w_popup_padding[3]
|
||||
+ wp->w_width + wp->w_popup_padding[1] + wp->w_popup_border[1];
|
||||
total_height = wp->w_popup_border[0] + wp->w_popup_padding[0]
|
||||
+ wp->w_height + wp->w_popup_padding[2] + wp->w_popup_border[2];
|
||||
popup_attr = get_wcr_attr(wp);
|
||||
|
||||
// We can only use these line drawing characters when 'encoding' is
|
||||
// "utf-8" and 'ambiwidth' is "single".
|
||||
if (enc_utf8 && *p_ambw == 's')
|
||||
{
|
||||
border_char[0] = border_char[2] = 0x2550;
|
||||
border_char[1] = border_char[3] = 0x2551;
|
||||
border_char[4] = 0x2554;
|
||||
border_char[5] = 0x2557;
|
||||
border_char[6] = 0x255d;
|
||||
border_char[7] = 0x255a;
|
||||
}
|
||||
else
|
||||
{
|
||||
border_char[0] = border_char[2] = '-';
|
||||
border_char[1] = border_char[3] = '|';
|
||||
for (i = 4; i < 8; ++i)
|
||||
border_char[i] = '+';
|
||||
}
|
||||
for (i = 0; i < 8; ++i)
|
||||
if (wp->w_border_char[i] != 0)
|
||||
border_char[i] = wp->w_border_char[i];
|
||||
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
border_attr[i] = popup_attr;
|
||||
if (wp->w_border_highlight[i] != NULL)
|
||||
border_attr[i] = syn_name2attr(wp->w_border_highlight[i]);
|
||||
}
|
||||
|
||||
if (wp->w_popup_border[0] > 0)
|
||||
{
|
||||
// top border
|
||||
screen_fill(wp->w_winrow, wp->w_winrow + 1,
|
||||
wp->w_wincol,
|
||||
wp->w_wincol + total_width,
|
||||
wp->w_popup_border[3] != 0
|
||||
? border_char[4] : border_char[0],
|
||||
border_char[0], border_attr[0]);
|
||||
if (wp->w_popup_border[1] > 0)
|
||||
{
|
||||
buf[mb_char2bytes(border_char[5], buf)] = NUL;
|
||||
screen_puts(buf, wp->w_winrow,
|
||||
wp->w_wincol + total_width - 1, border_attr[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if (wp->w_popup_padding[0] > 0)
|
||||
{
|
||||
// top padding
|
||||
row = wp->w_winrow + wp->w_popup_border[0];
|
||||
screen_fill(row, row + wp->w_popup_padding[0],
|
||||
wp->w_wincol + wp->w_popup_border[3],
|
||||
wp->w_wincol + total_width - wp->w_popup_border[1],
|
||||
' ', ' ', popup_attr);
|
||||
}
|
||||
|
||||
for (row = wp->w_winrow + wp->w_popup_border[0];
|
||||
row < wp->w_winrow + total_height - wp->w_popup_border[2];
|
||||
++row)
|
||||
{
|
||||
// left border
|
||||
if (wp->w_popup_border[3] > 0)
|
||||
{
|
||||
buf[mb_char2bytes(border_char[3], buf)] = NUL;
|
||||
screen_puts(buf, row, wp->w_wincol, border_attr[3]);
|
||||
}
|
||||
// left padding
|
||||
if (wp->w_popup_padding[3] > 0)
|
||||
screen_puts(get_spaces(wp->w_popup_padding[3]), row,
|
||||
wp->w_wincol + wp->w_popup_border[3], popup_attr);
|
||||
// right border
|
||||
if (wp->w_popup_border[1] > 0)
|
||||
{
|
||||
buf[mb_char2bytes(border_char[1], buf)] = NUL;
|
||||
screen_puts(buf, row,
|
||||
wp->w_wincol + total_width - 1, border_attr[1]);
|
||||
}
|
||||
// right padding
|
||||
if (wp->w_popup_padding[1] > 0)
|
||||
screen_puts(get_spaces(wp->w_popup_padding[1]), row,
|
||||
wp->w_wincol + wp->w_popup_border[3]
|
||||
+ wp->w_popup_padding[3] + wp->w_width, popup_attr);
|
||||
}
|
||||
|
||||
if (wp->w_popup_padding[2] > 0)
|
||||
{
|
||||
// bottom padding
|
||||
row = wp->w_winrow + wp->w_popup_border[0]
|
||||
+ wp->w_popup_padding[0] + wp->w_height;
|
||||
screen_fill(row, row + wp->w_popup_padding[2],
|
||||
wp->w_wincol + wp->w_popup_border[3],
|
||||
wp->w_wincol + total_width - wp->w_popup_border[1],
|
||||
' ', ' ', popup_attr);
|
||||
}
|
||||
|
||||
if (wp->w_popup_border[2] > 0)
|
||||
{
|
||||
// bottom border
|
||||
row = wp->w_winrow + total_height - 1;
|
||||
screen_fill(row , row + 1,
|
||||
wp->w_wincol,
|
||||
wp->w_wincol + total_width,
|
||||
wp->w_popup_border[3] != 0
|
||||
? border_char[7] : border_char[2],
|
||||
border_char[2], border_attr[2]);
|
||||
if (wp->w_popup_border[1] > 0)
|
||||
{
|
||||
buf[mb_char2bytes(border_char[6], buf)] = NUL;
|
||||
screen_puts(buf, row,
|
||||
wp->w_wincol + total_width - 1, border_attr[2]);
|
||||
}
|
||||
}
|
||||
|
||||
// Back to the normal zindex.
|
||||
screen_zindex = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_GUI) || defined(PROTO)
|
||||
/*
|
||||
* Update a single window, its status line and maybe the command line msg.
|
||||
@@ -1359,7 +1055,7 @@ updateWindow(win_T *wp)
|
||||
|
||||
#ifdef FEAT_TEXT_PROP
|
||||
// Display popup windows on top of everything.
|
||||
update_popups();
|
||||
update_popups(win_update);
|
||||
#endif
|
||||
|
||||
update_finish();
|
||||
@@ -4491,7 +4187,7 @@ win_line(
|
||||
*/
|
||||
v = (long)(ptr - line);
|
||||
cur = wp->w_match_head;
|
||||
shl_flag = (screen_line_flags & SLF_POPUP);
|
||||
shl_flag = FALSE;
|
||||
while (cur != NULL || shl_flag == FALSE)
|
||||
{
|
||||
if (shl_flag == FALSE
|
||||
@@ -4501,6 +4197,8 @@ win_line(
|
||||
{
|
||||
shl = &search_hl;
|
||||
shl_flag = TRUE;
|
||||
if (screen_line_flags & SLF_POPUP)
|
||||
continue; // do not use search_hl
|
||||
}
|
||||
else
|
||||
shl = &cur->hl;
|
||||
@@ -4580,9 +4278,9 @@ win_line(
|
||||
|
||||
/* Use attributes from match with highest priority among
|
||||
* 'search_hl' and the match list. */
|
||||
search_attr = search_hl.attr_cur;
|
||||
cur = wp->w_match_head;
|
||||
shl_flag = FALSE;
|
||||
search_attr = 0;
|
||||
while (cur != NULL || shl_flag == FALSE)
|
||||
{
|
||||
if (shl_flag == FALSE
|
||||
@@ -4592,6 +4290,8 @@ win_line(
|
||||
{
|
||||
shl = &search_hl;
|
||||
shl_flag = TRUE;
|
||||
if (screen_line_flags & SLF_POPUP)
|
||||
continue; // do not use search_hl
|
||||
}
|
||||
else
|
||||
shl = &cur->hl;
|
||||
@@ -5876,7 +5576,6 @@ win_line(
|
||||
{
|
||||
/* Use attributes from match with highest priority among
|
||||
* 'search_hl' and the match list. */
|
||||
char_attr = search_hl.attr;
|
||||
cur = wp->w_match_head;
|
||||
shl_flag = FALSE;
|
||||
while (cur != NULL || shl_flag == FALSE)
|
||||
@@ -5888,6 +5587,8 @@ win_line(
|
||||
{
|
||||
shl = &search_hl;
|
||||
shl_flag = TRUE;
|
||||
if (screen_line_flags & SLF_POPUP)
|
||||
continue; // do not use search_hl
|
||||
}
|
||||
else
|
||||
shl = &cur->hl;
|
||||
|
||||
+3
-3
@@ -231,7 +231,7 @@ insert_sign(
|
||||
if (buf->b_signlist == NULL)
|
||||
{
|
||||
redraw_buf_later(buf, NOT_VALID);
|
||||
changed_cline_bef_curs();
|
||||
changed_line_abv_curs();
|
||||
}
|
||||
|
||||
// first sign in signlist
|
||||
@@ -531,7 +531,7 @@ buf_delsign(
|
||||
if (buf->b_signlist == NULL)
|
||||
{
|
||||
redraw_buf_later(buf, NOT_VALID);
|
||||
changed_cline_bef_curs();
|
||||
changed_line_abv_curs();
|
||||
}
|
||||
|
||||
return lnum;
|
||||
@@ -651,7 +651,7 @@ buf_delete_signs(buf_T *buf, char_u *group)
|
||||
if (buf->b_signlist != NULL && curwin != NULL)
|
||||
{
|
||||
redraw_buf_later(buf, NOT_VALID);
|
||||
changed_cline_bef_curs();
|
||||
changed_line_abv_curs();
|
||||
}
|
||||
|
||||
lastp = &buf->b_signlist;
|
||||
|
||||
+20
-4
@@ -1369,12 +1369,16 @@ struct dictitem_S
|
||||
};
|
||||
typedef struct dictitem_S dictitem_T;
|
||||
|
||||
/* A dictitem with a 16 character key (plus NUL). */
|
||||
/*
|
||||
* A dictitem with a 16 character key (plus NUL). This is an efficient way to
|
||||
* have a fixed-size dictitem.
|
||||
*/
|
||||
#define DICTITEM16_KEY_LEN 16
|
||||
struct dictitem16_S
|
||||
{
|
||||
typval_T di_tv; /* type and value of the variable */
|
||||
char_u di_flags; /* flags (only used for variable) */
|
||||
char_u di_key[17]; /* key */
|
||||
char_u di_key[DICTITEM16_KEY_LEN + 1]; /* key */
|
||||
};
|
||||
typedef struct dictitem16_S dictitem16_T;
|
||||
|
||||
@@ -1995,8 +1999,10 @@ typedef enum {
|
||||
POPPOS_CENTER
|
||||
} poppos_T;
|
||||
|
||||
# define POPUPWIN_DEFAULT_ZINDEX 50
|
||||
# define POPUPMENU_ZINDEX 100
|
||||
# define POPUPWIN_DEFAULT_ZINDEX 50
|
||||
# define POPUPMENU_ZINDEX 100
|
||||
# define POPUPWIN_DIALOG_ZINDEX 200
|
||||
# define POPUPWIN_NOTIFICATION_ZINDEX 300
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -2897,6 +2903,7 @@ struct window_S
|
||||
pos_save_T w_save_cursor; /* backup of cursor pos and topline */
|
||||
#ifdef FEAT_TEXT_PROP
|
||||
int w_popup_flags; // POPF_ values
|
||||
char_u *w_popup_title;
|
||||
poppos_T w_popup_pos;
|
||||
int w_popup_fixed; // do not shift popup to fit on screen
|
||||
int w_zindex;
|
||||
@@ -2906,6 +2913,7 @@ struct window_S
|
||||
int w_maxwidth; // "maxwidth" for popup window
|
||||
int w_wantline; // "line" for popup window
|
||||
int w_wantcol; // "col" for popup window
|
||||
int w_firstline; // "firstline" for popup window
|
||||
int w_popup_padding[4]; // popup padding top/right/bot/left
|
||||
int w_popup_border[4]; // popup border top/right/bot/left
|
||||
char_u *w_border_highlight[4]; // popup border highlight
|
||||
@@ -2919,6 +2927,7 @@ struct window_S
|
||||
linenr_T w_popup_lnum; // close popup if cursor not on this line
|
||||
colnr_T w_popup_mincol; // close popup if cursor before this col
|
||||
colnr_T w_popup_maxcol; // close popup if cursor after this col
|
||||
int w_popup_drag; // allow moving the popup with the mouse
|
||||
|
||||
# if defined(FEAT_TIMERS)
|
||||
timer_T *w_popup_timer; // timer for closing popup window
|
||||
@@ -3645,3 +3654,10 @@ typedef enum {
|
||||
CDSCOPE_TABPAGE, // :tcd
|
||||
CDSCOPE_WINDOW // :lcd
|
||||
} cdscope_T;
|
||||
|
||||
// argument for mouse_find_win()
|
||||
typedef enum {
|
||||
IGNORE_POPUP, // only check non-popup windows
|
||||
FIND_POPUP, // also find popup windows
|
||||
FAIL_POPUP // return NULL if mouse on popup window
|
||||
} mouse_find_T;
|
||||
|
||||
@@ -65,6 +65,7 @@ NEW_TESTS = \
|
||||
test_backspace_opt \
|
||||
test_backup \
|
||||
test_balloon \
|
||||
test_balloon_gui \
|
||||
test_behave \
|
||||
test_blob \
|
||||
test_blockedit \
|
||||
@@ -87,6 +88,7 @@ NEW_TESTS = \
|
||||
test_comparators \
|
||||
test_compiler \
|
||||
test_conceal \
|
||||
test_const \
|
||||
test_crypt \
|
||||
test_cscope \
|
||||
test_cursor_func \
|
||||
@@ -296,6 +298,7 @@ NEW_TESTS_RES = \
|
||||
test_autoload.res \
|
||||
test_backspace_opt.res \
|
||||
test_balloon.res \
|
||||
test_balloon_gui.res \
|
||||
test_blob.res \
|
||||
test_blockedit.res \
|
||||
test_breakindent.res \
|
||||
@@ -312,6 +315,7 @@ NEW_TESTS_RES = \
|
||||
test_command_count.res \
|
||||
test_comparators.res \
|
||||
test_conceal.res \
|
||||
test_const.res \
|
||||
test_crypt.res \
|
||||
test_cscope.res \
|
||||
test_curswant.res \
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
" Command to check for the presence of a feature.
|
||||
command -nargs=1 CheckFeature call CheckFeature(<f-args>)
|
||||
func CheckFeature(name)
|
||||
if !has(a:name)
|
||||
throw 'Skipped: ' .. a:name .. ' feature missing'
|
||||
endif
|
||||
endfunc
|
||||
|
||||
" Command to check for the presence of a working option.
|
||||
command -nargs=1 CheckOption call CheckOption(<f-args>)
|
||||
func CheckOption(name)
|
||||
if !exists('+' .. a:name)
|
||||
throw 'Skipped: ' .. a:name .. ' option not supported'
|
||||
endif
|
||||
endfunc
|
||||
|
||||
" Command to check for the presence of a function.
|
||||
command -nargs=1 CheckFunction call CheckFunction(<f-args>)
|
||||
func CheckFunction(name)
|
||||
if !exists('*' .. a:name)
|
||||
throw 'Skipped: ' .. a:name .. ' function missing'
|
||||
endif
|
||||
endfunc
|
||||
@@ -0,0 +1,10 @@
|
||||
> +0&#ffffff0@74
|
||||
|~+0#4040ff13&| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @28|t+0#0000001#ffd7ff255|h|i|s| |i|s| |a| |t|e|x|t| +0#4040ff13#ffffff0@30
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
| +0#0000000&@56|0|,|0|-|1| @8|A|l@1|
|
||||
@@ -0,0 +1,10 @@
|
||||
> +0&#ffffff0@74
|
||||
|~+0#4040ff13&| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @35| +0#0000001#ffd7ff255| +0#4040ff13#ffffff0@36
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|:+0#0000000&|c|a|l@1| |p|o|p|u|p|_|s|e|t@1|e|x|t|(|p|,| |'@1|)| @30|0|,|0|-|1| @8|A|l@1|
|
||||
@@ -0,0 +1,10 @@
|
||||
> +0&#ffffff0@74
|
||||
|~+0#4040ff13&| @73
|
||||
|~| @73
|
||||
|~| @35|a+0#0000001#ffd7ff255| +0#4040ff13#ffffff0@36
|
||||
|~| @35|b+0#0000001#ffd7ff255| +0#4040ff13#ffffff0@36
|
||||
|~| @35|c+0#0000001#ffd7ff255| +0#4040ff13#ffffff0@36
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|:+0#0000000&|c|a|l@1| |p|o|p|u|p|_|s|e|t@1|e|x|t|(|p|,| |[|'|a|'|,|'|b|'|,|'|c|'|]|)| @19|0|,|0|-|1| @8|A|l@1|
|
||||
@@ -0,0 +1,10 @@
|
||||
> +0&#ffffff0@74
|
||||
|~+0#4040ff13&| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @35|a+0#0000001#ffd7ff255| +0#4040ff13#ffffff0@36
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|:+0#0000000&|c|a|l@1| |p|o|p|u|p|_|s|e|t@1|e|x|t|(|p|,| |[|'|a|'|]|)| @27|0|,|0|-|1| @8|A|l@1|
|
||||
@@ -0,0 +1,10 @@
|
||||
> +0&#ffffff0@74
|
||||
|~+0#4040ff13&| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @35| +0#0000001#ffd7ff255| +0#4040ff13#ffffff0@36
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|:+0#0000000&|c|a|l@1| |p|o|p|u|p|_|s|e|t@1|e|x|t|(|p|,| |[|]|)| @30|0|,|0|-|1| @8|A|l@1|
|
||||
@@ -0,0 +1,10 @@
|
||||
> +0&#ffffff0@74
|
||||
|~+0#4040ff13&| @73
|
||||
|~| @73
|
||||
|~| @33|a+0#0000001#ffd7ff255@3| +0#4040ff13#ffffff0@35
|
||||
|~| @33|b+0#0000001#ffd7ff255@3| +0#4040ff13#ffffff0@35
|
||||
|~| @33|c+0#0000001#ffd7ff255@3| +0#4040ff13#ffffff0@35
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
| +0#0000000&@56|0|,|0|-|1| @8|A|l@1|
|
||||
@@ -0,0 +1,10 @@
|
||||
> +0&#ffffff0@11
|
||||
|~+0#4040ff13&| @10
|
||||
|~| @10
|
||||
|~| @6|o+0#0000001#ffd7ff255|t|h|e
|
||||
|~+0#4040ff13#ffffff0| @6|r+0#0000001#ffd7ff255| |t|a
|
||||
|~+0#4040ff13#ffffff0| @6|b+0#0000001#ffd7ff255| @2
|
||||
|~+0#4040ff13#ffffff0| @6|a+0#0000001#ffd7ff255| |c+0#ff404010&|o
|
||||
|~+0#4040ff13#ffffff0| @6|m+0#ff404010#ffd7ff255@1|e|n
|
||||
|~+0#4040ff13#ffffff0| @6|t+0#ff404010#ffd7ff255| +0#0000001&|l|i
|
||||
| +0#0000000#ffffff0@5|0|,|n+0#0000001#ffd7ff255|e| @1
|
||||
@@ -5,11 +5,11 @@
|
||||
|5| @40||+0#0000001#ffd7ff255| @11||| +0#0000000#ffffff0@18
|
||||
|6| |++0#0000001#ffd7ff255|-@8| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|++0#0000001#ffd7ff255|-@11|+| +0#0000000#ffffff0@18
|
||||
|7| ||+0#0000001#ffd7ff255|b|o|r|d|e|r| |T|L| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@3|p|a|d@1|i|n|g|s| @2| +0#0000000#ffffff0@37
|
||||
|8| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@37
|
||||
|9| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@37
|
||||
|1|0| @72
|
||||
|1@1| @72
|
||||
|1|2| @72
|
||||
|8| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@16||+0#0000001#ffd7ff255| @2|w|r|a|p@1|e|d| |l|o|n|g|e|r| |t|e
|
||||
|9+0#0000000#ffffff0| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@16||+0#0000001#ffd7ff255| @2|x|t| @14
|
||||
|1+0#0000000#ffffff0|0| @72
|
||||
|1@1| @50||+0#0000001#ffd7ff255| @2|r|i|g|h|t| |a|l|i|g|n|e|d| |t|e|x|t
|
||||
|1+0#0000000#ffffff0|2| @72
|
||||
|1|3| @72
|
||||
|1|4| @72
|
||||
@57|1|,|1| @10|T|o|p|
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
|5| @40|║+0#0000001#ffd7ff255| @11|║| +0#0000000#ffffff0@18
|
||||
|6| |╔+0#0000001#ffd7ff255|═@8| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|╚+0#0000001#ffd7ff255|═@11|╝| +0#0000000#ffffff0@18
|
||||
|7| |║+0#0000001#ffd7ff255|b|o|r|d|e|r| |T|L| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@3|p|a|d@1|i|n|g|s| @2| +0#0000000#ffffff0@37
|
||||
|8| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@37
|
||||
|9| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@37
|
||||
|1|0| @72
|
||||
|1@1| @72
|
||||
|1|2| @72
|
||||
|8| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@16|║+0#0000001#ffd7ff255| @2|w|r|a|p@1|e|d| |l|o|n|g|e|r| |t|e
|
||||
|9+0#0000000#ffffff0| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@16|║+0#0000001#ffd7ff255| @2|x|t| @14
|
||||
|1+0#0000000#ffffff0|0| @72
|
||||
|1@1| @50|║+0#0000001#ffd7ff255| @2|r|i|g|h|t| |a|l|i|g|n|e|d| |t|e|x|t
|
||||
|1+0#0000000#ffffff0|2| @72
|
||||
|1|3| @72
|
||||
|1|4| @72
|
||||
@57|1|,|1| @10|T|o|p|
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
>1+0&#ffffff0| @73
|
||||
|2| @73
|
||||
|3| @73
|
||||
|4| @73
|
||||
|5| @73
|
||||
|6| @31|╔+0#0000001#ffd7ff255|═@5|╗| +0#0000000#ffffff0@33
|
||||
|7| @31|║+0#0000001#ffd7ff255|1@3| @1|║| +0#0000000#ffffff0@33
|
||||
|8| @31|║+0#0000001#ffd7ff255|2@5|║| +0#0000000#ffffff0@33
|
||||
|9| @31|║+0#0000001#ffd7ff255|3@4| |║| +0#0000000#ffffff0@33
|
||||
@33|╚+0#0000001#ffd7ff255|═@5|╝| +0#0000000#ffffff0@15|1|,|1| @10|T|o|p|
|
||||
@@ -0,0 +1,10 @@
|
||||
>1+0&#ffffff0| @73
|
||||
|2| @31|╔+0#0000001#ffd7ff255|═@5|╗| +0#0000000#ffffff0@33
|
||||
|3| @31|║+0#0000001#ffd7ff255|1@3| @1|║| +0#0000000#ffffff0@33
|
||||
|4| @31|║+0#0000001#ffd7ff255|2@5|║| +0#0000000#ffffff0@33
|
||||
|5| @31|║+0#0000001#ffd7ff255|3@4| |║| +0#0000000#ffffff0@33
|
||||
|6| @31|╚+0#0000001#ffd7ff255|═@5|╝| +0#0000000#ffffff0@33
|
||||
|7| @73
|
||||
|8| @73
|
||||
|9| @73
|
||||
@57|1|,|1| @10|T|o|p|
|
||||
@@ -0,0 +1,10 @@
|
||||
>1+0&#ffffff0| @73
|
||||
|2| @73
|
||||
|3| @73
|
||||
|4| @33|3+0#0000001#ffd7ff255@4| +0#0000000#ffffff0@34
|
||||
|5| @33|4+0#0000001#ffd7ff255@1| @2| +0#0000000#ffffff0@34
|
||||
|6| @33|5+0#0000001#ffd7ff255| @3| +0#0000000#ffffff0@34
|
||||
|7| @33|6+0#0000001#ffd7ff255@4| +0#0000000#ffffff0@34
|
||||
|8| @73
|
||||
|9| @73
|
||||
@57|1|,|1| @10|T|o|p|
|
||||
@@ -0,0 +1,10 @@
|
||||
>1+0&#ffffff0| @73
|
||||
|2| @20|╔+0#0000001#ffd7ff255| |m|a|k|e| |a| |c|h|o|i|c|e| |f|r|o|m| |t|h|e| |l|i|s|t| |╗| +0#0000000#ffffff0@21
|
||||
|3| @20|║+0#0000001#ffd7ff255| @28|║| +0#0000000#ffffff0@21
|
||||
|4| @20|║+0#0000001#ffd7ff255| |o+0#0000000#5fd7ff255|n|e| +0#0000001#ffd7ff255@24|║| +0#0000000#ffffff0@21
|
||||
|5| @20|║+0#0000001#ffd7ff255| |t|w|o| @24|║| +0#0000000#ffffff0@21
|
||||
|6| @20|║+0#0000001#ffd7ff255| |a|n|o|t|h|e|r| @20|║| +0#0000000#ffffff0@21
|
||||
|7| @20|║+0#0000001#ffd7ff255| @28|║| +0#0000000#ffffff0@21
|
||||
|8| @20|╚+0#0000001#ffd7ff255|═@28|╝| +0#0000000#ffffff0@21
|
||||
|9| @73
|
||||
@57|1|,|1| @10|T|o|p|
|
||||
@@ -0,0 +1,10 @@
|
||||
>1+0&#ffffff0| @73
|
||||
|2| @20|╔+0#0000001#ffd7ff255| |m|a|k|e| |a| |c|h|o|i|c|e| |f|r|o|m| |t|h|e| |l|i|s|t| |╗| +0#0000000#ffffff0@21
|
||||
|3| @20|║+0#0000001#ffd7ff255| @28|║| +0#0000000#ffffff0@21
|
||||
|4| @20|║+0#0000001#ffd7ff255| |o|n|e| @24|║| +0#0000000#ffffff0@21
|
||||
|5| @20|║+0#0000001#ffd7ff255| |t|w|o| @24|║| +0#0000000#ffffff0@21
|
||||
|6| @20|║+0#0000001#ffd7ff255| |a+0#0000000#5fd7ff255|n|o|t|h|e|r| +0#0000001#ffd7ff255@20|║| +0#0000000#ffffff0@21
|
||||
|7| @20|║+0#0000001#ffd7ff255| @28|║| +0#0000000#ffffff0@21
|
||||
|8| @20|╚+0#0000001#ffd7ff255|═@28|╝| +0#0000000#ffffff0@21
|
||||
|9| @73
|
||||
@57|1|,|1| @10|T|o|p|
|
||||
@@ -0,0 +1,10 @@
|
||||
>1+0&#ffffff0| @73
|
||||
|2| @73
|
||||
|3| @73
|
||||
|4| @73
|
||||
|5| @73
|
||||
|6| @73
|
||||
|7| @73
|
||||
|8| @73
|
||||
|9| @73
|
||||
|s|e|l|e|c|t|e|d| |3| @46|1|,|1| @10|T|o|p|
|
||||
@@ -0,0 +1,10 @@
|
||||
>1+0&#ffffff0| @7|╔+0#e000002&|═@21|╗| +0#0000000&@41
|
||||
|2| @7|║+0#e000002&| |f|i|r|s|t| |n|o|t|i|f|i|c|a|t|i|o|n| @2|║| +0#0000000&@41
|
||||
|3| @7|╚+0#e000002&|═@21|╝| +0#0000000&@41
|
||||
|4| @73
|
||||
|5| @73
|
||||
|6| @73
|
||||
|7| @73
|
||||
|8| @73
|
||||
|9| @73
|
||||
@57|1|,|1| @10|T|o|p|
|
||||
@@ -0,0 +1,10 @@
|
||||
>1+0&#ffffff0| @7|╔+0#e000002&|═@21|╗| +0#0000000&@41
|
||||
|2| @7|║+0#e000002&| |f|i|r|s|t| |n|o|t|i|f|i|c|a|t|i|o|n| @2|║| +0#0000000&@41
|
||||
|3| @7|╚+0#e000002&|═@21|╝| +0#0000000&@41
|
||||
|4| @7|╔+0fd7ff255|═@31|╗| +0&#ffffff0@31
|
||||
|5| @7|║+0fd7ff255| |a|n|o|t|h|e|r| |i|m|p|o|r|t|a|n|t| |n|o|t|i|f|i|c|a|t|i|o|n| |║| +0&#ffffff0@31
|
||||
|6| @7|╚+0fd7ff255|═@31|╝| +0&#ffffff0@31
|
||||
|7| @73
|
||||
|8| @73
|
||||
|9| @73
|
||||
|:|c|a|l@1| |p|o|p|u|p|_|n|o|t|i|f|i|c|a|t|i|o|n|(|'|a|n|o|t|h|e|r| |i|m|p|o|r|t|a|n|t| |n|o|t|i|f|i|c|a|t|i|o|n|'|1|,|1| @10|T|o|p|
|
||||
@@ -0,0 +1,10 @@
|
||||
>1+0&#ffffff0| @73
|
||||
|2| @73
|
||||
|3| @7|╔+0#0000001#ffd7ff255|═@17|╗| +0#0000000#ffffff0@45
|
||||
|4| @7|║+0#0000001#ffd7ff255|t|h|e| |w+1#0000000#ffffff0|o|r|d| @9|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@45
|
||||
|5| @7|║+0#0000001#ffd7ff255|s+1#0000000#ffffff0|o|m|e| |m|o|r|e| @8|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@45
|
||||
|6| @7|║+0#0000001#ffd7ff255|s+1#0000000#ffffff0|e|v|e|r|a|l| |w|o|r|d|s| +0#0000001#ffd7ff255|h|e|r|e|║| +0#0000000#ffffff0@45
|
||||
|7| @7|╚+0#0000001#ffd7ff255|═@17|╝| +0#0000000#ffffff0@45
|
||||
|8| @73
|
||||
|9| @73
|
||||
|:|c|a|l@1| |S|e|l|e|c|t|1|(|)| @41|1|,|1| @10|T|o|p|
|
||||
@@ -0,0 +1,10 @@
|
||||
|1+0&#ffffff0>w|o|r|d| @69
|
||||
|s|o|m|e| |m|o|r|e| @65
|
||||
|s|e|v|e|r|a|l| |w|o|r|d|s| @61
|
||||
|2| @73
|
||||
|3| @73
|
||||
|4| @73
|
||||
|5| @73
|
||||
|6| @73
|
||||
|7| @73
|
||||
@57|1|,|2| @10|T|o|p|
|
||||
@@ -0,0 +1,10 @@
|
||||
>1+0&#ffffff0| @73
|
||||
|2| @73
|
||||
|3| @73
|
||||
|4| @28| +0#0000001#ffd7ff255|T|i|t|l|e| |S|t|r|i|n|g| | +0#0000000#ffffff0@30
|
||||
|5| @28|o+0#0000001#ffd7ff255|n|e| @10| +0#0000000#ffffff0@30
|
||||
|6| @28|t+0#0000001#ffd7ff255|w|o| @10| +0#0000000#ffffff0@30
|
||||
|7| @28|a+0#0000001#ffd7ff255|n|o|t|h|e|r| @6| +0#0000000#ffffff0@30
|
||||
|8| @73
|
||||
|9| @73
|
||||
@57|1|,|1| @10|T|o|p|
|
||||
@@ -0,0 +1,6 @@
|
||||
| +0#0000e05#a8a8a8255@1|x+0#0000000#ffffff0@72
|
||||
| +0#0000e05#a8a8a8255@1|x+0#0000000#ffffff0@1| @70
|
||||
|=+0&#ffff4012|>>m+0&#ffffff0@3| @68
|
||||
| +0#0000e05#a8a8a8255@1|y+0#0000000#ffffff0@3| @68
|
||||
|~+0#4040ff13&| @73
|
||||
| +0#0000000&@56|2|,|1| @10|A|l@1|
|
||||
@@ -0,0 +1,6 @@
|
||||
|x+0&#ffffff0@74
|
||||
>m@3| @70
|
||||
|y@3| @70
|
||||
|~+0#4040ff13&| @73
|
||||
|~| @73
|
||||
|:+0#0000000&|s|i|g|n| |u|n|p|l|a|c|e| |1|0| @40|2|,|1| @10|A|l@1|
|
||||
+10
-2
@@ -38,8 +38,11 @@ if &lines < 24 || &columns < 80
|
||||
echoerr error
|
||||
split test.log
|
||||
$put =error
|
||||
w
|
||||
cquit
|
||||
write
|
||||
split messages
|
||||
call append(line('$'), error)
|
||||
write
|
||||
qa!
|
||||
endif
|
||||
|
||||
if has('reltime')
|
||||
@@ -167,6 +170,11 @@ func RunTheTest(test)
|
||||
au!
|
||||
au SwapExists * call HandleSwapExists()
|
||||
|
||||
" Close any stray popup windows
|
||||
if has('textprop')
|
||||
call popup_clear()
|
||||
endif
|
||||
|
||||
" Close any extra tab pages and windows and make the current one not modified.
|
||||
while tabpagenr('$') > 1
|
||||
quit!
|
||||
|
||||
@@ -144,7 +144,7 @@ func VerifyScreenDump(buf, filename, options, ...)
|
||||
if i == 100
|
||||
" Leave the failed dump around for inspection.
|
||||
if filereadable(reference)
|
||||
let msg = 'See dump file difference: call term_dumpdiff("' . testfile . '", "' . reference . '")'
|
||||
let msg = 'See dump file difference: call term_dumpdiff("testdir/' .. testfile .. '", "testdir/' .. reference .. '")'
|
||||
if a:0 == 1
|
||||
let msg = a:1 . ': ' . msg
|
||||
endif
|
||||
@@ -152,7 +152,7 @@ func VerifyScreenDump(buf, filename, options, ...)
|
||||
let msg = msg . '; line count is ' . len(testdump) . ' instead of ' . len(refdump)
|
||||
endif
|
||||
else
|
||||
let msg = 'See new dump file: call term_dumpload("' . testfile . '")'
|
||||
let msg = 'See new dump file: call term_dumpload("testdir/' .. testfile .. '")'
|
||||
endif
|
||||
for i in range(len(refdump))
|
||||
if i >= len(testdump)
|
||||
|
||||
@@ -330,7 +330,7 @@ endfunc
|
||||
|
||||
" Get line "lnum" as displayed on the screen.
|
||||
" Trailing white space is trimmed.
|
||||
func! Screenline(lnum)
|
||||
func Screenline(lnum)
|
||||
let chars = []
|
||||
for c in range(1, winwidth(0))
|
||||
call add(chars, nr2char(screenchar(a:lnum, c)))
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
" NOTE: This just checks if the code works. If you know Arabic please add
|
||||
" functional tests that check the shaping works with real text.
|
||||
|
||||
if !has('arabic')
|
||||
throw 'Skipped: arabic feature missing'
|
||||
endif
|
||||
source check.vim
|
||||
CheckFeature arabic
|
||||
|
||||
source view_util.vim
|
||||
|
||||
|
||||
@@ -222,6 +222,25 @@ func Test_override()
|
||||
call assert_fails("call test_override('redraw', 'yes')", 'E474')
|
||||
endfunc
|
||||
|
||||
func Test_mouse_position()
|
||||
let save_mouse = &mouse
|
||||
set mouse=a
|
||||
new
|
||||
call setline(1, ['line one', 'line two'])
|
||||
call assert_equal([0, 1, 1, 0], getpos('.'))
|
||||
call test_setmouse(1, 5)
|
||||
call feedkeys("\<LeftMouse>", "xt")
|
||||
call assert_equal([0, 1, 5, 0], getpos('.'))
|
||||
call test_setmouse(2, 20)
|
||||
call feedkeys("\<LeftMouse>", "xt")
|
||||
call assert_equal([0, 2, 8, 0], getpos('.'))
|
||||
call test_setmouse(5, 1)
|
||||
call feedkeys("\<LeftMouse>", "xt")
|
||||
call assert_equal([0, 2, 1, 0], getpos('.'))
|
||||
bwipe!
|
||||
let &mouse = save_mouse
|
||||
endfunc
|
||||
|
||||
func Test_user_is_happy()
|
||||
smile
|
||||
sleep 300m
|
||||
|
||||
+491
-27
@@ -495,9 +495,10 @@ func Test_empty_doau()
|
||||
endfunc
|
||||
|
||||
func s:AutoCommandOptionSet(match)
|
||||
let template = "Option: <%s>, OldVal: <%s>, OldValLocal: <%s>, OldValGlobal: <%s>, NewVal: <%s>, Scope: <%s>, Command: <%s>\n"
|
||||
let item = remove(g:options, 0)
|
||||
let expected = printf("Option: <%s>, Oldval: <%s>, NewVal: <%s>, Scope: <%s>\n", item[0], item[1], item[2], item[3])
|
||||
let actual = printf("Option: <%s>, Oldval: <%s>, NewVal: <%s>, Scope: <%s>\n", a:match, v:option_old, v:option_new, v:option_type)
|
||||
let expected = printf(template, item[0], item[1], item[2], item[3], item[4], item[5], item[6])
|
||||
let actual = printf(template, a:match, v:option_old, v:option_oldlocal, v:option_oldglobal, v:option_new, v:option_type, v:option_command)
|
||||
let g:opt = [expected, actual]
|
||||
"call assert_equal(expected, actual)
|
||||
endfunc
|
||||
@@ -514,92 +515,100 @@ func Test_OptionSet()
|
||||
au OptionSet * :call s:AutoCommandOptionSet(expand("<amatch>"))
|
||||
|
||||
" 1: Setting number option"
|
||||
let g:options=[['number', 0, 1, 'global']]
|
||||
let g:options=[['number', 0, 0, 0, 1, 'global', 'set']]
|
||||
set nu
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 2: Setting local number option"
|
||||
let g:options=[['number', 1, 0, 'local']]
|
||||
let g:options=[['number', 1, 1, '', 0, 'local', 'setlocal']]
|
||||
setlocal nonu
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 3: Setting global number option"
|
||||
let g:options=[['number', 1, 0, 'global']]
|
||||
let g:options=[['number', 1, '', 1, 0, 'global', 'setglobal']]
|
||||
setglobal nonu
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 4: Setting local autoindent option"
|
||||
let g:options=[['autoindent', 0, 1, 'local']]
|
||||
let g:options=[['autoindent', 0, 0, '', 1, 'local', 'setlocal']]
|
||||
setlocal ai
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 5: Setting global autoindent option"
|
||||
let g:options=[['autoindent', 0, 1, 'global']]
|
||||
let g:options=[['autoindent', 0, '', 0, 1, 'global', 'setglobal']]
|
||||
setglobal ai
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 6: Setting global autoindent option"
|
||||
let g:options=[['autoindent', 1, 0, 'global']]
|
||||
let g:options=[['autoindent', 1, 1, 1, 0, 'global', 'set']]
|
||||
set ai!
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 6a: Setting global autoindent option"
|
||||
let g:options=[['autoindent', 1, 1, 0, 0, 'global', 'set']]
|
||||
noa setlocal ai
|
||||
noa setglobal noai
|
||||
set ai!
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" Should not print anything, use :noa
|
||||
" 7: don't trigger OptionSet"
|
||||
let g:options=[['invalid', 1, 1, 'invalid']]
|
||||
let g:options=[['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid']]
|
||||
noa set nonu
|
||||
call assert_equal([['invalid', 1, 1, 'invalid']], g:options)
|
||||
call assert_equal([['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid']], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 8: Setting several global list and number option"
|
||||
let g:options=[['list', 0, 1, 'global'], ['number', 0, 1, 'global']]
|
||||
let g:options=[['list', 0, 0, 0, 1, 'global', 'set'], ['number', 0, 0, 0, 1, 'global', 'set']]
|
||||
set list nu
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 9: don't trigger OptionSet"
|
||||
let g:options=[['invalid', 1, 1, 'invalid'], ['invalid', 1, 1, 'invalid']]
|
||||
let g:options=[['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid'], ['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid']]
|
||||
noa set nolist nonu
|
||||
call assert_equal([['invalid', 1, 1, 'invalid'], ['invalid', 1, 1, 'invalid']], g:options)
|
||||
call assert_equal([['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid'], ['invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid', 'invalid']], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 10: Setting global acd"
|
||||
let g:options=[['autochdir', 0, 1, 'local']]
|
||||
let g:options=[['autochdir', 0, 0, '', 1, 'local', 'setlocal']]
|
||||
setlocal acd
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 11: Setting global autoread (also sets local value)"
|
||||
let g:options=[['autoread', 0, 1, 'global']]
|
||||
let g:options=[['autoread', 0, 0, 0, 1, 'global', 'set']]
|
||||
set ar
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 12: Setting local autoread"
|
||||
let g:options=[['autoread', 1, 1, 'local']]
|
||||
let g:options=[['autoread', 1, 1, '', 1, 'local', 'setlocal']]
|
||||
setlocal ar
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 13: Setting global autoread"
|
||||
let g:options=[['autoread', 1, 0, 'global']]
|
||||
let g:options=[['autoread', 1, '', 1, 0, 'global', 'setglobal']]
|
||||
setglobal invar
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 14: Setting option backspace through :let"
|
||||
let g:options=[['backspace', '', 'eol,indent,start', 'global']]
|
||||
let g:options=[['backspace', '', '', '', 'eol,indent,start', 'global', 'set']]
|
||||
let &bs="eol,indent,start"
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 15: Setting option backspace through setbufvar()"
|
||||
let g:options=[['backup', 0, 1, 'local']]
|
||||
let g:options=[['backup', 0, 0, '', 1, 'local', 'setlocal']]
|
||||
" try twice, first time, shouldn't trigger because option name is invalid,
|
||||
" second time, it should trigger
|
||||
let bnum = bufnr('%')
|
||||
@@ -610,34 +619,489 @@ func Test_OptionSet()
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 16: Setting number option using setwinvar"
|
||||
let g:options=[['number', 0, 1, 'local']]
|
||||
let g:options=[['number', 0, 0, '', 1, 'local', 'setlocal']]
|
||||
call setwinvar(0, '&number', 1)
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 17: Setting key option, shouldn't trigger"
|
||||
let g:options=[['key', 'invalid', 'invalid1', 'invalid']]
|
||||
let g:options=[['key', 'invalid', 'invalid1', 'invalid2', 'invalid3', 'invalid4', 'invalid5']]
|
||||
setlocal key=blah
|
||||
setlocal key=
|
||||
call assert_equal([['key', 'invalid', 'invalid1', 'invalid']], g:options)
|
||||
call assert_equal([['key', 'invalid', 'invalid1', 'invalid2', 'invalid3', 'invalid4', 'invalid5']], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 18: Setting string option"
|
||||
|
||||
" 18a: Setting string global option"
|
||||
let oldval = &backupext
|
||||
let g:options=[['backupext', oldval, oldval, oldval, 'foo', 'global', 'set']]
|
||||
set backupext=foo
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 18b: Resetting string global option"
|
||||
let g:options=[['backupext', 'foo', 'foo', 'foo', oldval, 'global', 'set']]
|
||||
set backupext&
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 18c: Setting global string global option"
|
||||
let g:options=[['backupext', oldval, '', oldval, 'bar', 'global', 'setglobal']]
|
||||
setglobal backupext=bar
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 18d: Setting local string global option"
|
||||
" As this is a global option this sets the global value even though
|
||||
" :setlocal is used!
|
||||
noa set backupext& " Reset global and local value (without triggering autocmd)
|
||||
let g:options=[['backupext', oldval, oldval, '', 'baz', 'local', 'setlocal']]
|
||||
setlocal backupext=baz
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 18e: Setting again string global option"
|
||||
noa setglobal backupext=ext_global " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal backupext=ext_local " Sets the global(!) value!
|
||||
let g:options=[['backupext', 'ext_local', 'ext_local', 'ext_local', 'fuu', 'global', 'set']]
|
||||
set backupext=fuu
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
|
||||
" 19a: Setting string local-global (to buffer) option"
|
||||
let oldval = &tags
|
||||
let g:options=[['tags', oldval, 'tagpath', 'global']]
|
||||
let g:options=[['tags', oldval, oldval, oldval, 'tagpath', 'global', 'set']]
|
||||
set tags=tagpath
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 1l: Resetting string option"
|
||||
let g:options=[['tags', 'tagpath', oldval, 'global']]
|
||||
" 19b: Resetting string local-global (to buffer) option"
|
||||
let g:options=[['tags', 'tagpath', 'tagpath', 'tagpath', oldval, 'global', 'set']]
|
||||
set tags&
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 19c: Setting global string local-global (to buffer) option "
|
||||
let g:options=[['tags', oldval, '', oldval, 'tagpath1', 'global', 'setglobal']]
|
||||
setglobal tags=tagpath1
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 19d: Setting local string local-global (to buffer) option"
|
||||
let g:options=[['tags', 'tagpath1', 'tagpath1', '', 'tagpath2', 'local', 'setlocal']]
|
||||
setlocal tags=tagpath2
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 19e: Setting again string local-global (to buffer) option"
|
||||
" Note: v:option_old is the old global value for local-global string options
|
||||
" but the old local value for all other kinds of options.
|
||||
noa setglobal tags=tag_global " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal tags=tag_local
|
||||
let g:options=[['tags', 'tag_global', 'tag_local', 'tag_global', 'tagpath', 'global', 'set']]
|
||||
set tags=tagpath
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 19f: Setting string local-global (to buffer) option to an empty string"
|
||||
" Note: v:option_old is the old global value for local-global string options
|
||||
" but the old local value for all other kinds of options.
|
||||
noa set tags=tag_global " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal tags= " empty string
|
||||
let g:options=[['tags', 'tag_global', '', 'tag_global', 'tagpath', 'global', 'set']]
|
||||
set tags=tagpath
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
|
||||
" 20a: Setting string local (to buffer) option"
|
||||
let oldval = &spelllang
|
||||
let g:options=[['spelllang', oldval, oldval, oldval, 'elvish,klingon', 'global', 'set']]
|
||||
set spelllang=elvish,klingon
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 20b: Resetting string local (to buffer) option"
|
||||
let g:options=[['spelllang', 'elvish,klingon', 'elvish,klingon', 'elvish,klingon', oldval, 'global', 'set']]
|
||||
set spelllang&
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 20c: Setting global string local (to buffer) option"
|
||||
let g:options=[['spelllang', oldval, '', oldval, 'elvish', 'global', 'setglobal']]
|
||||
setglobal spelllang=elvish
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 20d: Setting local string local (to buffer) option"
|
||||
noa set spelllang& " Reset global and local value (without triggering autocmd)
|
||||
let g:options=[['spelllang', oldval, oldval, '', 'klingon', 'local', 'setlocal']]
|
||||
setlocal spelllang=klingon
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 20e: Setting again string local (to buffer) option"
|
||||
" Note: v:option_old is the old global value for local-global string options
|
||||
" but the old local value for all other kinds of options.
|
||||
noa setglobal spelllang=spellglobal " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal spelllang=spelllocal
|
||||
let g:options=[['spelllang', 'spelllocal', 'spelllocal', 'spellglobal', 'foo', 'global', 'set']]
|
||||
set spelllang=foo
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
|
||||
" 21a: Setting string local-global (to window) option"
|
||||
let oldval = &statusline
|
||||
let g:options=[['statusline', oldval, oldval, oldval, 'foo', 'global', 'set']]
|
||||
set statusline=foo
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 21b: Resetting string local-global (to window) option"
|
||||
" Note: v:option_old is the old global value for local-global string options
|
||||
" but the old local value for all other kinds of options.
|
||||
let g:options=[['statusline', 'foo', 'foo', 'foo', oldval, 'global', 'set']]
|
||||
set statusline&
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 21c: Setting global string local-global (to window) option"
|
||||
let g:options=[['statusline', oldval, '', oldval, 'bar', 'global', 'setglobal']]
|
||||
setglobal statusline=bar
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 21d: Setting local string local-global (to window) option"
|
||||
noa set statusline& " Reset global and local value (without triggering autocmd)
|
||||
let g:options=[['statusline', oldval, oldval, '', 'baz', 'local', 'setlocal']]
|
||||
setlocal statusline=baz
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 21e: Setting again string local-global (to window) option"
|
||||
" Note: v:option_old is the old global value for local-global string options
|
||||
" but the old local value for all other kinds of options.
|
||||
noa setglobal statusline=bar " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal statusline=baz
|
||||
let g:options=[['statusline', 'bar', 'baz', 'bar', 'foo', 'global', 'set']]
|
||||
set statusline=foo
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
|
||||
" 22a: Setting string local (to window) option"
|
||||
let oldval = &foldignore
|
||||
let g:options=[['foldignore', oldval, oldval, oldval, 'fo', 'global', 'set']]
|
||||
set foldignore=fo
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 22b: Resetting string local (to window) option"
|
||||
let g:options=[['foldignore', 'fo', 'fo', 'fo', oldval, 'global', 'set']]
|
||||
set foldignore&
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 22c: Setting global string local (to window) option"
|
||||
let g:options=[['foldignore', oldval, '', oldval, 'bar', 'global', 'setglobal']]
|
||||
setglobal foldignore=bar
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 22d: Setting local string local (to window) option"
|
||||
noa set foldignore& " Reset global and local value (without triggering autocmd)
|
||||
let g:options=[['foldignore', oldval, oldval, '', 'baz', 'local', 'setlocal']]
|
||||
setlocal foldignore=baz
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 22e: Setting again string local (to window) option"
|
||||
noa setglobal foldignore=glob " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal foldignore=loc
|
||||
let g:options=[['foldignore', 'loc', 'loc', 'glob', 'fo', 'global', 'set']]
|
||||
set foldignore=fo
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
|
||||
" 23a: Setting global number local option"
|
||||
noa setglobal cmdheight=8 " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal cmdheight=1 " Sets the global(!) value!
|
||||
let g:options=[['cmdheight', '1', '', '1', '2', 'global', 'setglobal']]
|
||||
setglobal cmdheight=2
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 23b: Setting local number global option"
|
||||
noa setglobal cmdheight=8 " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal cmdheight=1 " Sets the global(!) value!
|
||||
let g:options=[['cmdheight', '1', '1', '', '2', 'local', 'setlocal']]
|
||||
setlocal cmdheight=2
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 23c: Setting again number global option"
|
||||
noa setglobal cmdheight=8 " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal cmdheight=1 " Sets the global(!) value!
|
||||
let g:options=[['cmdheight', '1', '1', '1', '2', 'global', 'set']]
|
||||
set cmdheight=2
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 23d: Setting again number global option"
|
||||
noa set cmdheight=8 " Reset global and local value (without triggering autocmd)
|
||||
let g:options=[['cmdheight', '8', '8', '8', '2', 'global', 'set']]
|
||||
set cmdheight=2
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
|
||||
" 24a: Setting global number global-local (to buffer) option"
|
||||
noa setglobal undolevels=8 " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal undolevels=1
|
||||
let g:options=[['undolevels', '8', '', '8', '2', 'global', 'setglobal']]
|
||||
setglobal undolevels=2
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 24b: Setting local number global-local (to buffer) option"
|
||||
noa setglobal undolevels=8 " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal undolevels=1
|
||||
let g:options=[['undolevels', '1', '1', '', '2', 'local', 'setlocal']]
|
||||
setlocal undolevels=2
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 24c: Setting again number global-local (to buffer) option"
|
||||
noa setglobal undolevels=8 " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal undolevels=1
|
||||
let g:options=[['undolevels', '1', '1', '8', '2', 'global', 'set']]
|
||||
set undolevels=2
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 24d: Setting again global number global-local (to buffer) option"
|
||||
noa set undolevels=8 " Reset global and local value (without triggering autocmd)
|
||||
let g:options=[['undolevels', '8', '8', '8', '2', 'global', 'set']]
|
||||
set undolevels=2
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
|
||||
" 25a: Setting global number local (to buffer) option"
|
||||
noa setglobal wrapmargin=8 " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal wrapmargin=1
|
||||
let g:options=[['wrapmargin', '8', '', '8', '2', 'global', 'setglobal']]
|
||||
setglobal wrapmargin=2
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 25b: Setting local number local (to buffer) option"
|
||||
noa setglobal wrapmargin=8 " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal wrapmargin=1
|
||||
let g:options=[['wrapmargin', '1', '1', '', '2', 'local', 'setlocal']]
|
||||
setlocal wrapmargin=2
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 25c: Setting again number local (to buffer) option"
|
||||
noa setglobal wrapmargin=8 " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal wrapmargin=1
|
||||
let g:options=[['wrapmargin', '1', '1', '8', '2', 'global', 'set']]
|
||||
set wrapmargin=2
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 25d: Setting again global number local (to buffer) option"
|
||||
noa set wrapmargin=8 " Reset global and local value (without triggering autocmd)
|
||||
let g:options=[['wrapmargin', '8', '8', '8', '2', 'global', 'set']]
|
||||
set wrapmargin=2
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
|
||||
" 26: Setting number global-local (to window) option.
|
||||
" Such option does currently not exist.
|
||||
|
||||
|
||||
" 27a: Setting global number local (to window) option"
|
||||
noa setglobal foldcolumn=8 " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal foldcolumn=1
|
||||
let g:options=[['foldcolumn', '8', '', '8', '2', 'global', 'setglobal']]
|
||||
setglobal foldcolumn=2
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 27b: Setting local number local (to window) option"
|
||||
noa setglobal foldcolumn=8 " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal foldcolumn=1
|
||||
let g:options=[['foldcolumn', '1', '1', '', '2', 'local', 'setlocal']]
|
||||
setlocal foldcolumn=2
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 27c: Setting again number local (to window) option"
|
||||
noa setglobal foldcolumn=8 " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal foldcolumn=1
|
||||
let g:options=[['foldcolumn', '1', '1', '8', '2', 'global', 'set']]
|
||||
set foldcolumn=2
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 27d: Ssettin again global number local (to window) option"
|
||||
noa set foldcolumn=8 " Reset global and local value (without triggering autocmd)
|
||||
let g:options=[['foldcolumn', '8', '8', '8', '2', 'global', 'set']]
|
||||
set foldcolumn=2
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
|
||||
" 28a: Setting global boolean global option"
|
||||
noa setglobal nowrapscan " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal wrapscan " Sets the global(!) value!
|
||||
let g:options=[['wrapscan', '1', '', '1', '0', 'global', 'setglobal']]
|
||||
setglobal nowrapscan
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 28b: Setting local boolean global option"
|
||||
noa setglobal nowrapscan " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal wrapscan " Sets the global(!) value!
|
||||
let g:options=[['wrapscan', '1', '1', '', '0', 'local', 'setlocal']]
|
||||
setlocal nowrapscan
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 28c: Setting again boolean global option"
|
||||
noa setglobal nowrapscan " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal wrapscan " Sets the global(!) value!
|
||||
let g:options=[['wrapscan', '1', '1', '1', '0', 'global', 'set']]
|
||||
set nowrapscan
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 28d: Setting again global boolean global option"
|
||||
noa set nowrapscan " Reset global and local value (without triggering autocmd)
|
||||
let g:options=[['wrapscan', '0', '0', '0', '1', 'global', 'set']]
|
||||
set wrapscan
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
|
||||
" 29a: Setting global boolean global-local (to buffer) option"
|
||||
noa setglobal noautoread " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal autoread
|
||||
let g:options=[['autoread', '0', '', '0', '1', 'global', 'setglobal']]
|
||||
setglobal autoread
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 29b: Setting local boolean global-local (to buffer) option"
|
||||
noa setglobal noautoread " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal autoread
|
||||
let g:options=[['autoread', '1', '1', '', '0', 'local', 'setlocal']]
|
||||
setlocal noautoread
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 29c: Setting again boolean global-local (to buffer) option"
|
||||
noa setglobal noautoread " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal autoread
|
||||
let g:options=[['autoread', '1', '1', '0', '1', 'global', 'set']]
|
||||
set autoread
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 29d: Setting again global boolean global-local (to buffer) option"
|
||||
noa set noautoread " Reset global and local value (without triggering autocmd)
|
||||
let g:options=[['autoread', '0', '0', '0', '1', 'global', 'set']]
|
||||
set autoread
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
|
||||
" 30a: Setting global boolean local (to buffer) option"
|
||||
noa setglobal nocindent " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal cindent
|
||||
let g:options=[['cindent', '0', '', '0', '1', 'global', 'setglobal']]
|
||||
setglobal cindent
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 30b: Setting local boolean local (to buffer) option"
|
||||
noa setglobal nocindent " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal cindent
|
||||
let g:options=[['cindent', '1', '1', '', '0', 'local', 'setlocal']]
|
||||
setlocal nocindent
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 30c: Setting again boolean local (to buffer) option"
|
||||
noa setglobal nocindent " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal cindent
|
||||
let g:options=[['cindent', '1', '1', '0', '1', 'global', 'set']]
|
||||
set cindent
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 30d: Setting again global boolean local (to buffer) option"
|
||||
noa set nocindent " Reset global and local value (without triggering autocmd)
|
||||
let g:options=[['cindent', '0', '0', '0', '1', 'global', 'set']]
|
||||
set cindent
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
|
||||
" 31: Setting boolean global-local (to window) option
|
||||
" Currently no such option exists.
|
||||
|
||||
|
||||
" 32a: Setting global boolean local (to window) option"
|
||||
noa setglobal nocursorcolumn " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal cursorcolumn
|
||||
let g:options=[['cursorcolumn', '0', '', '0', '1', 'global', 'setglobal']]
|
||||
setglobal cursorcolumn
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 32b: Setting local boolean local (to window) option"
|
||||
noa setglobal nocursorcolumn " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal cursorcolumn
|
||||
let g:options=[['cursorcolumn', '1', '1', '', '0', 'local', 'setlocal']]
|
||||
setlocal nocursorcolumn
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 32c: Setting again boolean local (to window) option"
|
||||
noa setglobal nocursorcolumn " Reset global and local value (without triggering autocmd)
|
||||
noa setlocal cursorcolumn
|
||||
let g:options=[['cursorcolumn', '1', '1', '0', '1', 'global', 'set']]
|
||||
set cursorcolumn
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
" 32d: Setting again global boolean local (to window) option"
|
||||
noa set nocursorcolumn " Reset global and local value (without triggering autocmd)
|
||||
let g:options=[['cursorcolumn', '0', '0', '0', '1', 'global', 'set']]
|
||||
set cursorcolumn
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
|
||||
" 33: Test autocomands when an option value is converted internally.
|
||||
noa set backspace=1 " Reset global and local value (without triggering autocmd)
|
||||
let g:options=[['backspace', 'indent,eol', 'indent,eol', 'indent,eol', '2', 'global', 'set']]
|
||||
set backspace=2
|
||||
call assert_equal([], g:options)
|
||||
call assert_equal(g:opt[0], g:opt[1])
|
||||
|
||||
|
||||
" Cleanup
|
||||
au! OptionSet
|
||||
for opt in ['nu', 'ai', 'acd', 'ar', 'bs', 'backup', 'cul', 'cp']
|
||||
" set tags&
|
||||
for opt in ['nu', 'ai', 'acd', 'ar', 'bs', 'backup', 'cul', 'cp', 'backupext', 'tags', 'spelllang', 'statusline', 'foldignore', 'cmdheight', 'undolevels', 'wrapmargin', 'foldcolumn', 'wrapscan', 'autoread', 'cindent', 'cursorcolumn']
|
||||
exe printf(":set %s&vim", opt)
|
||||
endfor
|
||||
call test_override('starting', 0)
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
" Tests for 'balloonevalterm'.
|
||||
" A few tests only work in the terminal.
|
||||
|
||||
if !has('balloon_eval_term')
|
||||
throw 'Skipped: balloon_eval_term feature missing'
|
||||
if has('gui_running')
|
||||
throw 'Skipped: only work in the terminal'
|
||||
endif
|
||||
|
||||
" A few tests only work in the terminal.
|
||||
if !has('gui_running')
|
||||
source check.vim
|
||||
CheckFeature balloon_eval_term
|
||||
|
||||
source screendump.vim
|
||||
if !CanRunVimInTerminal()
|
||||
@@ -56,28 +57,3 @@ func Test_balloon_eval_term_visual()
|
||||
call StopVimInTerminal(buf)
|
||||
call delete('XTest_beval_visual')
|
||||
endfunc
|
||||
|
||||
endif
|
||||
|
||||
" Tests that only work in the GUI
|
||||
if has('gui_running')
|
||||
|
||||
if !has('gui_macvim') " See https://github.com/macvim-dev/macvim/issues/902
|
||||
|
||||
func Test_balloon_show_gui()
|
||||
let msg = 'this this this this'
|
||||
call balloon_show(msg)
|
||||
call assert_equal(msg, balloon_gettext())
|
||||
sleep 10m
|
||||
call balloon_show('')
|
||||
|
||||
let msg = 'that that'
|
||||
call balloon_show(msg)
|
||||
call assert_equal(msg, balloon_gettext())
|
||||
sleep 10m
|
||||
call balloon_show('')
|
||||
endfunc
|
||||
|
||||
endif " !has('gui_macvim')
|
||||
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
" Tests for 'ballooneval' in the GUI.
|
||||
|
||||
if !has('gui_running')
|
||||
throw 'Skipped: only works in the GUI'
|
||||
endif
|
||||
|
||||
source check.vim
|
||||
CheckFeature balloon_eval
|
||||
|
||||
if !has('gui_macvim') " See https://github.com/macvim-dev/macvim/issues/902
|
||||
|
||||
func Test_balloon_show_gui()
|
||||
let msg = 'this this this this'
|
||||
call balloon_show(msg)
|
||||
call assert_equal(msg, balloon_gettext())
|
||||
sleep 10m
|
||||
call balloon_show('')
|
||||
|
||||
let msg = 'that that'
|
||||
call balloon_show(msg)
|
||||
call assert_equal(msg, balloon_gettext())
|
||||
sleep 10m
|
||||
call balloon_show('')
|
||||
endfunc
|
||||
|
||||
endif " !has('gui_macvim')
|
||||
@@ -378,6 +378,7 @@ func Test_getcompletion()
|
||||
endfor
|
||||
|
||||
call delete('Xtags')
|
||||
set tags&
|
||||
|
||||
call assert_fails('call getcompletion("", "burp")', 'E475:')
|
||||
endfunc
|
||||
|
||||
@@ -0,0 +1,258 @@
|
||||
" Test for :const
|
||||
|
||||
func s:noop()
|
||||
endfunc
|
||||
|
||||
func Test_define_var_with_lock()
|
||||
const i = 1
|
||||
const f = 1.1
|
||||
const s = 'vim'
|
||||
const F = funcref('s:noop')
|
||||
const l = [1, 2, 3]
|
||||
const d = {'foo': 10}
|
||||
if has('channel')
|
||||
const j = test_null_job()
|
||||
const c = test_null_channel()
|
||||
endif
|
||||
const b = v:true
|
||||
const n = v:null
|
||||
const bl = 0zC0FFEE
|
||||
const here =<< trim EOS
|
||||
hello
|
||||
EOS
|
||||
|
||||
call assert_true(exists('i'))
|
||||
call assert_true(exists('f'))
|
||||
call assert_true(exists('s'))
|
||||
call assert_true(exists('F'))
|
||||
call assert_true(exists('l'))
|
||||
call assert_true(exists('d'))
|
||||
if has('channel')
|
||||
call assert_true(exists('j'))
|
||||
call assert_true(exists('c'))
|
||||
endif
|
||||
call assert_true(exists('b'))
|
||||
call assert_true(exists('n'))
|
||||
call assert_true(exists('bl'))
|
||||
call assert_true(exists('here'))
|
||||
|
||||
call assert_fails('let i = 1', 'E741:')
|
||||
call assert_fails('let f = 1.1', 'E741:')
|
||||
call assert_fails('let s = "vim"', 'E741:')
|
||||
call assert_fails('let F = funcref("s:noop")', 'E741:')
|
||||
call assert_fails('let l = [1, 2, 3]', 'E741:')
|
||||
call assert_fails('let d = {"foo": 10}', 'E741:')
|
||||
if has('channel')
|
||||
call assert_fails('let j = test_null_job()', 'E741:')
|
||||
call assert_fails('let c = test_null_channel()', 'E741:')
|
||||
endif
|
||||
call assert_fails('let b = v:true', 'E741:')
|
||||
call assert_fails('let n = v:null', 'E741:')
|
||||
call assert_fails('let bl = 0zC0FFEE', 'E741:')
|
||||
call assert_fails('let here = "xxx"', 'E741:')
|
||||
|
||||
" Unlet
|
||||
unlet i
|
||||
unlet f
|
||||
unlet s
|
||||
unlet F
|
||||
unlet l
|
||||
unlet d
|
||||
if has('channel')
|
||||
unlet j
|
||||
unlet c
|
||||
endif
|
||||
unlet b
|
||||
unlet n
|
||||
unlet bl
|
||||
unlet here
|
||||
endfunc
|
||||
|
||||
func Test_define_l_var_with_lock()
|
||||
" With l: prefix
|
||||
const l:i = 1
|
||||
const l:f = 1.1
|
||||
const l:s = 'vim'
|
||||
const l:F = funcref('s:noop')
|
||||
const l:l = [1, 2, 3]
|
||||
const l:d = {'foo': 10}
|
||||
if has('channel')
|
||||
const l:j = test_null_job()
|
||||
const l:c = test_null_channel()
|
||||
endif
|
||||
const l:b = v:true
|
||||
const l:n = v:null
|
||||
const l:bl = 0zC0FFEE
|
||||
const l:here =<< trim EOS
|
||||
hello
|
||||
EOS
|
||||
|
||||
call assert_fails('let l:i = 1', 'E741:')
|
||||
call assert_fails('let l:f = 1.1', 'E741:')
|
||||
call assert_fails('let l:s = "vim"', 'E741:')
|
||||
call assert_fails('let l:F = funcref("s:noop")', 'E741:')
|
||||
call assert_fails('let l:l = [1, 2, 3]', 'E741:')
|
||||
call assert_fails('let l:d = {"foo": 10}', 'E741:')
|
||||
if has('channel')
|
||||
call assert_fails('let l:j = test_null_job()', 'E741:')
|
||||
call assert_fails('let l:c = test_null_channel()', 'E741:')
|
||||
endif
|
||||
call assert_fails('let l:b = v:true', 'E741:')
|
||||
call assert_fails('let l:n = v:null', 'E741:')
|
||||
call assert_fails('let l:bl = 0zC0FFEE', 'E741:')
|
||||
call assert_fails('let l:here = "xxx"', 'E741:')
|
||||
|
||||
" Unlet
|
||||
unlet l:i
|
||||
unlet l:f
|
||||
unlet l:s
|
||||
unlet l:F
|
||||
unlet l:l
|
||||
unlet l:d
|
||||
if has('channel')
|
||||
unlet l:j
|
||||
unlet l:c
|
||||
endif
|
||||
unlet l:b
|
||||
unlet l:n
|
||||
unlet l:bl
|
||||
unlet l:here
|
||||
endfunc
|
||||
|
||||
func Test_define_script_var_with_lock()
|
||||
const s:x = 0
|
||||
call assert_fails('let s:x = 1', 'E741:')
|
||||
unlet s:x
|
||||
endfunc
|
||||
|
||||
func Test_descructuring_with_lock()
|
||||
const [a, b, c] = [1, 1.1, 'vim']
|
||||
|
||||
call assert_fails('let a = 1', 'E741:')
|
||||
call assert_fails('let b = 1.1', 'E741:')
|
||||
call assert_fails('let c = "vim"', 'E741:')
|
||||
|
||||
const [d; e] = [1, 1.1, 'vim']
|
||||
call assert_fails('let d = 1', 'E741:')
|
||||
call assert_fails('let e = [2.2, "a"]', 'E741:')
|
||||
endfunc
|
||||
|
||||
func Test_cannot_modify_existing_variable()
|
||||
let i = 1
|
||||
let f = 1.1
|
||||
let s = 'vim'
|
||||
let F = funcref('s:noop')
|
||||
let l = [1, 2, 3]
|
||||
let d = {'foo': 10}
|
||||
if has('channel')
|
||||
let j = test_null_job()
|
||||
let c = test_null_channel()
|
||||
endif
|
||||
let b = v:true
|
||||
let n = v:null
|
||||
let bl = 0zC0FFEE
|
||||
|
||||
call assert_fails('const i = 1', 'E995:')
|
||||
call assert_fails('const f = 1.1', 'E995:')
|
||||
call assert_fails('const s = "vim"', 'E995:')
|
||||
call assert_fails('const F = funcref("s:noop")', 'E995:')
|
||||
call assert_fails('const l = [1, 2, 3]', 'E995:')
|
||||
call assert_fails('const d = {"foo": 10}', 'E995:')
|
||||
if has('channel')
|
||||
call assert_fails('const j = test_null_job()', 'E995:')
|
||||
call assert_fails('const c = test_null_channel()', 'E995:')
|
||||
endif
|
||||
call assert_fails('const b = v:true', 'E995:')
|
||||
call assert_fails('const n = v:null', 'E995:')
|
||||
call assert_fails('const bl = 0zC0FFEE', 'E995:')
|
||||
call assert_fails('const [i, f, s] = [1, 1.1, "vim"]', 'E995:')
|
||||
|
||||
const i2 = 1
|
||||
const f2 = 1.1
|
||||
const s2 = 'vim'
|
||||
const F2 = funcref('s:noop')
|
||||
const l2 = [1, 2, 3]
|
||||
const d2 = {'foo': 10}
|
||||
if has('channel')
|
||||
const j2 = test_null_job()
|
||||
const c2 = test_null_channel()
|
||||
endif
|
||||
const b2 = v:true
|
||||
const n2 = v:null
|
||||
const bl2 = 0zC0FFEE
|
||||
|
||||
call assert_fails('const i2 = 1', 'E995:')
|
||||
call assert_fails('const f2 = 1.1', 'E995:')
|
||||
call assert_fails('const s2 = "vim"', 'E995:')
|
||||
call assert_fails('const F2 = funcref("s:noop")', 'E995:')
|
||||
call assert_fails('const l2 = [1, 2, 3]', 'E995:')
|
||||
call assert_fails('const d2 = {"foo": 10}', 'E995:')
|
||||
if has('channel')
|
||||
call assert_fails('const j2 = test_null_job()', 'E995:')
|
||||
call assert_fails('const c2 = test_null_channel()', 'E995:')
|
||||
endif
|
||||
call assert_fails('const b2 = v:true', 'E995:')
|
||||
call assert_fails('const n2 = v:null', 'E995:')
|
||||
call assert_fails('const bl2 = 0zC0FFEE', 'E995:')
|
||||
call assert_fails('const [i2, f2, s2] = [1, 1.1, "vim"]', 'E995:')
|
||||
endfunc
|
||||
|
||||
func Test_const_with_index_access()
|
||||
let l = [1, 2, 3]
|
||||
call assert_fails('const l[0] = 4', 'E996:')
|
||||
call assert_fails('const l[0:1] = [1, 2]', 'E996:')
|
||||
|
||||
let d = {'aaa': 0}
|
||||
call assert_fails("const d['aaa'] = 4", 'E996:')
|
||||
call assert_fails("const d.aaa = 4", 'E996:')
|
||||
endfunc
|
||||
|
||||
func Test_const_with_compound_assign()
|
||||
let i = 0
|
||||
call assert_fails('const i += 4', 'E995:')
|
||||
call assert_fails('const i -= 4', 'E995:')
|
||||
call assert_fails('const i *= 4', 'E995:')
|
||||
call assert_fails('const i /= 4', 'E995:')
|
||||
call assert_fails('const i %= 4', 'E995:')
|
||||
|
||||
let s = 'a'
|
||||
call assert_fails('const s .= "b"', 'E995:')
|
||||
|
||||
let [a, b, c] = [1, 2, 3]
|
||||
call assert_fails('const [a, b, c] += [4, 5, 6]', 'E995:')
|
||||
|
||||
let [d; e] = [1, 2, 3]
|
||||
call assert_fails('const [d; e] += [4, 5, 6]', 'E995:')
|
||||
endfunc
|
||||
|
||||
func Test_const_with_special_variables()
|
||||
call assert_fails('const $FOO = "hello"', 'E996:')
|
||||
call assert_fails('const @a = "hello"', 'E996:')
|
||||
call assert_fails('const &filetype = "vim"', 'E996:')
|
||||
call assert_fails('const &l:filetype = "vim"', 'E996:')
|
||||
call assert_fails('const &g:encoding = "utf-8"', 'E996:')
|
||||
endfunc
|
||||
|
||||
func Test_const_with_eval_name()
|
||||
let s = 'foo'
|
||||
|
||||
" eval name with :const should work
|
||||
const abc_{s} = 1
|
||||
const {s}{s} = 1
|
||||
|
||||
let s2 = 'abc_foo'
|
||||
call assert_fails('const {s2} = "bar"', 'E995:')
|
||||
endfunc
|
||||
|
||||
func Test_lock_depth_is_1()
|
||||
const l = [1, 2, 3]
|
||||
const d = {'foo': 10}
|
||||
|
||||
" Modify list
|
||||
call add(l, 4)
|
||||
let l[0] = 42
|
||||
|
||||
" Modify dict
|
||||
let d['bar'] = 'hello'
|
||||
let d.foo = 44
|
||||
endfunc
|
||||
@@ -1,8 +1,7 @@
|
||||
" Tests for encryption.
|
||||
|
||||
if !has('cryptv')
|
||||
finish
|
||||
endif
|
||||
source check.vim
|
||||
CheckFeature cryptv
|
||||
|
||||
func Common_head_only(text)
|
||||
" This was crashing Vim
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
" Test for cscope commands.
|
||||
|
||||
if !has('cscope') || !executable('cscope') || !has('quickfix')
|
||||
finish
|
||||
source check.vim
|
||||
CheckFeature cscope
|
||||
CheckFeature quickfix
|
||||
|
||||
if !executable('cscope')
|
||||
throw 'Skipped: cscope program missing'
|
||||
endif
|
||||
|
||||
func CscopeSetupOrClean(setup)
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
" Tests for digraphs
|
||||
|
||||
if !has("digraphs")
|
||||
finish
|
||||
endif
|
||||
source check.vim
|
||||
CheckFeature digraphs
|
||||
|
||||
func Put_Dig(chars)
|
||||
exe "norm! o\<c-k>".a:chars
|
||||
|
||||
@@ -171,6 +171,9 @@ func Test_vvar_scriptversion2()
|
||||
echo version
|
||||
call assert_fails('let version = 1', 'E46:')
|
||||
call assert_equal(v:version, version)
|
||||
|
||||
call assert_equal(v:version, v:versionlong / 10000)
|
||||
call assert_true(v:versionlong > 8011525)
|
||||
endfunc
|
||||
|
||||
func Test_scriptversion()
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
" test float functions
|
||||
|
||||
if !has('float')
|
||||
finish
|
||||
end
|
||||
source check.vim
|
||||
CheckFeature float
|
||||
|
||||
func Test_abs()
|
||||
call assert_equal('1.23', string(abs(1.23)))
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
source shared.vim
|
||||
if !CanRunGui()
|
||||
finish
|
||||
throw 'Skipped: cannot run GUI'
|
||||
endif
|
||||
|
||||
source setup_gui.vim
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
source shared.vim
|
||||
if !CanRunGui()
|
||||
finish
|
||||
throw 'Skipped: cannot run GUI'
|
||||
endif
|
||||
|
||||
source setup_gui.vim
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
" Tests for the history functions
|
||||
|
||||
if !has('cmdline_hist')
|
||||
finish
|
||||
endif
|
||||
source check.vim
|
||||
CheckFeature cmdline_hist
|
||||
|
||||
set history=7
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
" tests for 'langmap'
|
||||
|
||||
if !has('langmap')
|
||||
finish
|
||||
endif
|
||||
source check.vim
|
||||
CheckFeature langmap
|
||||
|
||||
func Test_langmap()
|
||||
new
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
set encoding=latin1
|
||||
scriptencoding latin1
|
||||
|
||||
if !exists("+linebreak") || !has("conceal")
|
||||
finish
|
||||
endif
|
||||
source check.vim
|
||||
CheckOption linebreak
|
||||
CheckFeature conceal
|
||||
|
||||
source view_util.vim
|
||||
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
set encoding=utf-8
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists("+linebreak") || !has("conceal") || !has("signs")
|
||||
finish
|
||||
endif
|
||||
source check.vim
|
||||
CheckOption linebreak
|
||||
CheckFeature conceal
|
||||
CheckFeature signs
|
||||
|
||||
source view_util.vim
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user