Skip to content

Commit d1e492c

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 47e77c3 + 3bf5e6a commit d1e492c

File tree

5 files changed

+78
-22
lines changed

5 files changed

+78
-22
lines changed

src/ex_cmds.c

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6583,7 +6583,8 @@ find_help_tags(
65836583
static char *(mtable[]) = {"*", "g*", "[*", "]*", ":*",
65846584
"/*", "/\\*", "\"*", "**",
65856585
"cpo-*", "/\\(\\)", "/\\%(\\)",
6586-
"?", ":?", "-?", "?<CR>", "g?", "g?g?", "g??",
6586+
"?", ":?", "?<CR>", "g?", "g?g?", "g??",
6587+
"-?", "q?", "v_g?",
65876588
"/\\?", "/\\z(\\)", "\\=", ":s\\=",
65886589
"[count]", "[quotex]",
65896590
"[range]", ":[range]",
@@ -6593,27 +6594,43 @@ find_help_tags(
65936594
static char *(rtable[]) = {"star", "gstar", "[star", "]star", ":star",
65946595
"/star", "/\\\\star", "quotestar", "starstar",
65956596
"cpo-star", "/\\\\(\\\\)", "/\\\\%(\\\\)",
6596-
"?", ":?", "-?", "?<CR>", "g?", "g?g?", "g??",
6597+
"?", ":?", "?<CR>", "g?", "g?g?", "g??",
6598+
"-?", "q?", "v_g?",
65976599
"/\\\\?", "/\\\\z(\\\\)", "\\\\=", ":s\\\\=",
65986600
"\\[count]", "\\[quotex]",
65996601
"\\[range]", ":\\[range]",
66006602
"\\[pattern]", "\\\\bar", "/\\\\%\\$",
66016603
"s/\\\\\\~", "s/\\\\U", "s/\\\\L",
66026604
"s/\\\\1", "s/\\\\2", "s/\\\\3", "s/\\\\9"};
6605+
static char *(expr_table[]) = {"!=?", "!~?", "<=?", "<?", "==?", "=~?",
6606+
">=?", ">?", "is?", "isnot?"};
66036607
int flags;
66046608

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

6607-
/*
6608-
* Recognize a few exceptions to the rule. Some strings that contain '*'
6609-
* with "star". Otherwise '*' is recognized as a wildcard.
6610-
*/
6611-
for (i = (int)(sizeof(mtable) / sizeof(char *)); --i >= 0; )
6612-
if (STRCMP(arg, mtable[i]) == 0)
6613-
{
6614-
STRCPY(d, rtable[i]);
6615-
break;
6616-
}
6611+
if (STRNICMP(arg, "expr-", 5) == 0)
6612+
{
6613+
// When the string starting with "expr-" and containing '?' and matches
6614+
// the table, it is taken literally. Otherwise '?' is recognized as a
6615+
// wildcard.
6616+
for (i = (int)(sizeof(expr_table) / sizeof(char *)); --i >= 0; )
6617+
if (STRCMP(arg + 5, expr_table[i]) == 0)
6618+
{
6619+
STRCPY(d, arg);
6620+
break;
6621+
}
6622+
}
6623+
else
6624+
{
6625+
// Recognize a few exceptions to the rule. Some strings that contain
6626+
// '*' with "star". Otherwise '*' is recognized as a wildcard.
6627+
for (i = (int)(sizeof(mtable) / sizeof(char *)); --i >= 0; )
6628+
if (STRCMP(arg, mtable[i]) == 0)
6629+
{
6630+
STRCPY(d, rtable[i]);
6631+
break;
6632+
}
6633+
}
66176634

66186635
if (i < 0) /* no match in table */
66196636
{

src/if_perl.xs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -831,8 +831,7 @@ newWINrv(SV *rv, win_T *ptr)
831831
ptr->w_perl_private = newSV(0);
832832
sv_setiv(ptr->w_perl_private, PTR2IV(ptr));
833833
}
834-
else
835-
SvREFCNT_inc_void_NN(ptr->w_perl_private);
834+
SvREFCNT_inc_void_NN(ptr->w_perl_private);
836835
SvRV(rv) = ptr->w_perl_private;
837836
SvROK_on(rv);
838837
return sv_bless(rv, gv_stashpv("VIWIN", TRUE));
@@ -847,8 +846,7 @@ newBUFrv(SV *rv, buf_T *ptr)
847846
ptr->b_perl_private = newSV(0);
848847
sv_setiv(ptr->b_perl_private, PTR2IV(ptr));
849848
}
850-
else
851-
SvREFCNT_inc_void_NN(ptr->b_perl_private);
849+
SvREFCNT_inc_void_NN(ptr->b_perl_private);
852850
SvRV(rv) = ptr->b_perl_private;
853851
SvROK_on(rv);
854852
return sv_bless(rv, gv_stashpv("VIBUF", TRUE));
@@ -918,12 +916,13 @@ I32 cur_val(IV iv, SV *sv)
918916
else
919917
rv = newBUFrv(newSV(0), curbuf);
920918

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

924+
SvREFCNT_dec(rv);
925+
927926
return 0;
928927
}
929928
#endif /* !PROTO */

src/testdir/test_help_tagjump.vim

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,34 @@ func Test_help_tagjump()
2626
call assert_true(getline('.') =~ '\*:?\*')
2727
helpclose
2828

29+
help q?
30+
call assert_equal("help", &filetype)
31+
call assert_true(getline('.') =~ '\*q?\*')
32+
call assert_true(expand('<cword>') == 'q?')
33+
helpclose
34+
2935
help -?
3036
call assert_equal("help", &filetype)
3137
call assert_true(getline('.') =~ '\*-?\*')
3238
helpclose
3339

40+
help v_g?
41+
call assert_equal("help", &filetype)
42+
call assert_true(getline('.') =~ '\*v_g?\*')
43+
helpclose
44+
45+
help expr-!=?
46+
call assert_equal("help", &filetype)
47+
call assert_true(getline('.') =~ '\*expr-!=?\*')
48+
call assert_true(expand('<cword>') == 'expr-!=?')
49+
helpclose
50+
51+
help expr-isnot?
52+
call assert_equal("help", &filetype)
53+
call assert_true(getline('.') =~ '\*expr-isnot?\*')
54+
call assert_true(expand('<cword>') == 'expr-isnot?')
55+
helpclose
56+
3457
help FileW*Post
3558
call assert_equal("help", &filetype)
3659
call assert_true(getline('.') =~ '\*FileWritePost\*')

src/testdir/test_perl.vim

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ if !has('perl')
44
finish
55
end
66

7+
" FIXME: RunTest don't see any error when Perl abort...
8+
perl $SIG{__WARN__} = sub { die "Unexpected warnings from perl: @_" };
9+
710
func Test_change_buffer()
811
call setline(line('$'), ['1 line 1'])
912
perl VIM::DoCommand("normal /^1\n")
@@ -229,6 +232,15 @@ func Test_000_SvREFCNT()
229232
#line 5 "Test_000_SvREFCNT()"
230233
my ($b, $w);
231234

235+
my $num = 0;
236+
for ( 0 .. 100 ) {
237+
if ( ++$num >= 8 ) { $num = 0 }
238+
VIM::DoCommand("buffer X$num");
239+
$b = $curbuf;
240+
}
241+
242+
VIM::DoCommand("buffer t");
243+
232244
$b = $curbuf for 0 .. 100;
233245
$w = $curwin for 0 .. 100;
234246
() = VIM::Buffers for 0 .. 100;
@@ -240,12 +252,13 @@ func Test_000_SvREFCNT()
240252
my $cw = Internals::SvREFCNT($$w);
241253
VIM::Eval("assert_equal(2, $cb, 'T1')");
242254
VIM::Eval("assert_equal(2, $cw, 'T2')");
255+
my $strongref;
243256
foreach ( VIM::Buffers, VIM::Windows ) {
257+
VIM::DoCommand("%bw!");
244258
my $c = Internals::SvREFCNT($_);
245259
VIM::Eval("assert_equal(2, $c, 'T3')");
246260
$c = Internals::SvREFCNT($$_);
247-
# Why only one ref?
248-
# Look wrong but work. Maybe not portable...
261+
next if $c == 2 && !$strongref++;
249262
VIM::Eval("assert_equal(1, $c, 'T4')");
250263
}
251264
$cb = Internals::SvREFCNT($$curbuf);

src/version.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,10 @@ static char *(features[]) =
809809

810810
static int included_patches[] =
811811
{ /* Add new patch number below this line */
812+
/**/
813+
235,
814+
/**/
815+
234,
812816
/**/
813817
233,
814818
/**/

0 commit comments

Comments
 (0)