summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-02-03 21:19:04 +0100
committerBram Moolenaar <Bram@vim.org>2017-02-03 21:19:04 +0100
commitcbf20fbcd3e9bb006f694bcc35da859930fb12a2 (patch)
tree93a6095bdf34946dcb6a39587d27c48a0f61021e
parent03ff9bcbc968f7d306e4a4e334e226fdde62ca82 (diff)
downloadvim-git-cbf20fbcd3e9bb006f694bcc35da859930fb12a2.tar.gz
patch 8.0.0298: Ex command range with repeated search does not workv8.0.0298
Problem: Ex command range with repeated search does not work. (Bruce DeVisser) Solution: Skip over \/, \? and \&.
-rw-r--r--src/ex_docmd.c11
-rw-r--r--src/testdir/test_cmdline.vim25
-rw-r--r--src/version.c2
3 files changed, 36 insertions, 2 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index f93c76651..3ee7056c1 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -4357,9 +4357,16 @@ skip_range(
{
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)
*ctx = EXPAND_NOTHING;
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index fcfce7354..aa8fb13c6 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -306,3 +306,28 @@ func Test_cmdline_complete_wildoptions()
call assert_equal(a, b)
bw!
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&
diff --git a/src/version.c b/src/version.c
index c85a57f6b..93a59cd63 100644
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 298,
+/**/
297,
/**/
296,