diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-10-05 11:01:37 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-10-05 11:17:30 -0400 |
commit | 5581ffac740d4a75809c6395da4ab757b8d7e6c8 (patch) | |
tree | 15bd43d9bec9112443003cb8d2d857133e7ac9f1 /src | |
parent | 402afb08959c353a50e040dd0bdcc7cd7aa73041 (diff) | |
download | rneovim-5581ffac740d4a75809c6395da4ab757b8d7e6c8.tar.gz rneovim-5581ffac740d4a75809c6395da4ab757b8d7e6c8.tar.bz2 rneovim-5581ffac740d4a75809c6395da4ab757b8d7e6c8.zip |
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)
https://github.com/vim/vim/commit/9ca250855b55f4d3292b010525c827dc6992cb61
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_cmds.c | 14 | ||||
-rw-r--r-- | src/nvim/testdir/test_help.vim | 6 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 16487ce447..d7ae522f32 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -4739,11 +4739,19 @@ int find_help_tags(const char_u *arg, int *num_matches, char_u ***matches, 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. + // the table, it is taken literally (but ~ is escaped). Otherwise '?' + // is recognized as a wildcard. for (i = (int)ARRAY_SIZE(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; } } diff --git a/src/nvim/testdir/test_help.vim b/src/nvim/testdir/test_help.vim index ed3181564c..01fb9917e9 100644 --- a/src/nvim/testdir/test_help.vim +++ b/src/nvim/testdir/test_help.vim @@ -21,6 +21,12 @@ func Test_help_errors() 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 |