Patch 8.1.2113

23 views
Skip to first unread message

Bram Moolenaar

unread,
Oct 5, 2019, 5:58:00 AM10/5/19
to vim...@googlegroups.com

Patch 8.1.2113
Problem: ":help expr-!~?" only works after searching.
Solution: Escape "~" after "expr-". (closes #5015)
Files: src/ex_cmds.c, src/testdir/test_help.vim


*** ../vim-8.1.2112/src/ex_cmds.c 2019-10-01 12:10:19.951160320 +0200
--- src/ex_cmds.c 2019-10-05 11:28:09.056083506 +0200
***************
*** 5547,5558 ****
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;
}
}
--- 5547,5568 ----
if (STRNICMP(arg, "expr-", 5) == 0)
{
// When the string starting with "expr-" and containing '?' and matches
! // the table, it is taken literally (but ~ is escaped). Otherwise '?'
! // is recognized as a wildcard.
for (i = (int)(sizeof(expr_table) / sizeof(char *)); --i >= 0; )
if (STRCMP(arg + 5, expr_table[i]) == 0)
{
! int si = 0, di = 0;
!
! for (;;)
! {
! if (arg[si] == '~')
! d[di++] = '\\';
! d[di++] = arg[si];
! if (arg[si] == NUL)
! break;
! ++si;
! }
break;
}
}
*** ../vim-8.1.2112/src/testdir/test_help.vim 2017-12-09 20:53:57.000000000 +0100
--- src/testdir/test_help.vim 2019-10-05 11:27:27.200318812 +0200
***************
*** 20,25 ****
--- 20,31 ----
bwipe!
endfunc

+ func Test_help_expr()
+ help expr-!~?
+ call assert_equal('eval.txt', expand('%:t'))
+ close
+ endfunc
+
func Test_help_keyword()
new
set keywordprg=:help
*** ../vim-8.1.2112/src/version.c 2019-10-04 21:29:01.748385911 +0200
--- src/version.c 2019-10-05 11:28:44.603883331 +0200
***************
*** 755,756 ****
--- 755,758 ----
{ /* Add new patch number below this line */
+ /**/
+ 2113,
/**/

--
Michael: There is no such thing as a dump question.
Bernard: Sure there is. For example "what is a core dump?"

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Tony Mechelynck

unread,
Oct 6, 2019, 12:29:04 AM10/6/19
to vim_dev
On Sat, Oct 5, 2019 at 11:57 AM Bram Moolenaar <Br...@moolenaar.net> wrote:
>
>
> Patch 8.1.2113
> Problem: ":help expr-!~?" only works after searching.
> Solution: Escape "~" after "expr-". (closes #5015)
> Files: src/ex_cmds.c, src/testdir/test_help.vim

Strangely enough, in Vim 8.1.2117 (with GTK2 GUI on openSUSE Linux),
":help expr-!~?" and ":help expr-=~?" when issued immediately after
Vim startup without any searching, go to the help for expr-!~# and
expr-=~# respectively, which head the same help text through a
different tag. Is this intended?

Best regards,
Tony.

Bram Moolenaar

unread,
Oct 6, 2019, 6:16:00 AM10/6/19
to vim...@googlegroups.com, Tony Mechelynck
I cannot reproduce this, goes to the expected tag.

--
TIM: But follow only if you are men of valour. For the entrance to this cave
is guarded by a monster, a creature so foul and cruel that no man yet has
fought with it and lived. Bones of full fifty men lie strewn about its
lair ...
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

Tony Mechelynck

unread,
Oct 6, 2019, 12:12:52 PM10/6/19
to Bram Moolenaar, vim_dev
On Sun, Oct 6, 2019 at 12:15 PM Bram Moolenaar <Br...@moolenaar.net> wrote:
>
>
> Tony wrote:
>
> > On Sat, Oct 5, 2019 at 11:57 AM Bram Moolenaar <Br...@moolenaar.net> wrote:
> > >
> > >
> > > Patch 8.1.2113
> > > Problem: ":help expr-!~?" only works after searching.
> > > Solution: Escape "~" after "expr-". (closes #5015)
> > > Files: src/ex_cmds.c, src/testdir/test_help.vim
> >
> > Strangely enough, in Vim 8.1.2117 (with GTK2 GUI on openSUSE Linux),
> > ":help expr-!~?" and ":help expr-=~?" when issued immediately after
> > Vim startup without any searching, go to the help for expr-!~# and
> > expr-=~# respectively, which head the same help text through a
> > different tag. Is this intended?
>
> I cannot reproduce this, goes to the expected tag.

I think I got it.

:help =~?<C-D> finds both expr-=~# and expr-=~? in that order (thus
with <Enter> instead of Ctrl-D it find the one with #). But for a full
match (with the leading expr-) it finds only the right match (with
explicit ?).

Sorry for erroneous reporting. Not much of a problem anyway since both
go to the same help text. But I still find it weird that it gets a
short match (with ? matching #, treating the ? as a wildcard maybe) in
preference to an exact match (with ? matching ?). Note that if I try
to "escape the wildcard" by typing :h =~\? I get E149: Sorry, no help
for =~\?

Best regards,
Tony.
Reply all
Reply to author
Forward
0 new messages