// Skip over "substitute" to find the pattern separator.
for (p = cmd; ASCII_ISALPHA(*p); ++p)
;
- if (*p != NUL)
+ if (*p != NUL
+ && (STRNCMP(cmd, "substitute", p - cmd) == 0
+ || STRNCMP(cmd, "global", p - cmd) == 0
+ || STRNCMP(cmd, "vglobal", p - cmd) == 0))
{
delim = *p++;
end = skip_regexp(p, delim, p_magic, NULL);
bw!
endfunc
-func Test_search_cmdline3()
- if !exists('+incsearch')
- return
- endif
- " need to disable char_avail,
- " so that expansion of commandline works
- call test_override("char_avail", 1)
- new
- call setline(1, [' 1', ' 2 the~e', ' 3 the theother'])
- set incsearch
- 1
- " first match
- call feedkeys("/the\<c-l>\<cr>", 'tx')
- call assert_equal(' 2 the~e', getline('.'))
- " clean up
- set noincsearch
- call test_override("char_avail", 0)
- bw!
-endfunc
-
func Cmdline3_prep()
" need to disable char_avail,
" so that expansion of commandline works
bw!
endfunc
+func Test_search_cmdline3()
+ if !exists('+incsearch')
+ return
+ endif
+ call Cmdline3_prep()
+ 1
+ " first match
+ call feedkeys("/the\<c-l>\<cr>", 'tx')
+ call assert_equal(' 2 the~e', getline('.'))
+
+ call Cmdline3_cleanup()
+endfunc
+
func Test_search_cmdline3s()
if !exists('+incsearch')
return
1
call feedkeys(":%s/the\<c-l>/xxx\<cr>", 'tx')
call assert_equal(' 2 xxxe', getline('.'))
+ undo
+ call feedkeys(":%subs/the\<c-l>/xxx\<cr>", 'tx')
+ call assert_equal(' 2 xxxe', getline('.'))
+ undo
+ call feedkeys(":%substitute/the\<c-l>/xxx\<cr>", 'tx')
+ call assert_equal(' 2 xxxe', getline('.'))
call Cmdline3_cleanup()
endfunc
1
call feedkeys(":g/the\<c-l>/d\<cr>", 'tx')
call assert_equal(' 3 the theother', getline(2))
+ undo
+ call feedkeys(":global/the\<c-l>/d\<cr>", 'tx')
+ call assert_equal(' 3 the theother', getline(2))
call Cmdline3_cleanup()
endfunc
call feedkeys(":v/the\<c-l>/d\<cr>", 'tx')
call assert_equal(1, line('$'))
call assert_equal(' 2 the~e', getline(1))
+ undo
+ call feedkeys(":vglobal/the\<c-l>/d\<cr>", 'tx')
+ call assert_equal(1, line('$'))
+ call assert_equal(' 2 the~e', getline(1))
call Cmdline3_cleanup()
endfunc
" so that expansion of commandline works
call test_override("char_avail", 1)
new
- let @/='b'
+ let @/ = 'b'
call setline(1, [' bbvimb', ''])
set incsearch
" first match