Compare commits

...

6 Commits

Author SHA1 Message Date
373c65104e patch 8.2.1036: popupwin test fails sometimes
Problem:    Popupwin test fails sometimes.
Solution:   Use WaitForAssert() instead of a sleep.
2020-06-22 19:24:23 +02:00
7633fe595e patch 8.2.1035: setreg() does not always clear the register
Problem:    setreg() does not always clear the register.
Solution:   Clear the register if the dict argument is empty. (Andy Massimino,
            closes #3370)
2020-06-22 19:10:56 +02:00
38041da1c2 patch 8.2.1034: compiler warning for uninitialized variables
Problem:    Compiler warning for uninitialized variables.
Solution:   Add initializations. (John Marriott)
2020-06-21 22:17:18 +02:00
73fef33014 Update runtime files 2020-06-21 22:12:03 +02:00
8d9437968b patch 8.2.1033: not easy to read the test time in the test output
Problem:    Not easy to read the test time in the test output.
Solution:   Align the times.  Make slow tests bold.
2020-06-21 20:39:37 +02:00
7fe875583b patch 8.2.1032: error message for declaring a variable cannot be translated
Problem:    Error message for declaring a variable cannot be translated.
Solution:   Enclose in _().  Make environment variable a separate message.
2020-06-21 20:38:28 +02:00
22 changed files with 209 additions and 106 deletions

View File

@ -1,4 +1,4 @@
*eval.txt* For Vim version 8.2. Last change: 2020 Jun 14 *eval.txt* For Vim version 8.2. Last change: 2020 Jun 17
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -5770,8 +5770,8 @@ getwininfo([{winid}]) *getwininfo()*
Returns information about windows as a List with Dictionaries. Returns information about windows as a List with Dictionaries.
If {winid} is given Information about the window with that ID If {winid} is given Information about the window with that ID
is returned. If the window does not exist the result is an is returned, as a List with one item. If the window does not
empty list. exist the result is an empty list.
Without {winid} information about all the windows in all the Without {winid} information about all the windows in all the
tab pages is returned. tab pages is returned.
@ -9386,7 +9386,9 @@ simplify({filename}) *simplify()*
Unix) are not resolved. If the first path component in Unix) are not resolved. If the first path component in
{filename} designates the current directory, this will be {filename} designates the current directory, this will be
valid for the result as well. A trailing path separator is valid for the result as well. A trailing path separator is
not removed either. not removed either. On Unix "//path" is unchanged, but
"///path" is simplified to "/path" (this follows the Posix
standard).
Example: > Example: >
simplify("./dir/.././/file/") == "./file/" simplify("./dir/.././/file/") == "./file/"
< Note: The combination "dir/.." is only removed if "dir" is < Note: The combination "dir/.." is only removed if "dir" is
@ -10450,9 +10452,9 @@ terminalprops() *terminalprops()*
If the |+termresponse| feature is missing then the result is If the |+termresponse| feature is missing then the result is
an empty dictionary. an empty dictionary.
If "cursor_style" is 'y' then |t_RS| will be send to request the If "cursor_style" is 'y' then |t_RS| will be sent to request the
current cursor style. current cursor style.
If "cursor_blink_mode" is 'y' then |t_RC| will be send to If "cursor_blink_mode" is 'y' then |t_RC| will be sent to
request the cursor blink status. request the cursor blink status.
"cursor_style" and "cursor_blink_mode" are also set if |t_u7| "cursor_style" and "cursor_blink_mode" are also set if |t_u7|
is not empty, Vim will detect the working of sending |t_RS| is not empty, Vim will detect the working of sending |t_RS|

View File

