patch 9.2.1230: pattern address with delimiter in collection not skipped
Problem: Commands with a pattern address containing the delimiter in a
collection fail (after v7.4.530).
Solution: Skip the delimiter when it appears in a pattern collection
(Doug Kearns).
closes: #21554
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
1 parent
04de8d641f
commit
d0ca86c2e2
3 files changed
+21
-5
No files matched your search
+1
-5
@@ -4451,7 +4451,6 @@ skip_range(
|
||||
int *ctx) // pointer to xp_context or NULL
|
||||
{
|
||||
char_u *cmd = cmd_start;
|
||||
unsigned delim;
|
||||
|
||||
while (vim_strchr((char_u *)" \t0123456789.$%'/?-+,;\\", *cmd) != NULL)
|
||||
{
|
||||
@@ -4480,10 +4479,7 @@ skip_range(
|
||||
}
|
||||
else if (*cmd == '/' || *cmd == '?')
|
||||
{
|
||||
delim = *cmd++;
|
||||
while (*cmd != NUL && *cmd != delim)
|
||||
if (*cmd++ == '\\' && *cmd != NUL)
|
||||
++cmd;
|
||||
cmd = skip_regexp(cmd + 1, *cmd, magic_isset());
|
||||
if (*cmd == NUL && ctx != NULL)
|
||||
*ctx = EXPAND_NOTHING;
|
||||
}
|
||||
|
||||
@@ -1545,6 +1545,12 @@ func Test_cmdline_complete_various()
|
||||
call feedkeys(":1,2\"\<C-A>\<C-B>\"\<CR>", 'xt')
|
||||
call assert_equal("\"1,2\"\<C-A>", @:)
|
||||
|
||||
" completion for command after a pattern address (containing delimiter)
|
||||
call feedkeys(":/foo[/]bar\\/baz/num\<C-A>\<C-B>\"\<CR>", 'xt')
|
||||
call assert_equal("\"/foo[/]bar\\/baz/number", @:)
|
||||
call feedkeys(":?foo[?]bar\\?baz?num\<C-A>\<C-B>\"\<CR>", 'xt')
|
||||
call assert_equal("\"?foo[?]bar\\?baz?number", @:)
|
||||
|
||||
" completion for :k command
|
||||
call feedkeys(":ka\<C-A>\<C-B>\"\<CR>", 'xt')
|
||||
call assert_equal("\"ka\<C-A>", @:)
|
||||
@@ -2684,6 +2690,18 @@ func Test_zero_line_search()
|
||||
q!
|
||||
endfunc
|
||||
|
||||
func Test_pattern_address_with_command()
|
||||
new
|
||||
call setline(1, ["one", "two - foo/bar/baz", "three - foo?bar?baz", "four"])
|
||||
call cursor(1, 1)
|
||||
:/foo[/]bar\/baz/print
|
||||
call assert_equal("two - foo/bar/baz", getline('.'))
|
||||
call cursor("$", 1)
|
||||
:?foo[?]bar\?baz?print
|
||||
call assert_equal("three - foo?bar?baz", getline('.'))
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_read_shellcmd()
|
||||
CheckUnix
|
||||
if executable('ls')
|
||||
|
||||
@@ -743,6 +743,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1230,
|
||||
/**/
|
||||
1229,
|
||||
/**/
|
||||
|
||||
Reference in new issue
Block a user