Skip to content

Commit

Permalink
Merge remote-tracking branch 'vim/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
splhack committed Aug 3, 2018
2 parents 47e77c3 + 3bf5e6a commit d1e492c
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 22 deletions.
41 changes: 29 additions & 12 deletions src/ex_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -6583,7 +6583,8 @@ find_help_tags(
static char *(mtable[]) = {"*", "g*", "[*", "]*", ":*",
"/*", "/\\*", "\"*", "**",
"cpo-*", "/\\(\\)", "/\\%(\\)",
"?", ":?", "-?", "?<CR>", "g?", "g?g?", "g??",
"?", ":?", "?<CR>", "g?", "g?g?", "g??",
"-?", "q?", "v_g?",
"/\\?", "/\\z(\\)", "\\=", ":s\\=",
"[count]", "[quotex]",
"[range]", ":[range]",
Expand All @@ -6593,27 +6594,43 @@ find_help_tags(
static char *(rtable[]) = {"star", "gstar", "[star", "]star", ":star",
"/star", "/\\\\star", "quotestar", "starstar",
"cpo-star", "/\\\\(\\\\)", "/\\\\%(\\\\)",
"?", ":?", "-?", "?<CR>", "g?", "g?g?", "g??",
"?", ":?", "?<CR>", "g?", "g?g?", "g??",
"-?", "q?", "v_g?",
"/\\\\?", "/\\\\z(\\\\)", "\\\\=", ":s\\\\=",
"\\[count]", "\\[quotex]",
"\\[range]", ":\\[range]",
"\\[pattern]", "\\\\bar", "/\\\\%\\$",
"s/\\\\\\~", "s/\\\\U", "s/\\\\L",
"s/\\\\1", "s/\\\\2", "s/\\\\3", "s/\\\\9"};
static char *(expr_table[]) = {"!=?", "!~?", "<=?", "<?", "==?", "=~?",
">=?", ">?", "is?", "isnot?"};
int flags;

d = IObuff; /* assume IObuff is long enough! */

/*
* Recognize a few exceptions to the rule. Some strings that contain '*'
* with "star". Otherwise '*' is recognized as a wildcard.
*/
for (i = (int)(sizeof(mtable) / sizeof(char *)); --i >= 0; )
if (STRCMP(arg, mtable[i]) == 0)
{
STRCPY(d, rtable[i]);
break;
}
if (STRNICMP(arg, "expr-", 5) == 0)
{
// When the string starting with "expr-" and containing '?' and matches
// the table, it is taken literally. Otherwise '?' is recognized as a
// wildcard.
for (i = (int)(sizeof(expr_table) / sizeof(char *)); --i >= 0; )
if (STRCMP(arg + 5, expr_table[i]) == 0)
{
STRCPY(d, arg);
break;
}
}
else
{
// Recognize a few exceptions to the rule. Some strings that contain
// '*' with "star". Otherwise '*' is recognized as a wildcard.
for (i = (int)(sizeof(mtable) / sizeof(char *)); --i >= 0; )
if (STRCMP(arg, mtable[i]) == 0)
{
STRCPY(d, rtable[i]);
break;
}
}

if (i < 0) /* no match in table */
{
Expand Down
15 changes: 7 additions & 8 deletions src/if_perl.xs
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,7 @@ newWINrv(SV *rv, win_T *ptr)
ptr->w_perl_private = newSV(0);
sv_setiv(ptr->w_perl_private, PTR2IV(ptr));
}
else
SvREFCNT_inc_void_NN(ptr->w_perl_private);
SvREFCNT_inc_void_NN(ptr->w_perl_private);
SvRV(rv) = ptr->w_perl_private;
SvROK_on(rv);
return sv_bless(rv, gv_stashpv("VIWIN", TRUE));
Expand All @@ -847,8 +846,7 @@ newBUFrv(SV *rv, buf_T *ptr)
ptr->b_perl_private = newSV(0);
sv_setiv(ptr->b_perl_private, PTR2IV(ptr));
}
else
SvREFCNT_inc_void_NN(ptr->b_perl_private);
SvREFCNT_inc_void_NN(ptr->b_perl_private);
SvRV(rv) = ptr->b_perl_private;
SvROK_on(rv);
return sv_bless(rv, gv_stashpv("VIBUF", TRUE));
Expand Down Expand Up @@ -918,12 +916,13 @@ I32 cur_val(IV iv, SV *sv)
else
rv = newBUFrv(newSV(0), curbuf);

if (SvRV(sv) == SvRV(rv))
SvREFCNT_dec(SvRV(rv));
else // XXX: Not sure if the `else` condition are right
// Test_SvREFCNT() pass in all case.
if (SvRV(sv) != SvRV(rv))
// XXX: This magic variable is a bit confusing...
// Is curently refcounted ?
sv_setsv(sv, rv);

SvREFCNT_dec(rv);

return 0;
}
#endif /* !PROTO */
Expand Down
23 changes: 23 additions & 0 deletions src/testdir/test_help_tagjump.vim
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,34 @@ func Test_help_tagjump()
call assert_true(getline('.') =~ '\*:?\*')
helpclose

help q?
call assert_equal("help", &filetype)
call assert_true(getline('.') =~ '\*q?\*')
call assert_true(expand('<cword>') == 'q?')
helpclose

help -?
call assert_equal("help", &filetype)
call assert_true(getline('.') =~ '\*-?\*')
helpclose

help v_g?
call assert_equal("help", &filetype)
call assert_true(getline('.') =~ '\*v_g?\*')
helpclose

help expr-!=?
call assert_equal("help", &filetype)
call assert_true(getline('.') =~ '\*expr-!=?\*')
call assert_true(expand('<cword>') == 'expr-!=?')
helpclose

help expr-isnot?
call assert_equal("help", &filetype)
call assert_true(getline('.') =~ '\*expr-isnot?\*')
call assert_true(expand('<cword>') == 'expr-isnot?')
helpclose

help FileW*Post
call assert_equal("help", &filetype)
call assert_true(getline('.') =~ '\*FileWritePost\*')
Expand Down
17 changes: 15 additions & 2 deletions src/testdir/test_perl.vim
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ if !has('perl')
finish
end

" FIXME: RunTest don't see any error when Perl abort...
perl $SIG{__WARN__} = sub { die "Unexpected warnings from perl: @_" };

func Test_change_buffer()
call setline(line('$'), ['1 line 1'])
perl VIM::DoCommand("normal /^1\n")
Expand Down Expand Up @@ -229,6 +232,15 @@ func Test_000_SvREFCNT()
#line 5 "Test_000_SvREFCNT()"
my ($b, $w);

my $num = 0;
for ( 0 .. 100 ) {
if ( ++$num >= 8 ) { $num = 0 }
VIM::DoCommand("buffer X$num");
$b = $curbuf;
}

VIM::DoCommand("buffer t");

$b = $curbuf for 0 .. 100;
$w = $curwin for 0 .. 100;
() = VIM::Buffers for 0 .. 100;
Expand All @@ -240,12 +252,13 @@ func Test_000_SvREFCNT()
my $cw = Internals::SvREFCNT($$w);
VIM::Eval("assert_equal(2, $cb, 'T1')");
VIM::Eval("assert_equal(2, $cw, 'T2')");
my $strongref;
foreach ( VIM::Buffers, VIM::Windows ) {
VIM::DoCommand("%bw!");
my $c = Internals::SvREFCNT($_);
VIM::Eval("assert_equal(2, $c, 'T3')");
$c = Internals::SvREFCNT($$_);
# Why only one ref?
# Look wrong but work. Maybe not portable...
next if $c == 2 && !$strongref++;
VIM::Eval("assert_equal(1, $c, 'T4')");
}
$cb = Internals::SvREFCNT($$curbuf);
Expand Down
4 changes: 4 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,10 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
235,
/**/
234,
/**/
233,
/**/
Expand Down

0 comments on commit d1e492c

Please sign in to comment.