vim-patch:8.1.2113: ":help expr-!~?" only works after searching

Problem:    ":help expr-!~?" only works after searching.
Solution:   Escape "~" after "expr-". (closes vim/vim#5015)
9ca250855b
This commit is contained in:
Jan Edmund Lazo
2019-10-05 11:01:37 -04:00
parent 402afb0895
commit 5581ffac74
2 changed files with 17 additions and 3 deletions

View File

@@ -4739,11 +4739,19 @@ int find_help_tags(const char_u *arg, int *num_matches, char_u ***matches,
if (STRNICMP(arg, "expr-", 5) == 0) { if (STRNICMP(arg, "expr-", 5) == 0) {
// When the string starting with "expr-" and containing '?' and matches // When the string starting with "expr-" and containing '?' and matches
// the table, it is taken literally. Otherwise '?' is recognized as a // the table, it is taken literally (but ~ is escaped). Otherwise '?'
// wildcard. // is recognized as a wildcard.
for (i = (int)ARRAY_SIZE(expr_table); --i >= 0; ) { for (i = (int)ARRAY_SIZE(expr_table); --i >= 0; ) {
if (STRCMP(arg + 5, expr_table[i]) == 0) { if (STRCMP(arg + 5, expr_table[i]) == 0) {
STRCPY(d, arg); for (int si = 0, di = 0; ; si++) {
if (arg[si] == '~') {
d[di++] = '\\';
}
d[di++] = arg[si];
if (arg[si] == NUL) {
break;
}
}
break; break;
} }
} }

View File

@@ -21,6 +21,12 @@ func Test_help_errors()
bwipe! bwipe!
endfunc endfunc
func Test_help_expr()
help expr-!~?
call assert_equal('eval.txt', expand('%:t'))
close
endfunc
func Test_help_keyword() func Test_help_keyword()
new new
set keywordprg=:help set keywordprg=:help