@ -1,4 +1,4 @@
*mlang.txt* For Vim version 8.2. Last change: 2019 May 05 *mlang.txt* For Vim version 8.2. Last change: 2020 Jun 16
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -3897,6 +3897,7 @@ E105 mbyte.txt /*E105*
E107 eval.txt /*E107* E107 eval.txt /*E107*
E108 eval.txt /*E108* E108 eval.txt /*E108*
E109 eval.txt /*E109* E109 eval.txt /*E109*
E1094 vim9.txt /*E1094*
E11 cmdline.txt /*E11* E11 cmdline.txt /*E11*
E110 eval.txt /*E110* E110 eval.txt /*E110*
E111 eval.txt /*E111* E111 eval.txt /*E111*
@ -5798,6 +5799,7 @@ coding-style develop.txt /*coding-style*
col() eval.txt /*col()* col() eval.txt /*col()*
coldfusion.vim syntax.txt /*coldfusion.vim* coldfusion.vim syntax.txt /*coldfusion.vim*
collapse tips.txt /*collapse* collapse tips.txt /*collapse*
collate-variable eval.txt /*collate-variable*
color-xterm syntax.txt /*color-xterm* color-xterm syntax.txt /*color-xterm*
coloring syntax.txt /*coloring* coloring syntax.txt /*coloring*
colortest.vim syntax.txt /*colortest.vim* colortest.vim syntax.txt /*colortest.vim*
@ -9723,6 +9725,7 @@ v:charconvert_from eval.txt /*v:charconvert_from*
v:charconvert_to eval.txt /*v:charconvert_to* v:charconvert_to eval.txt /*v:charconvert_to*
v:cmdarg eval.txt /*v:cmdarg* v:cmdarg eval.txt /*v:cmdarg*
v:cmdbang eval.txt /*v:cmdbang* v:cmdbang eval.txt /*v:cmdbang*
v:collate eval.txt /*v:collate*
v:completed_item eval.txt /*v:completed_item* v:completed_item eval.txt /*v:completed_item*
v:count eval.txt /*v:count* v:count eval.txt /*v:count*
v:count1 eval.txt /*v:count1* v:count1 eval.txt /*v:count1*

View File

@ -1,4 +1,4 @@
*testing.txt* For Vim version 8.2. Last change: 2020 Jun 13 *testing.txt* For Vim version 8.2. Last change: 2020 Jun 15
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*todo.txt* For Vim version 8.2. Last change: 2020 Jun 14 *todo.txt* For Vim version 8.2. Last change: 2020 Jun 21
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -40,16 +40,16 @@ browser use: https://github.com/vim/vim/issues/1234
Include src/po/vim.pot ? Include src/po/vim.pot ?
See if resizing a terminal can be fixed.
Vim9 script: Vim9 script:
Making everything work: Making everything work:
- assignment to script var should check type - Error for "g:var: string = 'value'"
- Compile: let [var, var] = expr - Make func()->append('$') work - value is last argument, not first. #6305
share code for :let between compiled and uncompiled?
- do not allow "let g:var = value", must drop "let"
- possible memory leak in test_vim9_func through compile_nested_function. - possible memory leak in test_vim9_func through compile_nested_function.
- memory leaks in test_vim9_expr - memory leaks in test_vim9_expr
- memory leaks in test_vim9_script - memory leaks in test_vim9_script
- Test that a script-local function in Vim9 script cannot be deleted. - more return types depending on the first argument, like sort().
- Check that when sourcing a Vim9 script, only the global items can be used. - Check that when sourcing a Vim9 script, only the global items can be used.
- Make "true" and "false" work in vim9script - Make "true" and "false" work in vim9script
- Test that a function defined inside a :def function is local to that - Test that a function defined inside a :def function is local to that
@ -240,10 +240,12 @@ Terminal emulator window:
conversions. conversions.
Error numbers available: Error numbers available:
E489, E610, E611, E653, E856, E857, E861 E489, E610, E611, E653, E856
Remove SPACE_IN_FILENAME ? It is only used for completion. Remove SPACE_IN_FILENAME ? It is only used for completion.
Patch to use collaction based sorting. (Christian Brabandt, #6229)
Can we detect true color support? https://gist.github.com/XVilka/8346728 Can we detect true color support? https://gist.github.com/XVilka/8346728
Try setting a color then request the current color, like using t_u7. Try setting a color then request the current color, like using t_u7.
@ -272,6 +274,8 @@ The buffer list and windows are locked, no changes possible
How about removing Atari MiNT support? How about removing Atari MiNT support?
src/Make_mint.mak, src/os_mint.h, matches with __MINT__ src/Make_mint.mak, src/os_mint.h, matches with __MINT__
Patch to make :q work with local arglist. (Christian Brabandt, #6286)
Patch to fix drawing error with DirectX. (James Grant, #5688) Patch to fix drawing error with DirectX. (James Grant, #5688)
Causes flicker on resizing. Workaround from Ken Takata. Causes flicker on resizing. Workaround from Ken Takata.
How about only setting the attribute when part of the Vim window is offscreen? How about only setting the attribute when part of the Vim window is offscreen?
@ -285,6 +289,8 @@ Motif: Build on Ubuntu can't enter any text in dialog text fields.
Running test_gui and test_gui_init with Motif sometimes kills the window Running test_gui and test_gui_init with Motif sometimes kills the window
manager. Problem with Motif? manager. Problem with Motif?
Patch to add :argdedupe. (Nir Lichtman, #6235)
:map output does not clear the reset of the command line. :map output does not clear the reset of the command line.
(#5623, also see #5962) (#5623, also see #5962)
@ -1402,9 +1408,6 @@ the system encoding (usually utf-8).
MS-Windows: use WS_HIDE instead of SW_SHOWMINNOACTIVE in os_win32.c? MS-Windows: use WS_HIDE instead of SW_SHOWMINNOACTIVE in os_win32.c?
Otherwise task flickers in taskbar. Otherwise task flickers in taskbar.
Should make ":@r" handle line continuation. (Cesar Romani, 2016 Jun 26)
Also for ":@.".
Repeating 'opfunc' in a function only works once. (Tarmean, 2016 Jul 15, #925) Repeating 'opfunc' in a function only works once. (Tarmean, 2016 Jul 15, #925)
Have a way to get the call stack, in a function and from an exception. Have a way to get the call stack, in a function and from an exception.

View File

@ -211,7 +211,7 @@ will automatically delete it:
- The flag that the file was modified is not set. - The flag that the file was modified is not set.
- The process is not running. - The process is not running.
You can programatically deal with this situation with the |FileChangedShell| You can programmatically deal with this situation with the |FileChangedShell|
autocommand event. autocommand event.

View File

@ -112,7 +112,7 @@ Although it's shorter to do: >
Legacy Vim script does have type checking, but this happens at runtime, when Legacy Vim script does have type checking, but this happens at runtime, when
the code is executed. And it's permissive, often a computation gives an the code is executed. And it's permissive, often a computation gives an
unexpected value instead of reporting an error . Thus you can define a unexpected value instead of reporting an error. Thus you can define a
function and think it's fine, but see a problem only later when it is called: > function and think it's fine, but see a problem only later when it is called: >
let s:collected = '' let s:collected = ''
func ExtendAndReturn(add) func ExtendAndReturn(add)
@ -142,7 +142,7 @@ you did wrong: >
Vim9 script is strict, it uses the "+" operator only for numbers and floats. Vim9 script is strict, it uses the "+" operator only for numbers and floats.
For string concatenation ".." must be used. This avoids mistakes and avoids For string concatenation ".." must be used. This avoids mistakes and avoids
the automatic conversion that gave a suprising result above. So you change the automatic conversion that gave a surprising result above. So you change
the first line of the function to: > the first line of the function to: >
s:collected ..= add s:collected ..= add
And now it works. And now it works.

View File

@ -1,4 +1,4 @@
*usr_toc.txt* For Vim version 8.2. Last change: 2020 Jun 11 *usr_toc.txt* For Vim version 8.2. Last change: 2020 Jun 15
VIM USER MANUAL - by Bram Moolenaar VIM USER MANUAL - by Bram Moolenaar
@ -340,6 +340,12 @@ Make Vim work as you like it.
|45.4| Editing files with a different encoding |45.4| Editing files with a different encoding
|45.5| Entering language text |45.5| Entering language text
|usr_46.txt| Write plugins using Vim9 script
|46.1| Introduction
|46.2| Variable declarations
|46.3| Functions and types
|46.?| Using a Vim9 script from legacy script
============================================================================== ==============================================================================
Making Vim Run ~ Making Vim Run ~

View File

@ -1,4 +1,4 @@
*vim9.txt* For Vim version 8.2. Last change: 2020 Jun 14 *vim9.txt* For Vim version 8.2. Last change: 2020 Jun 21
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -30,7 +30,7 @@ THIS IS STILL UNDER DEVELOPMENT - ANYTHING CAN BREAK - ANYTHING CAN CHANGE
Vim script has been growing over time, while preserving backwards Vim script has been growing over time, while preserving backwards
compatibility. That means bad choices from the past often can't be changed compatibility. That means bad choices from the past often can't be changed
and compability with Vi restricts possible solutions. Execution is quite and compatibility with Vi restricts possible solutions. Execution is quite
slow, each line is parsed every time it is executed. slow, each line is parsed every time it is executed.
The main goal of Vim9 script is to drastically improve performance. This is The main goal of Vim9 script is to drastically improve performance. This is
@ -68,7 +68,7 @@ In Vim script comments normally start with double quote. That can also be the
start of a string, thus in many places it cannot be used. In Vim9 script a start of a string, thus in many places it cannot be used. In Vim9 script a
comment can also start with #. In Vi this is a command to list text with comment can also start with #. In Vi this is a command to list text with
numbers, but you can also use `:number` for that. > numbers, but you can also use `:number` for that. >
let count = 0 # number of occurences let count = 0 # number of occurrences
To improve readability there must be a space between the command and the # To improve readability there must be a space between the command and the #
that starts a comment. Note that #{ is the start of a dictionary, therefore that starts a comment. Note that #{ is the start of a dictionary, therefore
@ -269,6 +269,13 @@ possible AFTER the operators. For example: >
PosFunc(arg) : PosFunc(arg) :
NegFunc(arg) NegFunc(arg)
A special case is "->" for function call chains, it can appear in the next
line: >
let result = GetBuilder()
->BuilderSetWidth(333)
->BuilderSetHeight(777)
->BuilderBuild()
Note that "enddef" cannot be used at the start of a continuation line, it ends Note that "enddef" cannot be used at the start of a continuation line, it ends
the current function. the current function.
@ -566,7 +573,7 @@ defined (otherwise script-local) items: >
Import ~ Import ~
*:import* *:imp* *:import* *:imp* *E1094*
The exported items can be imported individually in another Vim9 script: > The exported items can be imported individually in another Vim9 script: >
import EXPORTED_CONST from "thatscript.vim" import EXPORTED_CONST from "thatscript.vim"
import MyClass from "myclass.vim" import MyClass from "myclass.vim"
@ -692,7 +699,7 @@ A, B and C, where A calls B, B calls C, and C calls A again. It's impossible
to reorder the functions to avoid forward references. to reorder the functions to avoid forward references.
An alternative would be to first scan through the file to locate items and An alternative would be to first scan through the file to locate items and
figure out their type, so that forward refeferences are found, and only then figure out their type, so that forward references are found, and only then
execute the script and compile the functions. This means the script has to be execute the script and compile the functions. This means the script has to be
parsed twice, which is slower, and some conditions at the script level, such parsed twice, which is slower, and some conditions at the script level, such
as checking if a feature is supported, are hard to use. An attempt was made as checking if a feature is supported, are hard to use. An attempt was made

View File

@ -1,7 +1,7 @@
" Vim support file to detect file types " Vim support file to detect file types
" "
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2020 Jun 07 " Last Change: 2020 Jun 15
" Listen very carefully, I will say this only once " Listen very carefully, I will say this only once
if exists("did_load_filetypes") if exists("did_load_filetypes")

View File

@ -1,7 +1,7 @@
" Vim filetype plugin " Vim filetype plugin
" Language: Vim " Language: Vim
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2020 May 17 " Last Change: 2020 Jun 16
" Only do this when not done yet for this buffer " Only do this when not done yet for this buffer
if exists("b:did_ftplugin") if exists("b:did_ftplugin")
@ -83,8 +83,7 @@ endif
if exists("loaded_matchit") if exists("loaded_matchit")
let b:match_ignorecase = 0 let b:match_ignorecase = 0
let b:match_words = let b:match_words =
\ '\<fu\%[nction]\>:\<retu\%[rn]\>:\<endf\%[unction]\>,' . \ '\<\%(fu\%[nction]\|def\)\>:\<retu\%[rn]\>:\<\%(endf\%[unction]\|enddef\)\>,' .
\ '\<def\>:\<retu\%[rn]\>:\<enddef\>,' .
\ '\<\(wh\%[ile]\|for\)\>:\<brea\%[k]\>:\<con\%[tinue]\>:\<end\(w\%[hile]\|fo\%[r]\)\>,' . \ '\<\(wh\%[ile]\|for\)\>:\<brea\%[k]\>:\<con\%[tinue]\>:\<end\(w\%[hile]\|fo\%[r]\)\>,' .
\ '\<if\>:\<el\%[seif]\>:\<en\%[dif]\>,' . \ '\<if\>:\<el\%[seif]\>:\<en\%[dif]\>,' .
\ '{:},' . \ '{:},' .

View File

@ -2,7 +2,7 @@
" Header: "{{{ " Header: "{{{
" Maintainer: Bram Moolenaar " Maintainer: Bram Moolenaar
" Original Author: Andy Wokula <anwoku@yahoo.de> " Original Author: Andy Wokula <anwoku@yahoo.de>
" Last Change: 2019 Mar 20 " Last Change: 2020 Jun 18
" Version: 1.0 " Version: 1.0
" Description: HTML indent script with cached state for faster indenting on a " Description: HTML indent script with cached state for faster indenting on a
" range of lines. " range of lines.
@ -223,7 +223,7 @@ endfunc "}}}
call s:AddITags(s:indent_tags, [ call s:AddITags(s:indent_tags, [
\ 'a', 'abbr', 'acronym', 'address', 'b', 'bdo', 'big', \ 'a', 'abbr', 'acronym', 'address', 'b', 'bdo', 'big',
\ 'blockquote', 'body', 'button', 'caption', 'center', 'cite', 'code', \ 'blockquote', 'body', 'button', 'caption', 'center', 'cite', 'code',
\ 'colgroup', 'del', 'dfn', 'dir', 'div', 'dl', 'em', 'fieldset', 'font', \ 'colgroup', 'dd', 'del', 'dfn', 'dir', 'div', 'dl', 'dt', 'em', 'fieldset', 'font',
\ 'form', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'html', \ 'form', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'html',
\ 'i', 'iframe', 'ins', 'kbd', 'label', 'legend', 'li', \ 'i', 'iframe', 'ins', 'kbd', 'label', 'legend', 'li',
\ 'map', 'menu', 'noframes', 'noscript', 'object', 'ol', \ 'map', 'menu', 'noframes', 'noscript', 'object', 'ol',

View File

@ -23,4 +23,14 @@ bar">
text text
</div> </div>
<dl>
<dd>
dd text
</dd>
<dt>
dt text
</dt>
</dl>
" END_INDENT " END_INDENT

View File

@ -23,4 +23,14 @@
text text
</div> </div>
<dl>
<dd>
dd text
</dd>
<dt>
dt text
</dt>
</dl>
" END_INDENT " END_INDENT

View File

@ -1,6 +1,6 @@
" Vim plugin for showing matching parens " Vim plugin for showing matching parens
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2019 Oct 28 " Last Change: 2020 Jun 18
" Exit quickly when: " Exit quickly when:
" - this plugin was already loaded (or disabled) " - this plugin was already loaded (or disabled)
@ -21,6 +21,7 @@ endif
augroup matchparen augroup matchparen
" Replace all matchparen autocommands " Replace all matchparen autocommands
autocmd! CursorMoved,CursorMovedI,WinEnter * call s:Highlight_Matching_Pair() autocmd! CursorMoved,CursorMovedI,WinEnter * call s:Highlight_Matching_Pair()
autocmd! WinLeave * call s:Remove_Matches()
if exists('##TextChanged') if exists('##TextChanged')
autocmd! TextChanged,TextChangedI * call s:Highlight_Matching_Pair() autocmd! TextChanged,TextChangedI * call s:Highlight_Matching_Pair()
endif endif
@ -38,10 +39,7 @@ set cpo-=C
" for any matching paren. " for any matching paren.
func s:Highlight_Matching_Pair() func s:Highlight_Matching_Pair()
" Remove any previous match. " Remove any previous match.
if exists('w:paren_hl_on') && w:paren_hl_on call s:Remove_Matches()
silent! call matchdelete(3)
let w:paren_hl_on = 0
endif
" Avoid that we remove the popup menu. " Avoid that we remove the popup menu.
" Return when there are no colors (looks like the cursor jumps). " Return when there are no colors (looks like the cursor jumps).
@ -195,6 +193,14 @@ func s:Highlight_Matching_Pair()
endif endif
endfunction endfunction
func s:Remove_Matches()
if exists('w:paren_hl_on') && w:paren_hl_on
silent! call matchdelete(3)
let w:paren_hl_on = 0
endif
endfunc
" Define commands that will disable and enable the plugin. " Define commands that will disable and enable the plugin.
command DoMatchParen call s:DoMatchParen() command DoMatchParen call s:DoMatchParen()
command NoMatchParen call s:NoMatchParen() command NoMatchParen call s:NoMatchParen()

View File

@ -7268,6 +7268,37 @@ f_setpos(typval_T *argvars, typval_T *rettv)
} }
} }
/*
* Translate a register type string to the yank type and block length
*/
static int
get_yank_type(char_u **pp, char_u *yank_type, long *block_len)
{
char_u *stropt = *pp;
switch (*stropt)
{
case 'v': case 'c': // character-wise selection
*yank_type = MCHAR;
break;
case 'V': case 'l': // line-wise selection
*yank_type = MLINE;
break;
case 'b': case Ctrl_V: // block-wise selection
*yank_type = MBLOCK;
if (VIM_ISDIGIT(stropt[1]))
{
++stropt;
*block_len = getdigits(&stropt) - 1;
--stropt;
}
break;
default:
return FAIL;
}
*pp = stropt;
return OK;
}
/* /*
* "setreg()" function * "setreg()" function
*/ */
@ -7302,29 +7333,30 @@ f_setreg(typval_T *argvars, typval_T *rettv)
if (argvars[1].v_type == VAR_DICT) if (argvars[1].v_type == VAR_DICT)
{ {
dict_T *d = argvars[1].vval.v_dict; dict_T *d = argvars[1].vval.v_dict;
dictitem_T *di = dict_find(d, (char_u *)"regcontents", -1); dictitem_T *di;
if (d == NULL || d->dv_hashtab.ht_used == 0)
{
// Empty dict, clear the register (like setreg(0, []))
char_u *lstval[2] = {NULL, NULL};
write_reg_contents_lst(regname, lstval, 0, FALSE, MAUTO, -1);
return;
}
di = dict_find(d, (char_u *)"regcontents", -1);
if (di != NULL) if (di != NULL)
regcontents = &di->di_tv; regcontents = &di->di_tv;
stropt = dict_get_string(d, (char_u *)"regtype", FALSE); stropt = dict_get_string(d, (char_u *)"regtype", FALSE);
if (stropt != NULL) if (stropt != NULL)
switch (*stropt)
{ {
case 'v': // character-wise selection int ret = get_yank_type(&stropt, &yank_type, &block_len);
yank_type = MCHAR;
break; if (ret == FAIL || *++stropt != NUL)
case 'V': // line-wise selection
yank_type = MLINE;
break;
case Ctrl_V: // block-wise selection
yank_type = MBLOCK;
if (VIM_ISDIGIT(stropt[1]))
{ {
++stropt; semsg(_(e_invargval), "value");
block_len = getdigits(&stropt) - 1; return;
--stropt;
} }
break;
} }
if (regname == '"') if (regname == '"')
@ -7344,6 +7376,12 @@ f_setreg(typval_T *argvars, typval_T *rettv)
if (argvars[2].v_type != VAR_UNKNOWN) if (argvars[2].v_type != VAR_UNKNOWN)
{ {
if (yank_type != MAUTO)
{
semsg(_(e_toomanyarg), "setreg");
return;
}
stropt = tv_get_string_chk(&argvars[2]); stropt = tv_get_string_chk(&argvars[2]);
if (stropt == NULL) if (stropt == NULL)
return; // type error return; // type error
@ -7353,21 +7391,8 @@ f_setreg(typval_T *argvars, typval_T *rettv)
case 'a': case 'A': // append case 'a': case 'A': // append
append = TRUE; append = TRUE;
break; break;
case 'v': case 'c': // character-wise selection default:
yank_type = MCHAR; get_yank_type(&stropt, &yank_type, &block_len);
break;
case 'V': case 'l': // line-wise selection
yank_type = MLINE;
break;
case 'b': case Ctrl_V: // block-wise selection
yank_type = MBLOCK;
if (VIM_ISDIGIT(stropt[1]))
{
++stropt;
block_len = getdigits(&stropt) - 1;
--stropt;
}
break;
} }
} }

