Compare commits

...

24 Commits

Author SHA1 Message Date
Bram Moolenaar
2e34c34be1 patch 8.2.2602: Vim9: continue doesn't work if :while is very first command
Problem:    Vim9: continue doesn't work if :while is very first command.
            (Yegappan Lakshmanan)
Solution:   Add one to the continue instruction index.
2021-03-14 12:13:33 +01:00
Bram Moolenaar
6bce5856b5 patch 8.2.2601: memory usage test often fails on FreeBSD
Problem:    Memory usage test often fails on FreeBSD.
Solution:   Increase multiplier for upper limit.
2021-03-13 22:11:51 +01:00
Bram Moolenaar
93e1cae739 patch 8.2.2600: Vim9: crash when putting an unknown type in a dictionary
Problem:    Vim9: crash when putting an unknown type in a dictionary.
            (Yegappan Lakshmanan)
Solution:   Handle a NULL type pointer.
2021-03-13 21:24:56 +01:00
Bram Moolenaar
edba70703b patch 8.2.2599: build failure
Problem:    Build failure.
Solution:   Add missing change.
2021-03-13 21:14:18 +01:00
Bram Moolenaar
6508880d6c patch 8.2.2598: Vim9: :open does not need to be supported
Problem:    Vim9: :open does not need to be supported.
Solution:   Do not support :open in Vim9 script.
2021-03-13 21:07:21 +01:00
Bram Moolenaar
cb4e80fab9 patch 8.2.2597: Vim9: "import * as" does not work at script level
Problem:    Vim9: "import * as" does not work at script level.
Solution:   Implement using an imported namespace.
2021-03-13 20:57:19 +01:00
Bram Moolenaar
41cd80335c patch 8.2.2596: :doautocmd may confuse scripts listening to WinEnter
Problem:    :doautocmd may confuse scripts listening to WinEnter.
Solution:   Do the current buffer last. (closes #7958)
2021-03-13 15:47:56 +01:00
Bram Moolenaar
9e813b3dea patch 8.2.2595: setting 'winminheight' may cause 'lines' to change
Problem:    Setting 'winminheight' may cause 'lines' to change.
Solution:   Also take minimal height of other tabpages into account. (#7899)
2021-03-13 14:29:05 +01:00
Bram Moolenaar
0756f757ed patch 8.2.2594: alternate buffer added to session file even when it's hidden
Problem:    Alternate buffer added to session file even when it's hidden.
Solution:   Check the 'buflisted' option. (closes #7951)
2021-03-13 13:52:33 +01:00
Bram Moolenaar
0de8e2d6a3 patch 8.2.2593: list of distributed files is incomplete
Problem:    List of distributed files is incomplete.
Solution:   Add a file and rename another.
2021-03-13 13:30:03 +01:00
Bram Moolenaar
c8cdf0f80b Update runtime files. 2021-03-13 13:28:13 +01:00
Bram Moolenaar
6fd367a97c patch 8.2.2592: code coverage could be improved
Problem:    Code coverage could be improved.
Solution:   Add a few more tests. (Dominique Pellé, closes #7957)
2021-03-13 13:14:04 +01:00
Bram Moolenaar
c80f647512 patch 8.2.2591: Poke files are not recognized
Problem:    Poke files are not recognized.
Solution:   Add a filetype entry. (Matt Ihlenfield)
2021-03-12 22:16:41 +01:00
Bram Moolenaar
12bce95887 patch 8.2.2590: Vim9: default argument value may cause internal error
Problem:    Vim9: default argument value may cause internal error.
Solution:   Hide later function arguments when compiling the expression.
            (closes #7948)
2021-03-11 20:04:04 +01:00
Bram Moolenaar
776b954622 patch 8.2.2589: recover test hangs in the GUI
Problem:    Recover test hangs in the GUI.
Solution:   Add g:skipped_reason to skip a _nocatch_ test.
2021-03-10 22:27:48 +01:00
Bram Moolenaar
23b32a8d6b patch 8.2.2588: build failure with tiny features
Problem:    Build failure with tiny features.
Solution:   Add #ifdef.  Run recover test separately.
2021-03-10 21:55:46 +01:00
Bram Moolenaar
6635ae1437 patch 8.2.2587: recover test fails on FreeBSD
Problem:    Recover test fails on FreeBSD.
Solution:   Check for Linux.
2021-03-10 21:46:39 +01:00
Bram Moolenaar
f52f0606ed patch 8.2.2586: process id may be invalid
Problem:    Process id may be invalid.
Solution:   Use sysinfo.uptime to check for recent reboot. (suggested by Hugo
            van der Sanden, closes #7947)
2021-03-10 21:26:37 +01:00
Bram Moolenaar
c23555de34 patch 8.2.2585: Vim9: illegal memory access
Problem:    Vim9: illegal memory access.
Solution:   Check byte right after "null", not one more.
2021-03-10 19:04:07 +01:00
Bram Moolenaar
d345fb9216 patch 8.2.2584: Vim9: type error for assigning "any" to a list
Problem:    Vim9: type error for assigning the result of list concatenation to
            a list.
Solution:   Do not consider concatenation result in a constant. (closes #7942)
2021-03-10 18:43:09 +01:00
Bram Moolenaar
7ad67d1150 patch 8.2.2583: Vim9: cannot compare result of getenv() with null
Problem:    Vim9: cannot compare result of getenv() with null.
Solution:   Make the return type of getenv() "any". (closes #7943)
2021-03-10 16:08:26 +01:00
Bram Moolenaar
ffb7dcdb77 patch 8.2.2582: Vim9: screendump test fails on MS-Windows
Problem:    Vim9: screendump test fails on MS-Windows.
Solution:   Use :function instead of :def.
2021-03-10 14:00:18 +01:00
Bram Moolenaar
37294bd6a2 patch 8.2.2581: Vim9: sourcing Vim9 script triggers a redraw
Problem:    Vim9: sourcing Vim9 script triggers a redraw.
Solution:   Do not let setting/restoring 'cpoptions' cause a redraw.
            (closes #7920)
2021-03-10 13:40:08 +01:00
Bram Moolenaar
e3ffcd9902 patch 8.2.2580: Vim9: checking vararg type may be wrong
Problem:    Vim9: checking vararg type is wrong when function is auto-loaded.
Solution:   Use the member type. (closes #7933)
2021-03-08 21:47:13 +01:00
62 changed files with 945 additions and 165 deletions

View File

@@ -13,7 +13,8 @@ SRC_ALL = \
.hgignore \
.lgtm.yml \
.travis.yml \
appveyor.yml \
.appveyor.yml \
.codecov.yml \
ci/appveyor.bat \
ci/build-snd-dummy.sh \
ci/config.mk*.sed \

View File

@@ -1,4 +1,4 @@
*change.txt* For Vim version 8.2. Last change: 2021 Jan 21
*change.txt* For Vim version 8.2. Last change: 2021 Mar 01
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -649,6 +649,8 @@ For other systems the tmpnam() library function is used.
The space between `:substitute` and the 'c', 'g',
'i', 'I' and 'r' flags isn't required, but in scripts
it's a good idea to keep it to avoid confusion.
Also see the two and three letter commands to repeat
:substitute below |:substitute-repeat|.
:[range]~[&][flags] [count] *:~*
Repeat last substitute with same substitute string
@@ -877,20 +879,26 @@ either the first or second pattern in parentheses did not match, so either
*:sge* *:sgi* *:sgI* *:sgl* *:sgn* *:sgp* *:sgr* *:sI* *:si*
*:sic* *:sIc* *:sie* *:sIe* *:sIg* *:sIl* *:sin* *:sIn* *:sIp*
*:sip* *:sIr* *:sir* *:sr* *:src* *:srg* *:sri* *:srI* *:srl*
*:srn* *:srp*
*:srn* *:srp* *:substitute-repeat*
2-letter and 3-letter :substitute commands ~
These commands repeat the previous `:substitute` command with the given flags.
The first letter is always "s", followed by one or two of the possible flag
characters. For example `:sce` works like `:s///ce`. The table lists the
possible combinations, not all flags are possible, because the command is
short for another command.
List of :substitute commands
| c e g i I n p l r
| c :sc :sce :scg :sci :scI :scn :scp :scl ---
| c :sc :sce :scg :sci :scI :scn :scp :scl
| e
| g :sgc :sge :sg :sgi :sgI :sgn :sgp :sgl :sgr
| i :sic :sie --- :si :siI :sin :sip --- :sir
| i :sic :sie :si :siI :sin :sip :sir
| I :sIc :sIe :sIg :sIi :sI :sIn :sIp :sIl :sIr
| n
| p
| l
| r :src --- :srg :sri :srI :srn :srp :srl :sr
| r :src :srg :sri :srI :srn :srp :srl :sr
Exceptions:
:scr is `:scriptnames`

View File

@@ -1,4 +1,4 @@
*eval.txt* For Vim version 8.2. Last change: 2021 Feb 10
*eval.txt* For Vim version 8.2. Last change: 2021 Mar 10
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -5300,6 +5300,9 @@ getcharpos({expr})
Get the position for {expr}. Same as |getpos()| but the column
number in the returned List is a character index instead of
a byte index.
If |getpos()| returns a very large column number, such as
2147483647, then getcharpos() will return the character index
of the last character.
Example:
With the cursor on '세' in line 5 with text "여보세요": >
@@ -5779,6 +5782,8 @@ getpos({expr}) Get the position for {expr}. For possible values of {expr}
The column number in the returned List is the byte position
within the line. To get the character position in the line,
use |getcharpos()|
The column number can be very large, e.g. 2147483647, in which
case it means "after the end of the line".
This can be used to save and restore the position of a mark: >
let save_a_mark = getpos("'a")
...
@@ -7450,7 +7455,8 @@ matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]])
to be used when fast match additions and deletions are
required, for example to highlight matching parentheses.
The list {pos} can contain one of these items:
{pos} is a list of positions. Each position can be one of
these:
- A number. This whole line will be highlighted. The first
line has number 1.
- A list with one number, e.g., [23]. The whole line with this
@@ -7463,7 +7469,7 @@ matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]])
- A list with three numbers, e.g., [23, 11, 3]. As above, but
the third number gives the length of the highlight in bytes.
The maximum number of positions is 8.
The maximum number of positions in {pos} is 8.
Example: >
:highlight MyGroup ctermbg=green guibg=green
@@ -7472,8 +7478,7 @@ matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]])
:call matchdelete(m)
< Matches added by |matchaddpos()| are returned by
|getmatches()| with an entry "pos1", "pos2", etc., with the
value a list like the {pos} item.
|getmatches()|.
Can also be used as a |method|: >
GetGroup()->matchaddpos([23, 11])
@@ -10273,7 +10278,8 @@ str2nr({expr} [, {base} [, {quoted}]]) *str2nr()*
strcharpart({src}, {start} [, {len}]) *strcharpart()*
Like |strpart()| but using character index and length instead
of byte index and length.
of byte index and length. Composing characters are counted
separately.
When a character index is used where a character does not
exist it is assumed to be one character. For example: >
strcharpart('abc', -1, 2)
@@ -13142,7 +13148,7 @@ text...
Cannot be followed by a comment.
Examples: >
:execute "buffer" nextbuf
:execute "normal" count . "w"
:execute "normal" count .. "w"
<
":execute" can be used to append a command to commands
that don't accept a '|'. Example: >
@@ -13158,8 +13164,8 @@ text...
file names. The |fnameescape()| function can be used
for Vim commands, |shellescape()| for |:!| commands.
Examples: >
:execute "e " . fnameescape(filename)
:execute "!ls " . shellescape(filename, 1)
:execute "e " .. fnameescape(filename)
:execute "!ls " .. shellescape(filename, 1)
<
Note: The executed string may be any command-line, but
starting or ending "if", "while" and "for" does not

View File

@@ -1,4 +1,4 @@
*filetype.txt* For Vim version 8.2. Last change: 2021 Jan 21
*filetype.txt* For Vim version 8.2. Last change: 2021 Mar 11
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -628,6 +628,13 @@ For fish, add to the config file
set -x MANPAGER "vim -M +MANPAGER -"
MARKDOWN *ft-markdown-plugin*
To enable folding use this: >
let g:markdown_folding = 1
<
PDF *ft-pdf-plugin*
Two maps, <C-]> and <C-T>, are provided to simulate a tag stack for navigating

