aboutsummaryrefslogtreecommitdiff
path: root/test/functional/api/buffer_spec.lua
diff options
context:
space:
mode:
authorJaehwang Jung <tomtomjhj@gmail.com>2026-09-01 10:04:57 +0900
committerGitHub <noreply@github.com>2026-09-01 01:04:57 +0000
commitca992e82d40cb8ed31331ba75cf0a58c6d693ac7 (patch)
tree7cb7e9c9c147841ed1c5da065e8cf0d010c99182 /test/functional/api/buffer_spec.lua
parent9d2a31b05e018749f14c7c6688379b059ba3ea75 (diff)
downloadrneovim-ca992e82d40cb8ed31331ba75cf0a58c6d693ac7.tar.gz
rneovim-ca992e82d40cb8ed31331ba75cf0a58c6d693ac7.tar.bz2
rneovim-ca992e82d40cb8ed31331ba75cf0a58c6d693ac7.zip
fix(buffer): keep trailing slash significant in URI names #41577
Problem: Literal path comparison ignored one trailing slash for every buffer name, including URIs. Generic URI syntax does not make a non-empty path equivalent to the same path with a trailing slash, so distinct URI buffers collapsed into one. Solution: Require equal lengths when comparing URI buffer names, while retaining trailing-separator normalization for filesystem paths. AI-assisted
Diffstat (limited to 'test/functional/api/buffer_spec.lua')
-rw-r--r--test/functional/api/buffer_spec.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/functional/api/buffer_spec.lua b/test/functional/api/buffer_spec.lua
index d46a704773..551bc4091f 100644
--- a/test/functional/api/buffer_spec.lua
+++ b/test/functional/api/buffer_spec.lua
@@ -2420,6 +2420,15 @@ describe('api/buf', function()
eq(cwd .. '/' .. link .. '/', t.fix_slashes(api.nvim_buf_get_name(0)))
end)
+ it('allows URI buffer names that differ by a trailing slash', function()
+ api.nvim_buf_set_name(0, 'test://example')
+ local trailing_slash = api.nvim_create_buf(true, false)
+ api.nvim_buf_set_name(trailing_slash, 'test://example/')
+
+ eq('test://example', api.nvim_buf_get_name(0))
+ eq('test://example/', api.nvim_buf_get_name(trailing_slash))
+ end)
+
describe("with 'autochdir'", function()
local topdir
local oldbuf