View File

@ -1788,7 +1788,8 @@ EXTERN char e_no_white_before[] INIT(= N_("E1068: No white space allowed before
EXTERN char e_lock_unlock[] INIT(= N_("E940: Cannot lock or unlock variable %s")); EXTERN char e_lock_unlock[] INIT(= N_("E940: Cannot lock or unlock variable %s"));
EXTERN char e_const_req_value[] INIT(= N_("E1021: const requires a value")); EXTERN char e_const_req_value[] INIT(= N_("E1021: const requires a value"));
EXTERN char e_type_req[] INIT(= N_("E1022: type or initialization required")); EXTERN char e_type_req[] INIT(= N_("E1022: type or initialization required"));
EXTERN char e_declare_var[] INIT(= N_("E1016: Cannot declare a%s variable: %s")); EXTERN char e_declare_var[] INIT(= N_("E1016: Cannot declare a %s variable: %s"));
EXTERN char e_declare_env_var[] INIT(= N_("E1016: Cannot declare an environment variable: %s"));
#endif #endif
#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS)
EXTERN char e_alloc_color[] INIT(= N_("E254: Cannot allocate color %s")); EXTERN char e_alloc_color[] INIT(= N_("E254: Cannot allocate color %s"));

View File

@ -216,7 +216,15 @@ func RunTheTest(test)
let message = 'Executed ' . a:test let message = 'Executed ' . a:test
if has('reltime') if has('reltime')
let message ..= ' in ' .. reltimestr(reltime(func_start)) .. ' seconds' let message ..= repeat(' ', 50 - len(message))
let time = reltime(func_start)
if has('float') && reltimefloat(time) > 0.1
let message = &t_md .. message
endif
let message ..= ' in ' .. reltimestr(time) .. ' seconds'
if has('float') && reltimefloat(time) > 0.1
let message ..= &t_me
endif
endif endif
call add(s:messages, message) call add(s:messages, message)
let s:done += 1 let s:done += 1
@ -284,7 +292,9 @@ func FinishTesting()
let message = 'Executed ' . s:done . (s:done > 1 ? ' tests' : ' test') let message = 'Executed ' . s:done . (s:done > 1 ? ' tests' : ' test')
endif endif
if s:done > 0 && has('reltime') if s:done > 0 && has('reltime')
let message = &t_md .. message .. repeat(' ', 40 - len(message))
let message ..= ' in ' .. reltimestr(reltime(s:start_time)) .. ' seconds' let message ..= ' in ' .. reltimestr(reltime(s:start_time)) .. ' seconds'
let message ..= &t_me
endif endif
echo message echo message
call add(s:messages, message) call add(s:messages, message)

View File

@ -2454,9 +2454,11 @@ func Test_popupwin_terminal_buffer()
call term_sendkeys(termbuf2, "exit\<CR>") call term_sendkeys(termbuf2, "exit\<CR>")
" Exiting shell closes popup window " Exiting shell closes popup window
let pupwin = win_getid()
call feedkeys("exit\<CR>", 'xt') call feedkeys("exit\<CR>", 'xt')
" Wait for shell to exit " Wait for shell to exit
sleep 100m call WaitForAssert({-> assert_notequal(pupwin, win_getid())})
call feedkeys(":quit\<CR>", 'xt') call feedkeys(":quit\<CR>", 'xt')
call assert_equal(origwin, win_getid()) call assert_equal(origwin, win_getid())
endfunc endfunc

View File

@ -485,6 +485,14 @@ func Test_set_register_dict()
call assert_equal(['six'], getreginfo('0').regcontents) call assert_equal(['six'], getreginfo('0').regcontents)
call assert_equal(['six'], getreginfo('"').regcontents) call assert_equal(['six'], getreginfo('"').regcontents)
let @x = 'one'
call setreg('x', {})
call assert_equal(1, len(split(execute('reg x'), '\n')))
call assert_fails("call setreg('0', #{regtype: 'V'}, 'v')", 'E118:')
call assert_fails("call setreg('0', #{regtype: 'X'})", 'E475:')
call assert_fails("call setreg('0', #{regtype: 'vy'})", 'E475:')
bwipe! bwipe!
endfunc endfunc

View File

@ -754,6 +754,16 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1036,
/**/
1035,
/**/
1034,
/**/
1033,
/**/
1032,
/**/ /**/
1031, 1031,
/**/ /**/

View File

@ -4357,9 +4357,9 @@ compile_expr1(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
garray_T *instr = &cctx->ctx_instr; garray_T *instr = &cctx->ctx_instr;
garray_T *stack = &cctx->ctx_type_stack; garray_T *stack = &cctx->ctx_type_stack;
int alt_idx = instr->ga_len; int alt_idx = instr->ga_len;
int end_idx; int end_idx = 0;
isn_T *isn; isn_T *isn;
type_T *type1; type_T *type1 = NULL;
type_T *type2; type_T *type2;
int has_const_expr = FALSE; int has_const_expr = FALSE;
int const_value = FALSE; int const_value = FALSE;
@ -4679,12 +4679,13 @@ vim9_declare_error(char_u *name)
switch (*name) switch (*name)
{ {
case 'g': scope = " global"; break; case 'g': scope = _("global"); break;
case 'b': scope = " buffer"; break; case 'b': scope = _("buffer"); break;
case 'w': scope = " window"; break; case 'w': scope = _("window"); break;
case 't': scope = " tab"; break; case 't': scope = _("tab"); break;
case 'v': scope = " v:"; break; case 'v': scope = "v:"; break;
case '$': scope = "n environment"; break; case '$': semsg(_(e_declare_env_var), name); return;
default: return;
} }
semsg(_(e_declare_var), scope, name); semsg(_(e_declare_var), scope, name);
} }