aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/legacy2luatest.pl41
-rw-r--r--src/nvim/eval.c2
-rw-r--r--src/nvim/ex_cmds.lua85
-rw-r--r--src/nvim/ex_docmd.c25
-rw-r--r--src/nvim/screen.c11
-rw-r--r--src/nvim/testdir/test55.in5
-rw-r--r--src/nvim/testdir/test55.ok1
-rw-r--r--src/nvim/version.c18
-rw-r--r--src/nvim/window.c27
-rw-r--r--test/functional/legacy/signs_spec.lua24
10 files changed, 188 insertions, 51 deletions
diff --git a/scripts/legacy2luatest.pl b/scripts/legacy2luatest.pl
index 5979afa788..fb14da8157 100755
--- a/scripts/legacy2luatest.pl
+++ b/scripts/legacy2luatest.pl
@@ -58,11 +58,12 @@ sub read_in_file {
unshift @{$command_lines}, @{$input_lines};
unshift @{$command_lines}, "insert([[";
- push @{$test_body_lines}, @{$command_lines};
-
- @{$command_lines} = ();
@{$input_lines} = ();
}
+
+ # Output remaining command lines.
+ push @{$test_body_lines}, @{$command_lines};
+ @{$command_lines} = ();
}
sub format_comment {
@@ -173,11 +174,9 @@ sub read_in_file {
$state = $states{$state}->($_);
}
- # If not all input lines have been processed,
+ # If not all lines have been processed yet,
# do it now.
- if (@input_lines) {
- end_input \@input_lines, \@command_lines, \@test_body_lines;
- }
+ end_input \@input_lines, \@command_lines, \@test_body_lines;
close $in_file_handle;
@@ -226,13 +225,17 @@ if ($#ARGV != 1) {
}
my @legacy_suffixes = ('.in', '.ok');
-my ($test_name, $base_path, $suffix) = fileparse($legacy_testfile, @legacy_suffixes);
-my $in_file = catfile($base_path, $test_name . '.in');
-my $ok_file = catfile($base_path, $test_name . '.ok');
+my ($base_name, $base_path, $suffix) = fileparse($legacy_testfile, @legacy_suffixes);
+my $in_file = catfile($base_path, $base_name . '.in');
+my $ok_file = catfile($base_path, $base_name . '.ok');
+
+# Remove leading 'test'.
+my $test_name = $base_name;
+$test_name =~ s/^test_?//;
my $spec_file = do {
- if ($test_name =~ /^test([0-9]+)/) {
- catfile($out_dir, sprintf('%03d', $1) . '_' . $test_name . '_spec.lua')
+ if ($test_name =~ /^([0-9]+)/) {
+ catfile($out_dir, sprintf('%03d', $1) . '_spec.lua')
} else {
catfile($out_dir, $test_name . '_spec.lua')
}
@@ -250,7 +253,13 @@ if (! -d $out_dir) {
if (-f $spec_file) {
say "Output file $spec_file already exists.";
- exit 4;
+ print "Overwrite (Y/n)? ";
+ my $input = <STDIN>;
+ chomp($input);
+ unless ($input =~ /^y|Y/) {
+ say "Aborting.";
+ exit 4;
+ }
}
# Read .in and .ok files.
@@ -267,8 +276,8 @@ print $spec_file_handle <<"EOS";
@{[join "\n", @{$description_lines}]}
local helpers = require('test.functional.helpers')
-local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
-local execute, expect = helpers.execute, helpers.expect
+local feed, insert, source = helpers.feed, helpers.insert, helpers.source
+local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
describe('$test_name', function()
setup(clear)
@@ -280,3 +289,5 @@ end)
EOS
close $spec_file_handle;
+
+say "Written to $spec_file."
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 69f2f38a1a..744fb13447 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -2247,7 +2247,7 @@ static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, int copy, ch
int ll_n1 = lp->ll_n1;
// Check whether any of the list items is locked
- for (listitem_T *ri = rettv->vval.v_list->lv_first; ri != NULL; ) {
+ for (listitem_T *ri = rettv->vval.v_list->lv_first; ri != NULL && ll_li != NULL; ) {
if (tv_check_lock(ll_li->li_tv.v_lock, lp->ll_name)) {
return;
}
diff --git a/src/nvim/ex_cmds.lua b/src/nvim/ex_cmds.lua
index c9dd974d11..aade4d736d 100644
--- a/src/nvim/ex_cmds.lua
+++ b/src/nvim/ex_cmds.lua
@@ -1241,6 +1241,21 @@ return {
func='ex_unmap',
},
{
+ command='lua',
+ flags=bit.bor(RANGE, EXTRA, NEEDARG, CMDWIN),
+ func='ex_script_ni',
+ },
+ {
+ command='luado',
+ flags=bit.bor(RANGE, DFLALL, EXTRA, NEEDARG, CMDWIN),
+ func='ex_ni',
+ },
+ {
+ command='luafile',
+ flags=bit.bor(RANGE, FILE1, NEEDARG, CMDWIN),
+ func='ex_ni',
+ },
+ {
command='lvimgrep',
flags=bit.bor(RANGE, NOTADR, BANG, NEEDARG, EXTRA, NOTRLCOM, TRLBAR, XFILE),
func='ex_vimgrep',
@@ -1341,6 +1356,16 @@ return {
func='ex_mode',
},
{
+ command='mzscheme',
+ flags=bit.bor(RANGE, EXTRA, DFLALL, NEEDARG, CMDWIN, SBOXOK),
+ func='ex_script_ni',
+ },
+ {
+ command='mzfile',
+ flags=bit.bor(RANGE, FILE1, NEEDARG, CMDWIN),
+ func='ex_ni',
+ },
+ {
command='next',
flags=bit.bor(RANGE, NOTADR, BANG, FILES, EDITCMD, ARGOPT, TRLBAR),
func='ex_next',
@@ -1511,6 +1536,16 @@ return {
func='ex_pclose',
},
{
+ command='perl',
+ flags=bit.bor(RANGE, EXTRA, DFLALL, NEEDARG, SBOXOK, CMDWIN),
+ func='ex_script_ni',
+ },
+ {
+ command='perldo',
+ flags=bit.bor(RANGE, EXTRA, DFLALL, NEEDARG, CMDWIN),
+ func='ex_ni',
+ },
+ {
command='pedit',
flags=bit.bor(BANG, FILE1, EDITCMD, ARGOPT, TRLBAR),
func='ex_pedit',
@@ -1636,6 +1671,26 @@ return {
func='ex_pyfile',
},
{
+ command='py3',
+ flags=bit.bor(RANGE, EXTRA, NEEDARG, CMDWIN),
+ func='ex_script_ni',
+ },
+ {
+ command='py3do',
+ flags=bit.bor(RANGE, DFLALL, EXTRA, NEEDARG, CMDWIN),
+ func='ex_ni',
+ },
+ {
+ command='python3',
+ flags=bit.bor(RANGE, EXTRA, NEEDARG, CMDWIN),
+ func='ex_script_ni',
+ },
+ {
+ command='py3file',
+ flags=bit.bor(RANGE, FILE1, NEEDARG, CMDWIN),
+ func='ex_ni',
+ },
+ {
command='quit',
flags=bit.bor(BANG, TRLBAR, CMDWIN),
func='ex_quit',
@@ -1726,6 +1781,21 @@ return {
func='ex_rundo',
},
{
+ command='ruby',
+ flags=bit.bor(RANGE, EXTRA, NEEDARG, CMDWIN),
+ func='ex_script_ni',
+ },
+ {
+ command='rubydo',
+ flags=bit.bor(RANGE, DFLALL, EXTRA, NEEDARG, CMDWIN),
+ func='ex_ni',
+ },
+ {
+ command='rubyfile',
+ flags=bit.bor(RANGE, FILE1, NEEDARG, CMDWIN),
+ func='ex_ni',
+ },
+ {
command='rviminfo',
flags=bit.bor(BANG, FILE1, TRLBAR, CMDWIN),
func='ex_viminfo',
@@ -2151,6 +2221,21 @@ return {
func='ex_tabs',
},
{
+ command='tcl',
+ flags=bit.bor(RANGE,EXTRA,NEEDARG,CMDWIN),
+ func='ex_script_ni',
+ },
+ {
+ command='tcldo',
+ flags=bit.bor(RANGE,DFLALL,EXTRA,NEEDARG,CMDWIN),
+ func='ex_ni',
+ },
+ {
+ command='tclfile',
+ flags=bit.bor(RANGE,FILE1,NEEDARG,CMDWIN),
+ func='ex_ni',
+ },
+ {
command='tearoff',
flags=bit.bor(NEEDARG, EXTRA, TRLBAR, NOTRLCOM, CMDWIN),
func='ex_tearoff',
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 359c4b31d1..ca79270fcc 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -138,7 +138,6 @@ struct dbg_stuff {
# include "ex_docmd.c.generated.h"
#endif
-# define HAVE_EX_SCRIPT_NI
# define ex_gui ex_nogui
# define ex_tearoff ex_ni
# define ex_popup ex_ni
@@ -1494,9 +1493,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
ni = (!IS_USER_CMDIDX(ea.cmdidx)
&& (cmdnames[ea.cmdidx].cmd_func == ex_ni
-#ifdef HAVE_EX_SCRIPT_NI
|| cmdnames[ea.cmdidx].cmd_func == ex_script_ni
-#endif
));
@@ -1832,19 +1829,26 @@ static char_u * do_one_cmd(char_u **cmdlinep,
case CMD_leftabove:
case CMD_let:
case CMD_lockmarks:
+ case CMD_lua:
case CMD_match:
+ case CMD_mzscheme:
case CMD_noautocmd:
case CMD_noswapfile:
+ case CMD_perl:
case CMD_psearch:
case CMD_python:
+ case CMD_py3:
+ case CMD_python3:
case CMD_return:
case CMD_rightbelow:
+ case CMD_ruby:
case CMD_silent:
case CMD_smagic:
case CMD_snomagic:
case CMD_substitute:
case CMD_syntax:
case CMD_tab:
+ case CMD_tcl:
case CMD_throw:
case CMD_tilde:
case CMD_topleft:
@@ -1854,7 +1858,8 @@ static char_u * do_one_cmd(char_u **cmdlinep,
case CMD_wincmd:
break;
- default: goto doend;
+ default:
+ goto doend;
}
}
@@ -3291,9 +3296,7 @@ static void get_flags(exarg_T *eap)
}
}
-/*
- * Function called for command which is Not Implemented. NI!
- */
+/// Stub function for command which is Not Implemented. NI!
void ex_ni(exarg_T *eap)
{
if (!eap->skip)
@@ -3301,11 +3304,8 @@ void ex_ni(exarg_T *eap)
"E319: Sorry, the command is not available in this version");
}
-#ifdef HAVE_EX_SCRIPT_NI
-/*
- * Function called for script command which is Not Implemented. NI!
- * Skips over ":perl <<EOF" constructs.
- */
+/// Stub function for script command which is Not Implemented. NI!
+/// Skips over ":perl <<EOF" constructs.
static void ex_script_ni(exarg_T *eap)
{
if (!eap->skip)
@@ -3313,7 +3313,6 @@ static void ex_script_ni(exarg_T *eap)
else
free(script_get(eap, eap->arg));
}
-#endif
/*
* Check range in Ex command for validity.
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 324171aca2..855c09619e 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -5738,7 +5738,18 @@ next_search_hl (
shl->lnum = lnum;
if (shl->rm.regprog != NULL) {
+ /* Remember whether shl->rm is using a copy of the regprog in
+ * cur->match. */
+ bool regprog_is_copy = (shl != &search_hl
+ && cur != NULL
+ && shl == &cur->hl
+ && cur->match.regprog == cur->hl.rm.regprog);
+
nmatched = vim_regexec_multi(&shl->rm, win, shl->buf, lnum, matchcol, &(shl->tm));
+ /* Copy the regprog, in case it got freed and recompiled. */
+ if (regprog_is_copy) {
+ cur->match.regprog = cur->hl.rm.regprog;
+ }
if (called_emsg || got_int) {
// Error while handling regexp: stop using this regexp.
if (shl == &search_hl) {
diff --git a/src/nvim/testdir/test55.in b/src/nvim/testdir/test55.in
index 140cb7c0e5..c4e82d429c 100644
--- a/src/nvim/testdir/test55.in
+++ b/src/nvim/testdir/test55.in
@@ -401,6 +401,11 @@ let l = [0, 1, 2, 3]
: $put =v:exception[:15] . v:exception[-1:-1]
:endtry
:$put =string(d)
+:"
+:" test for range assign
+:let l = [0]
+:let l[:] = [1, 2]
+:$put =string(l)
:endfun
:"
:call Test(1, 2, [3, 4], {5: 6}) " This may take a while
diff --git a/src/nvim/testdir/test55.ok b/src/nvim/testdir/test55.ok
index e8560de401..ba029b2898 100644
--- a/src/nvim/testdir/test55.ok
+++ b/src/nvim/testdir/test55.ok
@@ -129,6 +129,7 @@ caught a:000[3]
{'a': {'b': 'B'}}
Vim(call):E737: a
{'a': {'b': 'B'}}
+[1, 2]
Vim(foldopen):E490:
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 454afcb55d..513b03095b 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -178,7 +178,7 @@ static char *(features[]) = {
};
static int included_patches[] = {
- //560,
+ //560 NA
//559,
//558 NA
//557 NA
@@ -197,7 +197,7 @@ static int included_patches[] = {
//544 NA
543,
//542,
- //541,
+ 541,
//540 NA
//539,
538,
@@ -205,12 +205,12 @@ static int included_patches[] = {
536,
//535,
//534 NA
- //533,
+ 533,
//532,
//531,
//530,
//529,
- //528,
+ 528,
527,
//526,
//525,
@@ -229,7 +229,7 @@ static int included_patches[] = {
//512 NA
//511 NA
//510 NA
- //509,
+ //509 NA
508,
//507 NA
//506 NA
@@ -251,7 +251,7 @@ static int included_patches[] = {
//490,
489,
488,
- //487,
+ 487,
486,
485,
//484 NA
@@ -294,7 +294,7 @@ static int included_patches[] = {
//446,
//445,
444,
- //443,
+ //443 NA
442,
441,
440,
@@ -335,7 +335,7 @@ static int included_patches[] = {
405,
//404 NA
//403 NA
- //402,
+ //402 NA
//401 NA
//400 NA
//399 NA
@@ -526,7 +526,7 @@ static int included_patches[] = {
//214 NA
213,
//212 NA
- //211,
+ 211,
210,
209,
//208 NA
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 1a102cf069..ed4a8d8e7a 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -3543,27 +3543,28 @@ static void win_enter_ext(win_T *wp, bool undo_sync, int curwin_invalid, int tri
}
-/*
- * Jump to the first open window that contains buffer "buf", if one exists.
- * Returns a pointer to the window found, otherwise NULL.
- */
+/// Jump to the first open window that contains buffer "buf", if one exists.
+/// Returns a pointer to the window found, otherwise NULL.
win_T *buf_jump_open_win(buf_T *buf)
{
- FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
- if (wp->w_buffer == buf) {
- win_enter(wp, false);
- return wp;
+ if (curwin->w_buffer == buf) {
+ win_enter(curwin, false);
+ return curwin;
+ } else {
+ FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
+ if (wp->w_buffer == buf) {
+ win_enter(wp, false);
+ return wp;
+ }
}
}
return NULL;
}
-/*
- * Jump to the first open window in any tab page that contains buffer "buf",
- * if one exists.
- * Returns a pointer to the window found, otherwise NULL.
- */
+/// Jump to the first open window in any tab page that contains buffer "buf",
+/// if one exists.
+/// @return the found window, or NULL.
win_T *buf_jump_open_tab(buf_T *buf)
{
diff --git a/test/functional/legacy/signs_spec.lua b/test/functional/legacy/signs_spec.lua
new file mode 100644
index 0000000000..89b2bf3b73
--- /dev/null
+++ b/test/functional/legacy/signs_spec.lua
@@ -0,0 +1,24 @@
+-- Tests for signs
+
+local helpers = require('test.functional.helpers')
+local feed, insert, source = helpers.feed, helpers.insert, helpers.source
+local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
+
+describe('signs', function()
+ setup(clear)
+
+ it('is working', function()
+ execute('sign define JumpSign text=x')
+ execute([[exe 'sign place 42 line=2 name=JumpSign buffer=' . bufnr('')]])
+ -- Split the window to the bottom to verify :sign-jump will stay in the current
+ -- window if the buffer is displayed there.
+ execute('bot split')
+ execute([[exe 'sign jump 42 buffer=' . bufnr('')]])
+ execute([[call append(line('$'), winnr())]])
+
+ -- Assert buffer contents.
+ expect([[
+
+ 2]])
+ end)
+end)