View File

@@ -677,9 +677,9 @@ Your directory layout would be like this:
opt/fooextra/doc/tags " help tags
This allows for the user to do: >
mkdir ~/.vim/pack/myfoobar
cd ~/.vim/pack/myfoobar
git clone https://github.com/you/foobar.git
mkdir ~/.vim/pack
cd ~/.vim/pack
git clone https://github.com/you/foobar.git myfoobar
Here "myfoobar" is a name that the user can choose, the only condition is that
it differs from other packages.

View File

@@ -1,4 +1,4 @@
*sign.txt* For Vim version 8.2. Last change: 2020 Oct 28
*sign.txt* For Vim version 8.2. Last change: 2021 Mar 07
VIM REFERENCE MANUAL by Gordon Prieur
@@ -146,6 +146,9 @@ See |sign_define()| for the equivalent Vim script function.
texthl={group}
Highlighting group used for the text item.
Example: >
:sign define MySign text=>> texthl=Search linehl=DiffText
<
DELETING A SIGN *:sign-undefine* *E155*
@@ -155,7 +158,9 @@ See |sign_undefine()| for the equivalent Vim script function.
Deletes a previously defined sign. If signs with this {name}
are still placed this will cause trouble.
Example: >
:sign undefine MySign
<
LISTING SIGNS *:sign-list* *E156*
@@ -209,6 +214,10 @@ See |sign_place()| for the equivalent Vim script function.
Same, but use buffer {nr}. If the buffer argument is not
given, place the sign in the current buffer.
Example: >
:sign place 10 line=99 name=sign3
:sign place 10 line=99 name=sign3 buffer=3
<
*E885*
:sign place {id} name={name} file={fname}
Change the placed sign {id} in file {fname} to use the defined
@@ -221,10 +230,17 @@ See |sign_place()| for the equivalent Vim script function.
"priority={prio}" attribute can be used to change the priority
of an existing sign.
Example: >
:sign place 23 name=sign1 file=/path/to/edit.py
<
:sign place {id} name={name} [buffer={nr}]
Same, but use buffer {nr}. If the buffer argument is not
given, use the current buffer.
Example: >
:sign place 23 name=sign1
:sign place 23 name=sign1 buffer=7
<
REMOVING SIGNS *:sign-unplace* *E159*

View File

