mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 13:38:34 +00:00
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:
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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
|
||||||
|
Reference in New Issue
Block a user