mirror of
https://github.com/neovim/neovim.git
synced 2026-09-03 12:50:36 +00:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user