diff options
-rw-r--r-- | src/nvim/ex_cmds.c | 1 | ||||
-rw-r--r-- | src/nvim/testdir/test_substitute.vim | 26 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 4356767cc9..dd9f8203c1 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -3181,6 +3181,7 @@ static char_u *sub_parse_flags(char_u *cmd, subflags_T *subflags, subflags->do_ask = false; subflags->do_error = true; subflags->do_print = false; + subflags->do_list = false; subflags->do_count = false; subflags->do_number = false; subflags->do_ic = kSubHonorOptions; diff --git a/src/nvim/testdir/test_substitute.vim b/src/nvim/testdir/test_substitute.vim index d02454fbf0..fb31f5779d 100644 --- a/src/nvim/testdir/test_substitute.vim +++ b/src/nvim/testdir/test_substitute.vim @@ -107,6 +107,32 @@ function! Test_substitute_variants() endfor endfunction +" Test the l, p, # flags. +func Test_substitute_flags_lp() + new + call setline(1, "abc\tdef\<C-h>ghi") + + let a = execute('s/a/a/p') + call assert_equal("\nabc def^Hghi", a) + + let a = execute('s/a/a/l') + call assert_equal("\nabc^Idef^Hghi$", a) + + let a = execute('s/a/a/#') + call assert_equal("\n 1 abc def^Hghi", a) + + let a = execute('s/a/a/p#') + call assert_equal("\n 1 abc def^Hghi", a) + + let a = execute('s/a/a/l#') + call assert_equal("\n 1 abc^Idef^Hghi$", a) + + let a = execute('s/a/a/') + call assert_equal("", a) + + bwipe! +endfunc + func Test_substitute_repeat() " This caused an invalid memory access. split Xfile |