forked from aniani/vim
patch 8.0.0298: Ex command range with repeated search does not work
Problem: Ex command range with repeated search does not work. (Bruce DeVisser) Solution: Skip over \/, \? and \&.
This commit is contained in:
parent
03ff9bcbc9
commit
cbf20fbcd3
@ -4357,9 +4357,16 @@ skip_range(
|
|||||||
{
|
{
|
||||||
unsigned delim;
|
unsigned delim;
|
||||||
|
|
||||||
while (vim_strchr((char_u *)" \t0123456789.$%'/?-+,;", *cmd) != NULL)
|
while (vim_strchr((char_u *)" \t0123456789.$%'/?-+,;\\", *cmd) != NULL)
|
||||||
{
|
{
|
||||||
if (*cmd == '\'')
|
if (*cmd == '\\')
|
||||||
|
{
|
||||||
|
if (cmd[1] == '?' || cmd[1] == '/' || cmd[1] == '&')
|
||||||
|
++cmd;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (*cmd == '\'')
|
||||||
{
|
{
|
||||||
if (*++cmd == NUL && ctx != NULL)
|
if (*++cmd == NUL && ctx != NULL)
|
||||||
*ctx = EXPAND_NOTHING;
|
*ctx = EXPAND_NOTHING;
|
||||||
|
@ -306,3 +306,28 @@ func Test_cmdline_complete_wildoptions()
|
|||||||
call assert_equal(a, b)
|
call assert_equal(a, b)
|
||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" using a leading backslash here
|
||||||
|
set cpo+=C
|
||||||
|
|
||||||
|
func Test_cmdline_search_range()
|
||||||
|
new
|
||||||
|
call setline(1, ['a', 'b', 'c', 'd'])
|
||||||
|
/d
|
||||||
|
1,\/s/b/B/
|
||||||
|
call assert_equal('B', getline(2))
|
||||||
|
|
||||||
|
/a
|
||||||
|
$
|
||||||
|
\?,4s/c/C/
|
||||||
|
call assert_equal('C', getline(3))
|
||||||
|
|
||||||
|
call setline(1, ['a', 'b', 'c', 'd'])
|
||||||
|
%s/c/c/
|
||||||
|
1,\&s/b/B/
|
||||||
|
call assert_equal('B', getline(2))
|
||||||
|
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
set cpo&
|
||||||
|
@ -764,6 +764,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
298,
|
||||||
/**/
|
/**/
|
||||||
297,
|
297,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user