@@ -1,4 +1,4 @@
*syntax.txt* For Vim version 8.2. Last change: 2021 Jan 21
*syntax.txt* For Vim version 8.2. Last change: 2021 Mar 06
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1741,8 +1741,8 @@ The coloring scheme for tags in the HTML file works as follows.
The <> of opening tags are colored differently than the </> of a closing tag.
This is on purpose! For opening tags the 'Function' color is used, while for
closing tags the 'Type' color is used (See syntax.vim to check how those are
defined for you)
closing tags the 'Identifier' color is used (See syntax.vim to check how those
are defined for you)
Known tag names are colored the same way as statements in C. Unknown tag
names are colored with the same color as the <> or </> respectively which
@@ -4676,7 +4676,7 @@ matches, nextgroup, etc. But there are a few differences:
- A line continuation pattern can be given. It is used to decide which group
of lines need to be searched like they were one line. This means that the
search for a match with the specified items starts in the first of the
consecutive that contain the continuation pattern.
consecutive lines that contain the continuation pattern.
- When using "nextgroup" or "contains", this only works within one line (or
group of continued lines).
- When using a region, it must start and end in the same line (or group of

View File

@@ -3191,6 +3191,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
:stselect tagsrch.txt /*:stselect*
:su change.txt /*:su*
:substitute change.txt /*:substitute*
:substitute-repeat change.txt /*:substitute-repeat*
:sun windows.txt /*:sun*
:sunhide windows.txt /*:sunhide*
:sunm map.txt /*:sunm*
@@ -6578,6 +6579,7 @@ ft-mail.vim syntax.txt /*ft-mail.vim*
ft-make-syntax syntax.txt /*ft-make-syntax*
ft-man-plugin filetype.txt /*ft-man-plugin*
ft-maple-syntax syntax.txt /*ft-maple-syntax*
ft-markdown-plugin filetype.txt /*ft-markdown-plugin*
ft-masm-syntax syntax.txt /*ft-masm-syntax*
ft-mathematica-syntax syntax.txt /*ft-mathematica-syntax*
ft-matlab-indent indent.txt /*ft-matlab-indent*

View File

@@ -1,4 +1,4 @@
*testing.txt* For Vim version 8.2. Last change: 2020 Dec 12
*testing.txt* For Vim version 8.2. Last change: 2021 Mar 10
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -168,6 +168,7 @@ test_override({name}, {val}) *test_override()*
wait time of up to 3 seconds for messages
term_props reset all terminal properties when the version
string is detected
uptime overrules sysinfo.uptime
ALL clear all overrides ({val} is not used)
"starting" is to be used when a test should behave like

View File

@@ -1,4 +1,4 @@
*todo.txt* For Vim version 8.2. Last change: 2021 Feb 20
*todo.txt* For Vim version 8.2. Last change: 2021 Mar 11
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -39,13 +39,25 @@ browser use: https://github.com/vim/vim/issues/1234
-------------------- Known bugs and current work -----------------------
Vim9 - Make everything work:
- Implement "export {one, two three}".
- Does this work now: Implement using imported items at script level from
"import * as X" in
- import of item that isn't exported: error should mention missing "export"?
- no error for using :import in legacy script?
- Disallow :open ?
- Check: what if 'cpo' is intentionally changed in Vim9 script, does it get
restored at the end?
- ISN_CHECKTYPE could use check_argtype()
- Using a script variable inside a :def function doesn't work if the variable
is inside a block, see Test_nested_function(). Should it work?
- give error for variable name:
var p = function('NoSuchFunc')
- When indexing a string, should we include composing characters? #6563
string[0] - first character including its composing characters.
string[0 : 0] - same
If you don't want that use strcharpart().
Also, add optional arg to strcharpart() to include composing chars, to
make it consistent with strchars().
Add strcharlen(), like strchars() but like skipcc is always set
- Make closures work better:
- Create closure in a loop. Need to make a list of them.
- If a :def function is called with a function reference, compile it to get
@@ -74,13 +86,11 @@ Vim9 - Make everything work:
- make 0 == 'string' fail on the script level, like inside :def.
- Check that when using a user function name without prefix, it does not find
a global function. Prefixing g: is required.
- Need the equivalent of get_lval() and set_var_lval() to implement assignment
to nested list and dict members.
- Assignment to dict doesn't work:
var ret: dict<string> = #{}
ret[i] = string(i)
- Appending to dict item doesn't work:
var d[i] ..= value
- Appending to dict item doesn't work in a :def function:
var d: dict<string> = {a: 'x'}
d['a'] ..= 'y'
d.a ..= 'y'
Test to be extended: Test_assign_dict_with_op()
- Using ".." at script level doesn't convert arguments to a string.
- Compile replacement of :s command: s/pat/\=expr/
- Compile redir to local variable: var_redir_start().
@@ -89,8 +99,6 @@ Vim9 - Make everything work:
islocked()
- When evaluating constants for script variables, some functions could work:
has('asdf'), len('string')
- Implement "as Name" in "import Item as Name from ..."
- Implement using imported items at script level from "import * as X" in
eval_variable(). Should pass the ".xxx" that follows and return that.
- Make "++nr" work. "++g:count" doesn't work, thinks it is a range.
- Reload: How to make sure type of script function hasn't changed?
@@ -102,6 +110,11 @@ Vim9 - Make everything work:
- give an error for "echo Func()" if Func() does not return anything.
- Using "windo echo expr" does not accept a line break inside "expr" (in a
:def function and at script level in a not executed block). #7681
- "assert_fails()" cannot access local variables. Perhaps add this:
assertfails
... cmd ...
endassertfails /E99:.*cmd/
Similar to try/catch/endtry but without the boilerplate.
Once Vim9 is stable:
- Change the help to prefer Vim9 syntax where appropriate
@@ -184,6 +197,7 @@ Text properties:
- Popup attached to text property stays visible when text is deleted with
"cc". (#7737) "C" works OK. "dd" also files in a buffer with a single
line.
- Auto-indenting may cause highlighting to shift. (#7719)
- "cc" does not call inserted_bytes(). (Axel Forsman, #5763)
- Combining text property with 'cursorline' does not always work (Billie
Cleek, #5533)
@@ -263,7 +277,9 @@ Terminal emulator window:
- When 'encoding' is not utf-8, or the job is using another encoding, setup
conversions.
Valgrind reports memory leaks in test_options
Include patch #6290: recognize shell directory change.
Valgrind reports memory leaks in test_options.
test_arglist func Test_all_not_allowed_from_cmdwin() hangs on MS-Windows.
@@ -277,6 +293,8 @@ Was originally written by Felipe Morales.
Adding "10" to 'spellsuggest' causes spell suggestions to become very slow.
(#4087) Did patch 8.2.2379 help?
Also, z= in German on a long word can take a very long time, but CTRL-C to
interrupt does not work. Where to add ui_breakcheck()?
Remove SPACE_IN_FILENAME ? It is only used for completion.
@@ -288,6 +306,8 @@ with 'termguicolors'. #1740
Patch for blockwise paste reporting changes: #6660.
Patch to make fillchars global-local. (#5206)
Missing filetype test for bashrc, PKGBUILD, etc.
Add an option to not fetch terminal codes in xterm, to avoid flicker when t_Co
@@ -306,6 +326,10 @@ Try setting a color then request the current color, like using t_u7.
Regexp to search for duplicate lines does not work correctly:
/\(^.*\n\)\1 (Chris Morgan, #6239)
MS-Windows: when writing undo file the infostreams are copied in
mch_copy_file_attribute(), that seems unnecessary. (#7925)
Add a flag to only copy attributes?
Changing a capturing group to non-capturing changes the result: #7607
:echo matchstr('aaa bbb', '\(.\{-1,}\>\)\|.*')
aaa
@@ -382,6 +406,10 @@ manager. Problem with Motif?
Patch to add :argdedupe. (Nir Lichtman, #6235)
When editing a file with ":edit" the output of :swapname is relative, while
editing it with "vim file" it is absolute. (#355)
Which one should it be?
:map output does not clear the reset of the command line.
(#5623, also see #5962)
@@ -1156,9 +1184,6 @@ timer expires.
Rule to use "^" for statusline does not work if a space is defined with
highlighting for both stl and stlnc. Patch by Ken Hamada (itchyny, 2016 Dec 11)
8 "stl" and "stlnc" in 'fillchars' don't work for multibyte characters.
Patch by Christian Wellenbrock, 2013 Jul 5.
Using CTRL-G_U in InsertCharPre causes trouble for redo. (Israel Chauca
Fuentes, 2017 Feb 12, #1470)

View File

@@ -1,4 +1,4 @@
*various.txt* For Vim version 8.2. Last change: 2021 Jan 26
*various.txt* For Vim version 8.2. Last change: 2021 Mar 02
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -572,7 +572,7 @@ N *+X11* Unix only: can restore window title |X11|
it in / any non-ID character (see |'isident'|) can be
used, so long as it does not appear in {pat}. Without
the enclosing character the pattern cannot include the
bar character.
bar character. 'ignorecase' is not used.
The pattern is matched against the relevant part of
the output, not necessarily the whole line. Only some

View File

@@ -1,4 +1,4 @@
*vim9.txt* For Vim version 8.2. Last change: 2021 Feb 23
*vim9.txt* For Vim version 8.2. Last change: 2021 Mar 03
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -800,6 +800,8 @@ Patterns are used like 'magic' is set, unless explicitly overruled.
The 'edcompatible' option value is not used.
The 'gdefault' option value is not used.
You may also find this wiki useful. It was written by an early adoptor of
Vim9 script: https://github.com/lacygoill/wiki/blob/master/vim/vim9.md
==============================================================================
@@ -1111,7 +1113,7 @@ Exporting an item can be written as: >
export class MyClass ...
As this suggests, only constants, variables, `:def` functions and classes can
be exported. {classes are not implemented yet}
be exported. {not implemented yet: export class}
*E1042*
`:export` can only be used in Vim9 script, at the script level.

View File

@@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2021 Jan 21
" Last Change: 2021 Mar 12
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")
@@ -1334,6 +1334,9 @@ au BufNewFile,BufRead *.pml setf promela
au BufNewFile,BufRead *.proto setf proto
au BufNewFile,BufRead *.pbtxt setf pbtxt
" Poke
au BufNewFile,BufRead *.pk setf poke
" Protocols
au BufNewFile,BufRead */etc/protocols setf protocols

32
runtime/ftplugin/poke.vim Normal file
View File

@@ -0,0 +1,32 @@
" Vim filetype plugin file
" Language: GNU Poke
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2021 March 11
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo&vim
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
setlocal commentstring=//\ %s
setlocal formatoptions-=t formatoptions+=croql
setlocal include=load
setlocal suffixesadd=.pk
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:browsefilter = "Poke Files (*.pk)\t*.pk\n" .
\ "All Files (*.*)\t*.*\n"
endif
let b:undo_ftplugin = "setl fo< com< cms< inc< sua<" .
\ " | unlet! b:browsefilter"
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: nowrap sw=2 sts=2 ts=8

View File

@@ -3,8 +3,9 @@
" Previous Maintainer: Jorge Maldonado Ventura <jorgesumle@freakspot.net>
" Previous Maintainer: Claudio Fleiner <claudio@fleiner.com>
" Repository: https://notabug.org/jorgesumle/vim-html-syntax
" Last Change: 2021 Feb 25
" Last Change: 2021 Mar 02
" Included patch #7900 to fix comments
" Included patch #7916 to fix a few more things
"
" Please check :help html.vim for some comments and a description of the options
@@ -79,26 +80,16 @@ syn keyword htmlArg contained usemap ismap valign value vlink vspace width wrap
syn match htmlArg contained "\<\(http-equiv\|href\|title\)="me=e-1
" aria attributes
syn match htmlArg contained "\<\(aria-activedescendant\|aria-atomic\)\>"
syn match htmlArg contained "\<\(aria-autocomplete\|aria-busy\|aria-checked\)\>"
syn match htmlArg contained "\<\(aria-colcount\|aria-colindex\|aria-colspan\)\>"
syn match htmlArg contained "\<\(aria-controls\|aria-current\)\>"
syn match htmlArg contained "\<\(aria-describedby\|aria-details\)\>"
syn match htmlArg contained "\<\(aria-disabled\|aria-dropeffect\)\>"
syn match htmlArg contained "\<\(aria-errormessage\|aria-expanded\)\>"
syn match htmlArg contained "\<\(aria-flowto\|aria-grabbed\|aria-haspopup\)\>"
syn match htmlArg contained "\<\(aria-hidden\|aria-invalid\)\>"
syn match htmlArg contained "\<\(aria-keyshortcuts\|aria-label\)\>"
syn match htmlArg contained "\<\(aria-labelledby\|aria-level\|aria-live\)\>"
syn match htmlArg contained "\<\(aria-modal\|aria-multiline\)\>"
syn match htmlArg contained "\<\(aria-multiselectable\|aria-orientation\)\>"
syn match htmlArg contained "\<\(aria-owns\|aria-placeholder\|aria-posinset\)\>"
syn match htmlArg contained "\<\(aria-pressed\|aria-readonly\|aria-relevant\)\>"
syn match htmlArg contained "\<\(aria-required\|aria-roledescription\)\>"
syn match htmlArg contained "\<\(aria-rowcount\|aria-rowindex\|aria-rowspan\)\>"
syn match htmlArg contained "\<\(aria-selected\|aria-setsize\|aria-sort\)\>"
syn match htmlArg contained "\<\(aria-valuemax\|aria-valuemin\)\>"
syn match htmlArg contained "\<\(aria-valuenow\|aria-valuetext\)\>"
exe 'syn match htmlArg contained "\<aria-\%(' . join([
\ 'activedescendant', 'atomic', 'autocomplete', 'busy', 'checked', 'colcount',
\ 'colindex', 'colspan', 'controls', 'current', 'describedby', 'details',
\ 'disabled', 'dropeffect', 'errormessage', 'expanded', 'flowto', 'grabbed',
\ 'haspopup', 'hidden', 'invalid', 'keyshortcuts', 'label', 'labelledby', 'level',
\ 'live', 'modal', 'multiline', 'multiselectable', 'orientation', 'owns',
\ 'placeholder', 'posinset', 'pressed', 'readonly', 'relevant', 'required',
\ 'roledescription', 'rowcount', 'rowindex', 'rowspan', 'selected', 'setsize',
\ 'sort', 'valuemax', 'valuemin', 'valuenow', 'valuetext'
\ ], '\|') . '\)\>"'
syn keyword htmlArg contained role
" Netscape extensions
@@ -139,25 +130,19 @@ syn match htmlSpecialChar "&#\=[0-9A-Za-z]\{1,8};"
" Comments (the real ones or the old netscape ones)
if exists("html_wrong_comments")
syn region htmlComment start=+<!--+ end=+--\s*>+ contains=@Spell
syn region htmlComment start=+<!--+ end=+--\s*>+ contains=@Spell
else
" The HTML 5.2 syntax 8.2.4.41-42: bogus comment is parser error; browser skips until next &gt;
" Note: must stand first to get lesser :syn-priority
syn region htmlComment start=+<!+ end=+>+ contains=htmlCommentError
" Normal comment opening <!-- ...>
syn region htmlComment start=+<!--+ end=+>+ contains=htmlCommentPart,@Spell
" Idem 8.2.4.43-44: <!--> and <!---> are parser errors; browser treats as comments
syn match htmlComment "<!---\?>" contains=htmlCommentError
" Idem 8.2.4.51: any number of consecutive dashes within comment is okay; --> closes comment
" Idem 8.2.4.52: closing comment by dash-dash-bang (--!>) is error ignored by parser(!); closes comment
syn region htmlCommentPart contained start=+--+ end=+--!\?>+me=e-1 contains=htmlCommentNested,@htmlPreProc,@Spell
" Idem 8.2.4.49: opening nested comment <!-- is parser error, ignored by browser, except <!--> is all right
syn match htmlCommentNested contained "<!--[^>]"me=e-1
syn match htmlCommentNested contained "<!--->"me=e-3
syn match htmlCommentNested contained "<!---\?!>"me=e-4
syn match htmlCommentError contained "[^><!]"
" The HTML 5.2 syntax 8.2.4.41: bogus comment is parser error; browser skips until next &gt
syn region htmlComment start=+<!+ end=+>+ contains=htmlCommentError keepend
" Idem 8.2.4.42,51: Comment starts with <!-- and ends with -->
" Idem 8.2.4.43,44: Except <!--> and <!---> are parser errors
" Idem 8.2.4.52: dash-dash-bang (--!>) is error ignored by parser, also closes comment
syn region htmlComment matchgroup=htmlComment start=+<!--\%(-\?>\)\@!+ end=+--!\?>+ contains=htmlCommentNested,@htmlPreProc,@Spell keepend
" Idem 8.2.4.49: nested comment is parser error, except <!--> is all right
syn match htmlCommentNested contained "<!-->\@!"
syn match htmlCommentError contained "[^><!]"
endif
syn region htmlComment start=+<!DOCTYPE+ keepend end=+>+
syn region htmlComment start=+<!DOCTYPE+ end=+>+ keepend
" server-parsed commands
syn region htmlPreProc start=+<!--#+ end=+-->+ contains=htmlPreStmt,htmlPreError,htmlPreAttr
@@ -278,7 +263,7 @@ hi def link htmlEndTag Identifier
hi def link htmlArg Type
hi def link htmlTagName htmlStatement
hi def link htmlSpecialTagName Exception
hi def link htmlValue String
hi def link htmlValue String
hi def link htmlSpecialChar Special
if !exists("html_no_rendering")
@@ -322,14 +307,10 @@ hi def link htmlPreProc PreProc
hi def link htmlPreAttr String
hi def link htmlPreProcAttrName PreProc
hi def link htmlPreProcAttrError Error
hi def link htmlSpecial Special
hi def link htmlSpecialChar Special
hi def link htmlString String
hi def link htmlStatement Statement
hi def link htmlComment Comment
hi def link htmlCommentPart Comment
hi def link htmlValue String
hi def link htmlCommentNested htmlCommentError
hi def link htmlCommentNested htmlError
hi def link htmlCommentError htmlError
hi def link htmlTagError htmlError
hi def link htmlEvent javaScript

151
runtime/syntax/poke.vim Normal file
View File

@@ -0,0 +1,151 @@
" Copyright (C) 2021 Matthew T. Ihlenfield.
"
" This program is free software: you can redistribute it and/or modify
" it under the terms of the GNU General Public License as published by
" the Free Software Foundation, either version 3 of the License, or
" (at your option) any later version.
"
" This program is distributed in the hope that it will be useful,
" but WITHOUT ANY WARRANTY; without even the implied warranty of
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" GNU General Public License for more details.
"
" You should have received a copy of the GNU General Public License
" along with this program. If not, see <http://www.gnu.org/licenses/>.
"
" Vim syntax file
" Language: Poke
" Maintainer: Matt Ihlenfield <mtihlenfield@protonmail.com>
" Filenames: *.pk
" Latest Revision: 10 March 2021
if exists('b:current_syntax')
finish
endif
" Poke statement
syn keyword pokeStatement assert break continue return
syn keyword pokeStatement type unit fun method nextgroup=pokeFunction skipwhite
syn keyword pokeStatement var nextgroup=pokeVar skipWhite
" Identifiers
syn match pokeVar '\h\w*' display contained
" User defined functions
syn match pokeFunction '\h\w*' display contained
" Poke operators
syn keyword pokeOperator in sizeof as isa unmap
" Conditionals
syn keyword pokeConditional if else where
" Structures, unions, etc...
syn keyword pokeStructure struct union pinned
" Loops
syn keyword pokeRepeat while for
" Imports
syn keyword pokeLoad load
" Exceptions
syn keyword pokeException try catch until raise
" Exception types
syn keyword pokeExceptionType Exception E_generic E_out_of_bounds
syn keyword pokeExceptionType E_eof E_elem E_constraint
syn keyword pokeExceptionType E_conv E_map_bounds E_map
syn keyword pokeExceptionType E_div_by_zero E_no_ios E_no_return
syn keyword pokeExceptionType E_io E_io_flags E_assert E_overflow
" Exception codes
syn keyword pokeExceptionCode EC_generic EC_out_of_bounds
syn keyword pokeExceptionCode EC_eof EC_elem EC_constraint
syn keyword pokeExceptionCode EC_conv EC_map_bounds EC_map
syn keyword pokeExceptionCode EC_div_by_zero EC_no_ios EC_no_return
syn keyword pokeExceptionCode EC_io EC_io_flags EC_assert EC_overflow
" Poke builtin types
syn keyword pokeBuiltinType string void int uint bit nibble
syn keyword pokeBuiltinType byte char ushort short ulong long
syn keyword pokeBuiltinType uint8 uint16 uint32 uint64
syn keyword pokeBuiltinType off64 uoff64 offset
syn keyword pokeBuiltinType Comparator POSIX_Time32 POSIX_Time64
syn keyword pokeBuiltinType big little any
" Poke constants
syn keyword pokeConstant ENDIAN_LITTLE ENDIAN_BIG
syn keyword pokeConstant IOS_F_READ IOS_F_WRITE IOS_F_TRUNCATE IOS_F_CREATE
syn keyword pokeConstant IOS_M_RDONLY IOS_M_WRONLY IOS_M_RDWR
syn keyword pokeConstant load_path NULL OFFSET
" Poke std lib
syn keyword pokeBuiltinFunction print printf catos stoca atoi ltos reverse
syn keyword pokeBuiltinFunction ltrim rtrim strchr qsort crc32 alignto
syn keyword pokeBuiltinFunction open close flush get_ios set_ios iosize
syn keyword pokeBuiltinFunction rand get_endian set_endian strace exit
syn keyword pokeBuiltinFunction getenv
" Formats
" Special chars
syn match pokeSpecial "\\\([nt\\]\|\o\{1,3}\)" display contained
" Chars
syn match pokeChar "'[^']*'" contains=pokeSpecial
" Attributes
syn match pokeAttribute "\h\w*'\h\w"
" Strings
syn region pokeString skip=+\\\\\|\\"+ start=+"+ end=+"+ contains=pokeSpecial
" Integer literals
syn match pokeInteger "\<\d\+_*\d*\([LlHhBbNn]\=[Uu]\=\|[Uu]\=[LlHhBbNn]\=\)\>"
syn match pokeInteger "\<0[Xx]\x\+_*\x*\([LlHhBbNn]\=[Uu]\=\|[Uu]\=[LlHhBbNn]\=\)\>"
syn match pokeInteger "\<0[Oo]\o\+_*\o*\([LlHhBbNn]\=[Uu]\=\|[Uu]\=[LlHhBbNn]\=\)\>"
syn match pokeInteger "\<0[Bb][01]\+_*[01]*\([LlHhBbNn]\=[Uu]\=\|[Uu]\=[LlHhBbNn]\=\)\>"
" Units
syn keyword pokeBuiltinUnit b M B
syn keyword pokeBuiltinUnit Kb KB Mb MB Gb GB
syn keyword pokeBuiltinUnit Kib KiB Mib MiB Gib GiB
" Offsets
syn match pokeOffset "#\h\w*" contains=pokeBuiltinUnit
" Comments
syn keyword pokeCommentTodo TODO FIXME XXX TBD contained
syn match pokeLineComment "\/\/.*" contains=pokeCommentTodo,@Spell extend
syn region pokeComment start="/\*" end="\*/" contains=pokeCommentTodo,@Spell fold extend
" Allow folding of blocks
syn region pokeBlock start="{" end="}" transparent fold
" Highlight groups
hi def link pokeBuiltinFunction Function
hi def link pokeBuiltinType Type
hi def link pokeBuiltinUnit Keyword
hi def link pokeChar Character
hi def link pokeComment Comment
hi def link pokeCommentTodo Todo
hi def link pokeConditional Conditional
hi def link pokeConstant Constant
hi def link pokeException Exception
hi def link pokeExceptionCode Constant
hi def link pokeExceptionType Type
hi def link pokeFunction Function
hi def link pokeInteger Number
hi def link pokeLineComment Comment
hi def link pokeLoad Include
hi def link pokeOffset StorageClass
hi def link pokeOperator Operator
hi def link pokeSpecial SpecialChar
hi def link pokeStatement Statement
hi def link pokeString String
hi def link pokeStructure Structure
hi def link pokeRepeat Repeat
hi def link pokeVar Identifier
let b:current_syntax = 'poke'

View File

@@ -60,8 +60,8 @@ To built Vim on Ubuntu from scratch on a clean system using git:
% sudo apt install libxt-dev
% make reconfig
Add GUI support (ignore compiler warnings):
% sudo apt install libgtk2.0-dev
Add GUI support:
% sudo apt install libgtk-3-dev
% make reconfig
Add Python 3 support:
@@ -134,8 +134,12 @@ These configure arguments can be used to select which GUI to use:
--disable-motif-check
--disable-athena-check
This configure argument can be used to disable the GUI, even when the necessary
files are found:
--disable-gui
--enable-gui defaults to "auto", so it will automatically look for a GUI (in
the order of GTK, Motif, then Athena). If one is found, then is uses it and
the order of GTK, Motif, then Athena). If one is found, then it is used and
does not proceed to check any of the remaining ones. Otherwise, it moves on
to the next one.

