aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/buffer_updates_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-06-13 07:18:38 +0800
committerGitHub <noreply@github.com>2022-06-13 07:18:38 +0800
commitc665773897ca31c6e1270c2d52939e33df35106b (patch)
treef6d5e1c61e76f561806135e79ecd111a7d2d4e64 /test/functional/lua/buffer_updates_spec.lua
parent3c7b91da10436fb503934a735958b445bbde580e (diff)
parent8bc48273eb9629409c26b811d6c8a7025f53a3cf (diff)
downloadrneovim-c665773897ca31c6e1270c2d52939e33df35106b.tar.gz
rneovim-c665773897ca31c6e1270c2d52939e33df35106b.tar.bz2
rneovim-c665773897ca31c6e1270c2d52939e33df35106b.zip
Merge pull request #18931 from zeertzjq/regexp-num-escaped
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.lua30
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 f32274468a..10de45274c 100644
--- a/test/functional/lua/buffer_updates_spec.lua
+++ b/test/functional/lua/buffer_updates_spec.lua
@@ -617,7 +617,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 };
@@ -625,8 +633,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 };