aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorckelsel <ckelsel@hotmail.com>2017-12-02 15:25:24 +0800
committerckelsel <ckelsel@hotmail.com>2017-12-02 15:40:57 +0800
commit585d664b7b0d5032082bdc3ca8a17bc7fa34a4e8 (patch)
tree59cc430f2429c027120b90b4e5548b33b466773a /src
parent27f9b1c7b029d8f61723fd261bed76ea7a01e68d (diff)
downloadrneovim-585d664b7b0d5032082bdc3ca8a17bc7fa34a4e8.tar.gz
rneovim-585d664b7b0d5032082bdc3ca8a17bc7fa34a4e8.tar.bz2
rneovim-585d664b7b0d5032082bdc3ca8a17bc7fa34a4e8.zip
vim-patch:8.0.0298
Problem: Ex command range with repeated search does not work. (Bruce DeVisser) Solution: Skip over \/, \? and \&. https://github.com/vim/vim/commit/cbf20fbcd3e9bb006f694bcc35da859930fb12a2
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_docmd.c10
-rw-r--r--src/nvim/testdir/test_cmdline.vim25
-rw-r--r--src/nvim/version.c2
3 files changed, 34 insertions, 3 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 5180420eff..801979a9cb 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -3484,8 +3484,14 @@ char_u *skip_range(
{
unsigned delim;
- while (vim_strchr((char_u *)" \t0123456789.$%'/?-+,;", *cmd) != NULL) {
- if (*cmd == '\'') {
+ while (vim_strchr((char_u *)" \t0123456789.$%'/?-+,;\\", *cmd) != NULL) {
+ if (*cmd == '\\') {
+ if (cmd[1] == '?' || cmd[1] == '/' || cmd[1] == '&') {
+ cmd++;
+ } else {
+ break;
+ }
+ } else if (*cmd == '\'') {
if (*++cmd == NUL && ctx != NULL)
*ctx = EXPAND_NOTHING;
} else if (*cmd == '/' || *cmd == '?') {
diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim
index 5fc519f822..ac44e09a5a 100644
--- a/src/nvim/testdir/test_cmdline.vim
+++ b/src/nvim/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/nvim/version.c b/src/nvim/version.c
index b228b8909d..0f058c751b 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -958,7 +958,7 @@ static const int included_patches[] = {
// 301,
300,
// 299,
- // 298,
+ 298,
297,
// 296,
// 295,