29
src/auto/configure vendored
View File

@@ -13918,6 +13918,35 @@ $as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysinfo.uptime" >&5
$as_echo_n "checking for sysinfo.uptime... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
#include <sys/sysinfo.h>
int
main ()
{
struct sysinfo sinfo;
long ut;
(void)sysinfo(&sinfo);
ut = sinfo.uptime;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }; $as_echo "#define HAVE_SYSINFO_UPTIME 1" >>confdefs.h
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysconf" >&5
$as_echo_n "checking for sysconf... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext

View File

@@ -1336,7 +1336,7 @@ do_doautocmd(
void
ex_doautoall(exarg_T *eap)
{
int retval;
int retval = OK;
aco_save_T aco;
buf_T *buf;
bufref_T bufref;
@@ -1353,7 +1353,8 @@ ex_doautoall(exarg_T *eap)
*/
FOR_ALL_BUFFERS(buf)
{
if (buf->b_ml.ml_mfp != NULL)
// Only do loaded buffers and skip the current buffer, it's done last.
if (buf->b_ml.ml_mfp != NULL && buf != curbuf)
{
// find a window for this buffer and save some values
aucmd_prepbuf(&aco, buf);
@@ -1363,22 +1364,31 @@ ex_doautoall(exarg_T *eap)
retval = do_doautocmd(arg, FALSE, &did_aucmd);
if (call_do_modelines && did_aucmd)
{
// Execute the modeline settings, but don't set window-local
// options if we are using the current window for another
// buffer.
do_modelines(curwin == aucmd_win ? OPT_NOWIN : 0);
}
// restore the current window
aucmd_restbuf(&aco);
// stop if there is some error or buffer was deleted
if (retval == FAIL || !bufref_valid(&bufref))
{
retval = FAIL;
break;
}
}
}
// Execute autocommands for the current buffer last.
if (retval == OK)
{
do_doautocmd(arg, FALSE, &did_aucmd);
if (call_do_modelines && did_aucmd)
do_modelines(0);
}
check_cursor(); // just in case lines got deleted
}
@@ -2166,12 +2176,14 @@ apply_autocmds_group(
while (au_pending_free_buf != NULL)
{
buf_T *b = au_pending_free_buf->b_next;
vim_free(au_pending_free_buf);
au_pending_free_buf = b;
}
while (au_pending_free_win != NULL)
{
win_T *w = au_pending_free_win->w_next;
vim_free(au_pending_free_win);
au_pending_free_win = w;
}

View File

@@ -213,6 +213,7 @@
#undef HAVE_SYSCTL
#undef HAVE_SYSINFO
#undef HAVE_SYSINFO_MEM_UNIT
#undef HAVE_SYSINFO_UPTIME
#undef HAVE_TGETENT
#undef HAVE_TOWLOWER
#undef HAVE_TOWUPPER

View File

@@ -4095,6 +4095,20 @@ AC_TRY_COMPILE(
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_MEM_UNIT),
AC_MSG_RESULT(no))
dnl struct sysinfo may have the uptime field or not
AC_MSG_CHECKING(for sysinfo.uptime)
AC_TRY_COMPILE(
[#include <sys/types.h>
#include <sys/sysinfo.h>],
[ struct sysinfo sinfo;
long ut;
(void)sysinfo(&sinfo);
ut = sinfo.uptime;
],
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYSINFO_UPTIME),
AC_MSG_RESULT(no))
dnl sysconf() may exist but not support what we want to use
AC_MSG_CHECKING(for sysconf)
AC_TRY_COMPILE(

View File

@@ -373,3 +373,5 @@ EXTERN char e_argument_name_shadows_existing_variable_str[]
INIT(= N_("E1167: Argument name shadows existing variable: %s"));
EXTERN char e_argument_already_declared_in_script_str[]
INIT(= N_("E1168: Argument already declared in the script: %s"));
EXTERN char e_import_as_name_not_supported_here[]
INIT(= N_("E1169: 'import * as {name}' not supported here"));

View File

@@ -1370,7 +1370,7 @@ set_var_lval(
// handle +=, -=, *=, /=, %= and .=
di = NULL;
if (eval_variable(lp->ll_name, (int)STRLEN(lp->ll_name),
&tv, &di, TRUE, FALSE) == OK)
&tv, &di, EVAL_VAR_VERBOSE) == OK)
{
if ((di == NULL
|| (!var_check_ro(di->di_flags, lp->ll_name, FALSE)
@@ -3500,7 +3500,8 @@ eval7(
ret = OK;
}
else
ret = eval_variable(s, len, rettv, NULL, TRUE, FALSE);
ret = eval_variable(s, len, rettv, NULL,
EVAL_VAR_VERBOSE + EVAL_VAR_IMPORT);
}
else
{
@@ -5760,6 +5761,63 @@ handle_subscript(
check_white = FALSE;
}
if (rettv->v_type == VAR_ANY)
{
char_u *exp_name;
int cc;
int idx;
ufunc_T *ufunc;
type_T *type;
// Found script from "import * as {name}", script item name must
// follow.
if (**arg != '.')
{
if (verbose)
semsg(_(e_expected_str_but_got_str), "'.'", *arg);
ret = FAIL;
break;
}
++*arg;
if (IS_WHITE_OR_NUL(**arg))
{
if (verbose)
emsg(_(e_no_white_space_allowed_after_dot));
ret = FAIL;
break;
}
// isolate the name
exp_name = *arg;
while (eval_isnamec(**arg))
++*arg;
cc = **arg;
**arg = NUL;
idx = find_exported(rettv->vval.v_number, exp_name, &ufunc, &type,
evalarg->eval_cctx, verbose);
**arg = cc;
*arg = skipwhite(*arg);
if (idx < 0 && ufunc == NULL)
{
ret = FAIL;
break;
}
if (idx >= 0)
{
scriptitem_T *si = SCRIPT_ITEM(rettv->vval.v_number);
svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data) + idx;
copy_tv(sv->sv_tv, rettv);
}
else
{
rettv->v_type = VAR_FUNC;
rettv->vval.v_string = vim_strsave(ufunc->uf_name);
}
}
if ((**arg == '(' && (!evaluate || rettv->v_type == VAR_FUNC
|| rettv->v_type == VAR_PARTIAL))
&& (!check_white || !VIM_ISWHITE(*(*arg - 1))))

View File

@@ -1021,7 +1021,7 @@ static funcentry_T global_functions[] =
{"getcwd", 0, 2, FEARG_1, NULL,
ret_string, f_getcwd},
{"getenv", 1, 1, FEARG_1, NULL,
ret_string, f_getenv},
ret_any, f_getenv},
{"getfontname", 0, 1, 0, NULL,
ret_string, f_getfontname},
{"getfperm", 1, 1, FEARG_1, NULL,

View File

@@ -1219,7 +1219,8 @@ list_arg_vars(exarg_T *eap, char_u *arg, int *first)
arg = skipwhite(arg);
if (tofree != NULL)
name = tofree;
if (eval_variable(name, len, &tv, NULL, TRUE, FALSE) == FAIL)
if (eval_variable(name, len, &tv, NULL,
EVAL_VAR_VERBOSE) == FAIL)
error = TRUE;
else
{
@@ -2539,6 +2540,8 @@ set_cmdarg(exarg_T *eap, char_u *oldarg)
/*
* Get the value of internal variable "name".
* If "flags" has EVAL_VAR_IMPORT may return a VAR_ANY with v_number set to the
* imported script ID.
* Return OK or FAIL. If OK is returned "rettv" must be cleared.
*/
int
@@ -2547,12 +2550,11 @@ eval_variable(
int len, // length of "name"
typval_T *rettv, // NULL when only checking existence
dictitem_T **dip, // non-NULL when typval's dict item is needed
int verbose, // may give error message
int no_autoload) // do not use script autoloading
int flags) // EVAL_VAR_ flags
{
int ret = OK;
typval_T *tv = NULL;
int foundFunc = FALSE;
int found = FALSE;
dictitem_T *v;
int cc;
@@ -2561,7 +2563,7 @@ eval_variable(
name[len] = NUL;
// Check for user-defined variables.
v = find_var(name, NULL, no_autoload);
v = find_var(name, NULL, flags & EVAL_VAR_NOAUTOLOAD);
if (v != NULL)
{
tv = &v->di_tv;
@@ -2581,7 +2583,7 @@ eval_variable(
{
if (import->imp_funcname != NULL)
{
foundFunc = TRUE;
found = TRUE;
if (rettv != NULL)
{
rettv->v_type = VAR_FUNC;
@@ -2590,8 +2592,21 @@ eval_variable(
}
else if (import->imp_flags & IMP_FLAGS_STAR)
{
emsg("Sorry, 'import * as X' not implemented yet");
ret = FAIL;
if ((flags & EVAL_VAR_IMPORT) == 0)
{
if (flags & EVAL_VAR_VERBOSE)
emsg(_(e_import_as_name_not_supported_here));
ret = FAIL;
}
else
{
if (rettv != NULL)
{
rettv->v_type = VAR_ANY;
rettv->vval.v_number = import->imp_sid;
}
found = TRUE;
}
}
else
{
@@ -2607,7 +2622,7 @@ eval_variable(
if (ufunc != NULL)
{
foundFunc = TRUE;
found = TRUE;
if (rettv != NULL)
{
rettv->v_type = VAR_FUNC;
@@ -2617,11 +2632,11 @@ eval_variable(
}
}
if (!foundFunc)
if (!found)
{
if (tv == NULL)
{
if (rettv != NULL && verbose)
if (rettv != NULL && (flags & EVAL_VAR_VERBOSE))
semsg(_(e_undefined_variable_str), name);
ret = FAIL;
}
@@ -3695,7 +3710,8 @@ var_exists(char_u *var)
{
if (tofree != NULL)
name = tofree;
n = (eval_variable(name, len, &tv, NULL, FALSE, TRUE) == OK);
n = (eval_variable(name, len, &tv, NULL,
EVAL_VAR_NOAUTOLOAD + EVAL_VAR_IMPORT) == OK);
if (n)
{
// handle d.key, l[idx], f(expr)

View File

@@ -6609,6 +6609,10 @@ ex_open(exarg_T *eap)
regmatch_T regmatch;
char_u *p;
#ifdef FEAT_EVAL
if (not_in_vim9(eap) == FAIL)
return;
#endif
curwin->w_cursor.lnum = eap->line2;
beginline(BL_SOL | BL_FIX);
if (*eap->arg == '/')

View File

@@ -1860,6 +1860,7 @@ EXTERN int nfa_fail_for_testing INIT(= FALSE);
EXTERN int no_query_mouse_for_testing INIT(= FALSE);
EXTERN int ui_delay_for_testing INIT(= 0);
EXTERN int reset_term_props_on_termresponse INIT(= FALSE);
EXTERN long override_sysinfo_uptime INIT(= -1);
EXTERN int in_free_unref_items INIT(= FALSE);
#endif

View File

@@ -1080,6 +1080,35 @@ add_b0_fenc(
}
}
#if defined(HAVE_SYS_SYSINFO_H) && defined(HAVE_SYSINFO_UPTIME)
# include <sys/sysinfo.h>
#endif
/*
* Return TRUE if the process with number "b0p->b0_pid" is still running.
* "swap_fname" is the name of the swap file, if it's from before a reboot then
* the result is FALSE;
*/
static int
swapfile_process_running(ZERO_BL *b0p, char_u *swap_fname UNUSED)
{
#ifdef HAVE_SYSINFO_UPTIME
stat_T st;
struct sysinfo sinfo;
// If the system rebooted after when the swap file was written then the
// process can't be running now.
if (mch_stat((char *)swap_fname, &st) != -1
&& sysinfo(&sinfo) == 0
&& st.st_mtime < time(NULL) - (
# ifdef FEAT_EVAL
override_sysinfo_uptime >= 0 ? override_sysinfo_uptime :
# endif
sinfo.uptime))
return FALSE;
#endif
return mch_process_running(char_to_long(b0p->b0_pid));
}
/*
* Try to recover curbuf from the .swp file.
@@ -1692,7 +1721,7 @@ ml_recover(int checkext)
msg(_("Recovery completed. Buffer contents equals file contents."));
msg_puts(_("\nYou may want to delete the .swp file now."));
#if defined(UNIX) || defined(MSWIN)
if (mch_process_running(char_to_long(b0p->b0_pid)))
if (swapfile_process_running(b0p, fname_used))
{
// Warn there could be an active Vim on the same file, the user may
// want to kill it.
@@ -2170,7 +2199,7 @@ swapfile_info(char_u *fname)
msg_puts(_("\n process ID: "));
msg_outnum(char_to_long(b0.b0_pid));
#if defined(UNIX) || defined(MSWIN)
if (mch_process_running(char_to_long(b0.b0_pid)))
if (swapfile_process_running(&b0, fname))
{
msg_puts(_(" (STILL RUNNING)"));
# ifdef HAVE_PROCESS_STILL_RUNNING
@@ -2213,9 +2242,6 @@ swapfile_unchanged(char_u *fname)
int fd;
struct block0 b0;
int ret = TRUE;
#if defined(UNIX) || defined(MSWIN)
long pid;
#endif
// must be able to stat the swap file
if (mch_stat((char *)fname, &st) == -1)
@@ -2258,8 +2284,7 @@ swapfile_unchanged(char_u *fname)
}
// process must be known and not be running
pid = char_to_long(b0.b0_pid);
if (pid == 0L || mch_process_running(pid))
if (char_to_long(b0.b0_pid) == 0L || swapfile_process_running(&b0, fname))
ret = FALSE;
#endif

View File

@@ -3176,7 +3176,9 @@ set_bool_option(
if (curwin->w_curswant != MAXCOL
&& (options[opt_idx].flags & (P_CURSWANT | P_RALL)) != 0)
curwin->w_set_curswant = TRUE;
check_redraw(options[opt_idx].flags);
if ((opt_flags & OPT_NO_REDRAW) == 0)
check_redraw(options[opt_idx].flags);
return NULL;
}
@@ -3192,8 +3194,8 @@ set_num_option(
long value, // new value
char *errbuf, // buffer for error messages
size_t errbuflen, // length of "errbuf"
int opt_flags) // OPT_LOCAL, OPT_GLOBAL and
// OPT_MODELINE
int opt_flags) // OPT_LOCAL, OPT_GLOBAL,
// OPT_MODELINE, etc.
{
char *errmsg = NULL;
long old_value = *(long *)varp;
@@ -3734,7 +3736,8 @@ set_num_option(
if (curwin->w_curswant != MAXCOL
&& (options[opt_idx].flags & (P_CURSWANT | P_RALL)) != 0)
curwin->w_set_curswant = TRUE;
check_redraw(options[opt_idx].flags);
if ((opt_flags & OPT_NO_REDRAW) == 0)
check_redraw(options[opt_idx].flags);
return errmsg;
}

View File

@@ -2461,11 +2461,14 @@ ambw_end:
&& (get_option_flags(opt_idx) & (P_CURSWANT | P_RALL)) != 0)
curwin->w_set_curswant = TRUE;
if ((opt_flags & OPT_NO_REDRAW) == 0)
{
#ifdef FEAT_GUI
// check redraw when it's not a GUI option or the GUI is active.
if (!redraw_gui_only || gui.in_use)
// check redraw when it's not a GUI option or the GUI is active.
if (!redraw_gui_only || gui.in_use)
#endif
check_redraw(get_option_flags(opt_idx));
check_redraw(get_option_flags(opt_idx));
}
#if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS)
if (did_swaptcap)

View File

@@ -56,7 +56,7 @@ void set_reg_var(int c);
char_u *v_exception(char_u *oldval);
char_u *v_throwpoint(char_u *oldval);
char_u *set_cmdarg(exarg_T *eap, char_u *oldarg);
int eval_variable(char_u *name, int len, typval_T *rettv, dictitem_T **dip, int verbose, int no_autoload);
int eval_variable(char_u *name, int len, typval_T *rettv, dictitem_T **dip, int flags);
void check_vars(char_u *name, int len);
dictitem_T *find_var(char_u *name, hashtab_T **htp, int no_autoload);
dictitem_T *find_var_in_ht(hashtab_T *ht, int htname, char_u *varname, int no_autoload);

View File

@@ -7,7 +7,7 @@ void ex_export(exarg_T *eap);
void free_imports_and_script_vars(int sid);
void mark_imports_for_reload(int sid);
void ex_import(exarg_T *eap);
int find_exported(int sid, char_u *name, ufunc_T **ufunc, type_T **type, cctx_T *cctx);
int find_exported(int sid, char_u *name, ufunc_T **ufunc, type_T **type, cctx_T *cctx, int verbose);
char_u *handle_import(char_u *arg_start, garray_T *gap, int import_sid, evalarg_T *evalarg, void *cctx);
char_u *vim9_declare_scriptvar(exarg_T *eap, char_u *arg);
void update_vim9_script_var(int create, dictitem_T *di, int flags, typval_T *tv, type_T **type);

View File

@@ -1459,7 +1459,7 @@ almosttheend:
si = SCRIPT_ITEM(current_sctx.sc_sid);
if (si->sn_save_cpo != NULL)
{
set_option_value((char_u *)"cpo", 0L, si->sn_save_cpo, 0);
set_option_value((char_u *)"cpo", 0L, si->sn_save_cpo, OPT_NO_REDRAW);
VIM_CLEAR(si->sn_save_cpo);
}

View File

@@ -401,11 +401,12 @@ put_view(
{
buf_T *alt = buflist_findnr(wp->w_alt_fnum);
// Set the alternate file.
// Set the alternate file if the buffer is listed.
if ((flagp == &ssop_flags)
&& alt != NULL
&& alt->b_fname != NULL
&& *alt->b_fname != NUL
&& alt->b_p_bl
&& (fputs("balt ", fd) < 0
|| ses_fname(fd, alt, flagp, TRUE) == FAIL))
return FAIL;

View File

@@ -459,6 +459,7 @@ NEW_TESTS_RES = \
test_quickfix.res \
test_quotestar.res \
test_random.res \
test_recover.res \
test_regex_char_classes.res \
test_registers.res \
test_rename.res \

View File

@@ -84,8 +84,16 @@ func CheckUnix()
endif
endfunc
" Command to check for running on Linix
command CheckLinux call CheckLinux()
func CheckLinux()
if !has('linux')
throw 'Skipped: only works on Linux'
endif
endfunc
" Command to check for not running on a BSD system.
" TODO: using this checks should not be needed
" TODO: using this check should not be needed
command CheckNotBSD call CheckNotBSD()
func CheckNotBSD()
if has('bsd')

View File

@@ -0,0 +1,6 @@
|s+0&#ffffff0|o+0&#e0e0e08|m|e| |t|e|x|t| | +0&#ffffff0@64
|~+0#4040ff13&| @73
|~| @73
|~| @73
|~| @73
|:+0#0000000&|'|<|,|'|>> @68

View File

@@ -196,7 +196,12 @@ func RunTheTest(test)
if a:test =~ 'Test_nocatch_'
" Function handles errors itself. This avoids skipping commands after the
" error.
let g:skipped_reason = ''
exe 'call ' . a:test
if g:skipped_reason != ''
call add(s:messages, ' Skipped')
call add(s:skipped, 'SKIPPED ' . a:test . ': ' . g:skipped_reason)
endif
else
try
au VimLeavePre * call EarlyExit(g:testfunc)

View File

@@ -21,7 +21,6 @@ source test_jumps.vim
source test_lispwords.vim
source test_move.vim
source test_put.vim
source test_recover.vim
source test_reltime.vim
source test_scroll_opt.vim
source test_searchpos.vim

View File

@@ -2670,6 +2670,9 @@ func Test_autocmd_window()
%bw!
edit one.txt
tabnew two.txt
vnew three.txt
tabnew four.txt
tabprevious
let g:blist = []
augroup aucmd_win_test1
au!
@@ -2678,7 +2681,12 @@ func Test_autocmd_window()
augroup END
doautoall BufEnter
call assert_equal([['one.txt', 'autocmd'], ['two.txt', '']], g:blist)
call assert_equal([
\ ['one.txt', 'autocmd'],
\ ['two.txt', ''],
\ ['four.txt', 'autocmd'],
\ ['three.txt', ''],
\ ], g:blist)
augroup aucmd_win_test1
au!

View File

@@ -33,6 +33,15 @@ func Test_fileformat_autocommand()
bw!
endfunc
func Test_fileformat_nomodifiable()
new
setlocal nomodifiable
call assert_fails('set fileformat=latin1', 'E21:')
bw
endfunc
" Convert the contents of a file into a literal string
func s:file2str(fname)
let b = readfile(a:fname, 'B')

View File

@@ -374,6 +374,7 @@ let s:filename_checks = {
\ 'po': ['file.po', 'file.pot'],
\ 'pod': ['file.pod'],
\ 'pod6': ['file.pod6'],
\ 'poke': ['file.pk'],
\ 'postscr': ['file.ps', 'file.pfa', 'file.afm', 'file.eps', 'file.epsf', 'file.epsi', 'file.ai'],
\ 'pov': ['file.pov'],
\ 'povini': ['.povrayrc'],

View File

@@ -147,9 +147,9 @@ func Test_memory_func_capture_lvars()
" The usage may be a bit less than the last value, use 80%.
" Allow for 20% tolerance at the upper limit. That's very permissive, but
" otherwise the test fails sometimes. On Cirrus CI with FreeBSD we need to
" be even more permissive.
" be even much more permissive.
if has('bsd')
let multiplier = 15
let multiplier = 19
else
let multiplier = 12
endif

View File

@@ -544,6 +544,20 @@ func Test_mkview_no_balt()
%bwipe
endfunc
func Test_mksession_no_balt()
edit Xtestfile1
edit Xtestfile2
bdelete Xtestfile1
mksession! Xtestview
source Xtestview
call assert_equal(0, buflisted('Xtestfile1'))
call delete('Xtestview')
%bwipe
endfunc
" Test :mkview with a file argument.
func Test_mkview_file()
" Create a view with line number and a fold.

View File

@@ -3207,6 +3207,13 @@ func Test_normal_delete_cmd()
" delete to a readonly register
call setline(1, ['abcd'])
call assert_beeps('normal ":d2l')
" D and d with 'nomodifiable'
call setline(1, ['abcd'])
setlocal nomodifiable
call assert_fails('normal D', 'E21:')
call assert_fails('normal d$', 'E21:')
close!
endfunc

View File

@@ -1035,6 +1035,27 @@ func Test_opt_winminheight_term()
call delete('Xwinminheight')
endfunc
func Test_opt_winminheight_term_tabs()
CheckRunVimInTerminal
" The tabline should be taken into account.
let lines =<< trim END
set wmh=0 stal=2
split
split
split
split
tabnew
END
call writefile(lines, 'Xwinminheight')
let buf = RunVimInTerminal('-S Xwinminheight', #{rows: 11})
call term_sendkeys(buf, ":set wmh=1\n")
call WaitForAssert({-> assert_match('E36: Not enough room', term_getline(buf, 11))})
call StopVimInTerminal(buf)
call delete('Xwinminheight')
endfunc
" Test for the 'winminwidth' option
func Test_opt_winminwidth()
only!

View File

@@ -1,5 +1,7 @@
" Test :recover
source check.vim
func Test_recover_root_dir()
" This used to access invalid memory.
split Xtest
@@ -21,6 +23,21 @@ func Test_recover_root_dir()
set dir&
endfunc
" Make a copy of the current swap file to "Xswap".
" Return the name of the swap file.
func CopySwapfile()
preserve
" get the name of the swap file
let swname = split(execute("swapname"))[0]
let swname = substitute(swname, '[[:blank:][:cntrl:]]*\(.\{-}\)[[:blank:][:cntrl:]]*$', '\1', '')
" make a copy of the swap file in Xswap
set binary
exe 'sp ' . swname
w! Xswap
set nobinary
return swname
endfunc
" Inserts 10000 lines with text to fill the swap file with two levels of pointer
" blocks. Then recovers from the swap file and checks all text is restored.
"
@@ -37,15 +54,9 @@ func Test_swap_file()
let i += 1
endwhile
$delete
preserve
" get the name of the swap file
let swname = split(execute("swapname"))[0]
let swname = substitute(swname, '[[:blank:][:cntrl:]]*\(.\{-}\)[[:blank:][:cntrl:]]*$', '\1', '')
" make a copy of the swap file in Xswap
set binary
exe 'sp ' . swname
w! Xswap
set nobinary
let swname = CopySwapfile()
new
only!
bwipe! Xtest
@@ -67,4 +78,59 @@ func Test_swap_file()
enew! | only
endfunc
func Test_nocatch_process_still_running()
" sysinfo.uptime probably only works on Linux
if !has('linux')
let g:skipped_reason = 'only works on Linux'
return
endif
" the GUI dialog can't be handled
if has('gui_running')
let g:skipped_reason = 'only works in the terminal'
return
endif
" don't intercept existing swap file here
au! SwapExists
" Edit a file and grab its swapfile.
edit Xswaptest
call setline(1, ['a', 'b', 'c'])
let swname = CopySwapfile()
" Forget we edited this file
new
only!
bwipe! Xswaptest
call rename('Xswap', swname)
call feedkeys('e', 'tL')
redir => editOutput
edit Xswaptest
redir END
call assert_match('E325: ATTENTION', editOutput)
call assert_match('file name: .*Xswaptest', editOutput)
call assert_match('process ID: \d* (STILL RUNNING)', editOutput)
" Forget we edited this file
new
only!
bwipe! Xswaptest
" pretend we rebooted
call test_override("uptime", 0)
sleep 1
call rename('Xswap', swname)
call feedkeys('e', 'tL')
redir => editOutput
edit Xswaptest
redir END
call assert_match('E325: ATTENTION', editOutput)
call assert_notmatch('(STILL RUNNING)', editOutput)
call test_override("ALL", 0)
call delete(swname)
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -21,6 +21,7 @@ func! Test_sleep_bang()
call s:assert_takes_longer('sl 50m', 50)
call s:assert_takes_longer('sl! 50m', 50)
call s:assert_takes_longer('1sleep', 1000)
call s:assert_takes_longer('normal 1gs', 1000)
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -858,6 +858,21 @@ func Test_mps_latin1()
close!
endfunc
func Test_mps_error()
let encoding_save = &encoding
for e in ['utf-8', 'latin1']
exe 'set encoding=' .. e
call assert_fails('set mps=<:', 'E474:', e)
call assert_fails('set mps=:>', 'E474:', e)
call assert_fails('set mps=<>', 'E474:', e)
call assert_fails('set mps=<:>_', 'E474:', e)
endfor
let &encoding = encoding_save
endfunc
" Test for ra on multi-byte characters
func Test_ra_multibyte()
new

View File

@@ -340,6 +340,26 @@ def Test_extend_list_item_type()
CheckScriptFailure(['vim9script'] + lines, 'E1012:', 1)
enddef
def Test_extend_with_error_function()
var lines =<< trim END
vim9script
def F()
{
var m = 10
}
echo m
enddef
def Test()
var d: dict<any> = {}
d->extend({A: 10, Func: function('F', [])})
enddef
Test()
END
CheckScriptFailure(lines, 'E1001: Variable not found: m')
enddef
def Test_job_info_return_type()
if has('job')
job_start(&shell)
@@ -472,6 +492,19 @@ def Test_getchar()
getchar(true)->assert_equal(0)
enddef
def Test_getenv()
if getenv('does-not_exist') == ''
assert_report('getenv() should return null')
endif
if getenv('does-not_exist') == null
else
assert_report('getenv() should return null')
endif
$SOMEENVVAR = 'some'
assert_equal('some', getenv('SOMEENVVAR'))
unlet $SOMEENVVAR
enddef
def Test_getcompletion()
set wildignore=*.vim,*~
var l = getcompletion('run', 'file', true)

View File

@@ -1370,6 +1370,9 @@ def Test_expr5_list_add()
dany[i] = i
endfor
assert_equal({a: 'a', 12: 12}, dany)
# result of glob() is "any", runtime type check
var sl: list<string> = glob('*.txt', false, true) + ['']
enddef
" test multiply, divide, modulo

View File

@@ -311,6 +311,14 @@ def Test_call_default_args()
delfunc g:Func
CheckScriptFailure(['def Func(arg: number = "text")', 'enddef', 'defcompile'], 'E1013: Argument 1: type mismatch, expected number but got string')
delfunc g:Func
var lines =<< trim END
vim9script
def Func(a = b == 0 ? 1 : 2, b = 0)
enddef
defcompile
END
CheckScriptFailure(lines, 'E1001: Variable not found: b')
enddef
def FuncWithComment( # comment

View File

@@ -5,6 +5,7 @@ source term_util.vim
source view_util.vim
source vim9.vim
source shared.vim
source screendump.vim
def Test_range_only()
new
@@ -591,6 +592,31 @@ def Test_try_catch_throw()
assert_equal(4, ReturnInFinally())
enddef
" :while at the very start of a function that :continue jumps to
def TryContinueFunc()
while g:Count < 2
g:sequence ..= 't'
try
echoerr 'Test'
catch
g:Count += 1
g:sequence ..= 'c'
continue
endtry
g:sequence ..= 'e'
g:Count += 1
endwhile
enddef
def Test_continue_in_try_in_while()
g:Count = 0
g:sequence = ''
TryContinueFunc()
assert_equal('tctc', g:sequence)
unlet g:Count
unlet g:sequence
enddef
def Test_nocatch_return_in_try()
# return in try block returns normally
def ReturnInTry(): string
@@ -1030,13 +1056,17 @@ def Test_vim9_import_export()
vim9script
import * as Export from './Xexport.vim'
def UseExport()
g:imported = Export.exported
g:imported_def = Export.exported
enddef
g:imported_script = Export.exported
assert_equal(1, exists('Export.exported'))
assert_equal(0, exists('Export.notexported'))
UseExport()
END
writefile(import_star_as_lines, 'Ximport.vim')
source Ximport.vim
assert_equal(9883, g:imported)
assert_equal(9883, g:imported_def)
assert_equal(9883, g:imported_script)
var import_star_as_lines_no_dot =<< trim END
vim9script
@@ -1071,6 +1101,22 @@ def Test_vim9_import_export()
writefile(import_star_as_duplicated, 'Ximport.vim')
assert_fails('source Ximport.vim', 'E1073:', '', 4, 'Ximport.vim')
var import_star_as_lines_script_no_dot =<< trim END
vim9script
import * as Export from './Xexport.vim'
g:imported_script = Export exported
END
writefile(import_star_as_lines_script_no_dot, 'Ximport.vim')
assert_fails('source Ximport.vim', 'E1029:')
var import_star_as_lines_script_space_after_dot =<< trim END
vim9script
import * as Export from './Xexport.vim'
g:imported_script = Export. exported
END
writefile(import_star_as_lines_script_space_after_dot, 'Ximport.vim')
assert_fails('source Ximport.vim', 'E1074:')
var import_star_as_lines_missing_name =<< trim END
vim9script
import * as Export from './Xexport.vim'
@@ -1859,6 +1905,8 @@ def Test_no_insert_xit()
CheckScriptFailure(['vim9script', 'c'], 'E1100:')
CheckScriptFailure(['vim9script', 'i = 1'], 'E488:')
CheckScriptFailure(['vim9script', 'i'], 'E1100:')
CheckScriptFailure(['vim9script', 'o = 1'], 'E1100:')
CheckScriptFailure(['vim9script', 'o'], 'E1100:')
CheckScriptFailure(['vim9script', 't'], 'E1100:')
CheckScriptFailure(['vim9script', 't = 1'], 'E1100:')
CheckScriptFailure(['vim9script', 'x = 1'], 'E1100:')
@@ -3154,6 +3202,10 @@ def Test_vim9_autoload()
return 'test'
enddef
g:some#name = 'name'
def some#varargs(a1: string, ...l: list<string>): string
return a1 .. l[0] .. l[1]
enddef
END
mkdir('Xdir/autoload', 'p')
@@ -3166,6 +3218,8 @@ def Test_vim9_autoload()
g:some#other = 'other'
assert_equal('other', g:some#other)
assert_equal('abc', some#varargs('a', 'b', 'c'))
# upper case script name works
lines =<< trim END
vim9script
@@ -3332,6 +3386,38 @@ def Test_restoring_cpo()
set cpo&vim
enddef
" Use :function so we can use Check commands
func Test_no_redraw_when_restoring_cpo()
CheckScreendump
CheckFeature timers
let lines =<< trim END
vim9script
def script#func()
enddef
END
call mkdir('Xdir/autoload', 'p')
call writefile(lines, 'Xdir/autoload/script.vim')
let lines =<< trim END
vim9script
set cpo+=M
exe 'set rtp^=' .. getcwd() .. '/Xdir'
au CmdlineEnter : ++once timer_start(0, () => script#func())
setline(1, 'some text')
END
call writefile(lines, 'XTest_redraw_cpo')
let buf = RunVimInTerminal('-S XTest_redraw_cpo', {'rows': 6})
call term_sendkeys(buf, "V:")
call VerifyScreenDump(buf, 'Test_vim9_no_redraw', {})
" clean up
call term_sendkeys(buf, "\<Esc>u")
call StopVimInTerminal(buf)
call delete('XTest_redraw_cpo')
call delete('Xdir', 'rf')
endfunc
def Test_unset_any_variable()
var lines =<< trim END

View File

@@ -906,6 +906,10 @@ func Test_viminfo_oldfiles_newfile()
call delete('Xviminfofile')
call delete('Xviminfotest')
call delete('Xnew-file.txt')
let v:oldfiles = test_null_list()
call assert_equal("\nNo old files", execute('oldfiles'))
let &viminfo = save_viminfo
let &viminfofile = save_viminfofile
endfunc

View File

@@ -970,6 +970,8 @@ f_test_override(typval_T *argvars, typval_T *rettv UNUSED)
ui_delay_for_testing = val;
else if (STRCMP(name, (char_u *)"term_props") == 0)
reset_term_props_on_termresponse = val;
else if (STRCMP(name, (char_u *)"uptime") == 0)
override_sysinfo_uptime = val;
else if (STRCMP(name, (char_u *)"ALL") == 0)
{
disable_char_avail_for_testing = FALSE;
@@ -979,6 +981,7 @@ f_test_override(typval_T *argvars, typval_T *rettv UNUSED)
no_query_mouse_for_testing = FALSE;
ui_delay_for_testing = 0;
reset_term_props_on_termresponse = FALSE;
override_sysinfo_uptime = -1;
if (save_starting >= 0)
{
starting = save_starting;

View File

@@ -750,6 +750,52 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2602,
/**/
2601,
/**/
2600,
/**/
2599,
/**/
2598,
/**/
2597,
/**/
2596,
/**/
2595,
/**/
2594,
/**/
2593,
/**/
2592,
/**/
2591,
/**/
2590,
/**/
2589,
/**/
2588,
/**/
2587,
/**/
2586,
/**/
2585,
/**/
2584,
/**/
2583,
/**/
2582,
/**/
2581,
/**/
2580,
/**/
2579,
/**/

View File

@@ -1200,6 +1200,7 @@ extern int (*dyn_libintl_wputenv)(const wchar_t *envstring);
#define OPT_WINONLY 0x10 // only set window-local options
#define OPT_NOWIN 0x20 // don't set window-local options
#define OPT_ONECOLUMN 0x40 // list options one per line
#define OPT_NO_REDRAW 0x80 // ignore redraw flags on option
// Magic chars used in confirm dialog strings
#define DLG_BUTTON_SEP '\n'
@@ -2701,4 +2702,9 @@ long elapsed(DWORD start_tick);
#define MCH_DELAY_IGNOREINPUT 1
#define MCH_DELAY_SETTMODE 2
// Flags for eval_variable().
#define EVAL_VAR_VERBOSE 1 // may give error message
#define EVAL_VAR_NOAUTOLOAD 2 // do not use script autoloading
#define EVAL_VAR_IMPORT 4 // may return special variable for import
#endif // VIM__H

View File

@@ -2645,7 +2645,8 @@ compile_load_scriptvar(
cc = *p;
*p = NUL;
idx = find_exported(import->imp_sid, exp_name, &ufunc, &type, cctx);
idx = find_exported(import->imp_sid, exp_name, &ufunc, &type,
cctx, TRUE);
*p = cc;
p = skipwhite(p);
@@ -4184,7 +4185,7 @@ compile_expr7(
* "null" constant
*/
case 'n': if (STRNCMP(*arg, "null", 4) == 0
&& !eval_isnamec((*arg)[5]))
&& !eval_isnamec((*arg)[4]))
{
*arg += 4;
rettv->v_type = VAR_SPECIAL;
@@ -4450,7 +4451,7 @@ compile_expr6(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
}
/*
* + number addition
* + number addition or list/blobl concatenation
* - number subtraction
* .. string concatenation
*/
@@ -4532,6 +4533,7 @@ compile_expr5(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
else
{
generate_ppconst(cctx, ppconst);
ppconst->pp_is_const = FALSE;
if (*op == '.')
{
if (may_generate_2STRING(-2, cctx) == FAIL
@@ -8198,6 +8200,7 @@ compile_def_function(
{
int count = ufunc->uf_def_args.ga_len;
int first_def_arg = ufunc->uf_args.ga_len - count;
int uf_args_len = ufunc->uf_args.ga_len;
int i;
char_u *arg;
int off = STACK_FRAME_SIZE + (ufunc->uf_va_name != NULL ? 1 : 0);
@@ -8210,16 +8213,24 @@ compile_def_function(
ufunc->uf_def_arg_idx = ALLOC_CLEAR_MULT(int, count + 1);
if (ufunc->uf_def_arg_idx == NULL)
goto erret;
SOURCING_LNUM = 0; // line number unknown
for (i = 0; i < count; ++i)
{
garray_T *stack = &cctx.ctx_type_stack;
type_T *val_type;
int arg_idx = first_def_arg + i;
where_T where;
int r;
// Make sure later arguments are not found.
ufunc->uf_args.ga_len = i;
ufunc->uf_def_arg_idx[i] = instr->ga_len;
arg = ((char_u **)(ufunc->uf_def_args.ga_data))[i];
if (compile_expr0(&arg, &cctx) == FAIL)
r = compile_expr0(&arg, &cctx);
ufunc->uf_args.ga_len = uf_args_len;
if (r == FAIL)
goto erret;
// If no type specified use the type of the default value.

View File

@@ -30,7 +30,7 @@ typedef struct {
int tcd_finally_idx; // instruction of the :finally block or zero
int tcd_endtry_idx; // instruction of the :endtry
int tcd_caught; // catch block entered
int tcd_cont; // :continue encountered, jump here
int tcd_cont; // :continue encountered, jump here (minus one)
int tcd_return; // when TRUE return from end of :finally
} trycmd_T;
@@ -807,9 +807,12 @@ call_by_name(char_u *name, int argcount, ectx_T *ectx, isn_T *iptr)
// types are correct.
for (i = 0; i < argcount; ++i)
{
type_T *type = i < ufunc->uf_args.ga_len
? ufunc->uf_arg_types[i] : ufunc->uf_va_type;
type_T *type = NULL;
if (i < ufunc->uf_args.ga_len)
type = ufunc->uf_arg_types[i];
else if (ufunc->uf_va_type != NULL)
type = ufunc->uf_va_type->tt_member;
if (type != NULL && check_typval_arg_type(type,
&argv[i], i + 1) == FAIL)
return FAIL;
@@ -1762,7 +1765,7 @@ call_def_function(
goto failed;
SOURCING_LNUM = iptr->isn_lnum;
if (eval_variable(name, (int)STRLEN(name),
STACK_TV_BOT(0), NULL, TRUE, FALSE) == FAIL)
STACK_TV_BOT(0), NULL, EVAL_VAR_VERBOSE) == FAIL)
goto on_error;
++ectx.ec_stack.ga_len;
}
@@ -2754,7 +2757,9 @@ call_def_function(
{
trycmd = ((trycmd_T *)trystack->ga_data)
+ trystack->ga_len - i;
trycmd->tcd_cont = iidx;
// Add one to tcd_cont to be able to jump to
// instruction with index zero.
trycmd->tcd_cont = iidx + 1;
iidx = trycmd->tcd_finally_idx == 0
? trycmd->tcd_endtry_idx : trycmd->tcd_finally_idx;
}
@@ -2808,7 +2813,7 @@ call_def_function(
if (trycmd->tcd_cont != 0)
// handling :continue: jump to outer try block or
// start of the loop
ectx.ec_iidx = trycmd->tcd_cont;
ectx.ec_iidx = trycmd->tcd_cont - 1;
}
}
break;

View File

@@ -75,7 +75,7 @@ ex_vim9script(exarg_T *eap UNUSED)
if (STRCMP(p_cpo, CPO_VIM) != 0)
{
si->sn_save_cpo = vim_strsave(p_cpo);
set_option_value((char_u *)"cpo", 0L, (char_u *)CPO_VIM, 0);
set_option_value((char_u *)"cpo", 0L, (char_u *)CPO_VIM, OPT_NO_REDRAW);
}
#else
// No check for this being the first command, it doesn't matter.
@@ -102,6 +102,7 @@ not_in_vim9(exarg_T *eap)
case CMD_append:
case CMD_change:
case CMD_insert:
case CMD_open:
case CMD_t:
case CMD_xit:
semsg(_(e_command_not_supported_in_vim9_script_missing_var_str), eap->cmd);
@@ -257,7 +258,8 @@ find_exported(
char_u *name,
ufunc_T **ufunc,
type_T **type,
cctx_T *cctx)
cctx_T *cctx,
int verbose)
{
int idx = -1;
svar_T *sv;
@@ -271,7 +273,8 @@ find_exported(
sv = ((svar_T *)script->sn_var_vals.ga_data) + idx;
if (!sv->sv_export)
{
semsg(_(e_item_not_exported_in_script_str), name);
if (verbose)
semsg(_(e_item_not_exported_in_script_str), name);
return -1;
}
*type = sv->sv_type;
@@ -301,7 +304,8 @@ find_exported(
if (*ufunc == NULL)
{
semsg(_(e_item_not_found_in_script_str), name);
if (verbose)
semsg(_(e_item_not_found_in_script_str), name);
return -1;
}
}
@@ -532,7 +536,7 @@ handle_import(
ufunc_T *ufunc = NULL;
type_T *type;
idx = find_exported(sid, name, &ufunc, &type, cctx);
idx = find_exported(sid, name, &ufunc, &type, cctx, TRUE);
if (idx < 0 && ufunc == NULL)
goto erret;

View File

@@ -919,6 +919,8 @@ equal_type(type_T *type1, type_T *type2)
{
int i;
if (type1 == NULL || type2 == NULL)
return FALSE;
if (type1->tt_type != type2->tt_type)
return FALSE;
switch (type1->tt_type)
@@ -969,12 +971,12 @@ common_type(type_T *type1, type_T *type2, type_T **dest, garray_T *type_gap)
// If either is VAR_UNKNOWN use the other type. An empty list/dict has no
// specific type.
if (type1->tt_type == VAR_UNKNOWN)
if (type1 == NULL || type1->tt_type == VAR_UNKNOWN)
{
*dest = type2;
return;
}
if (type2->tt_type == VAR_UNKNOWN)
if (type2 == NULL || type2->tt_type == VAR_UNKNOWN)
{
*dest = type1;
return;

View File

@@ -5860,8 +5860,8 @@ win_setminheight(void)
// loop until there is a 'winminheight' that is possible
while (p_wmh > 0)
{
room = Rows - p_ch - tabline_height();
needed = frame_minheight(topframe, NULL);
room = Rows - p_ch;
needed = min_rows() - 1; // 1 was added for the cmdline
if (room >= needed)
break;
--p_wmh;