diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-06-12 07:48:28 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-06-12 20:42:30 +0800 |
commit | 41bb81a2dfe3c173a5d8f9d7c200475028221cf3 (patch) | |
tree | 238df43e486cbd67be253cbfcc1ef24f544553b4 /test/functional/lua/buffer_updates_spec.lua | |
parent | 502f03fc064d1eb427d214521d5cb9f5425a15b4 (diff) | |
download | rneovim-41bb81a2dfe3c173a5d8f9d7c200475028221cf3.tar.gz rneovim-41bb81a2dfe3c173a5d8f9d7c200475028221cf3.tar.bz2 rneovim-41bb81a2dfe3c173a5d8f9d7c200475028221cf3.zip |
fix(substitute): subtract number of backslashes later
Diffstat (limited to 'test/functional/lua/buffer_updates_spec.lua')
-rw-r--r-- | test/functional/lua/buffer_updates_spec.lua | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua index cbd78ccd53..2009d5f4ba 100644 --- a/test/functional/lua/buffer_updates_spec.lua +++ b/test/functional/lua/buffer_updates_spec.lua @@ -612,7 +612,15 @@ describe('lua: nvim_buf_attach on_bytes', function() } feed("<esc>") - -- replacing with escaped characters + -- replacing with expression register + feed([[:%s/b/\=5+5]]) + check_events { + { "test1", "bytes", 1, 3, 0, 1, 1, 0, 1, 1, 0, 2, 2 }; + { "test1", "bytes", 1, 5, 0, 1, 1, 0, 2, 2, 0, 1, 1 }; + } + + feed("<esc>") + -- replacing with backslash feed([[:%s/b/\\]]) check_events { { "test1", "bytes", 1, 3, 0, 1, 1, 0, 1, 1, 0, 1, 1 }; @@ -620,8 +628,24 @@ describe('lua: nvim_buf_attach on_bytes', function() } feed("<esc>") - -- replacing with expression register - feed([[:%s/b/\=5+5]]) + -- replacing with backslash from expression register + feed([[:%s/b/\='\']]) + check_events { + { "test1", "bytes", 1, 3, 0, 1, 1, 0, 1, 1, 0, 1, 1 }; + { "test1", "bytes", 1, 5, 0, 1, 1, 0, 1, 1, 0, 1, 1 }; + } + + feed("<esc>") + -- replacing with backslash followed by another character + feed([[:%s/b/\\!]]) + check_events { + { "test1", "bytes", 1, 3, 0, 1, 1, 0, 1, 1, 0, 2, 2 }; + { "test1", "bytes", 1, 5, 0, 1, 1, 0, 2, 2, 0, 1, 1 }; + } + + feed("<esc>") + -- replacing with backslash followed by another character from expression register + feed([[:%s/b/\='\!']]) check_events { { "test1", "bytes", 1, 3, 0, 1, 1, 0, 1, 1, 0, 2, 2 }; { "test1", "bytes", 1, 5, 0, 1, 1, 0, 2, 2, 0, 1, 1 }; |