fix: string.find() matching for only_cwd option (builtin.buffers) (#849)
`string.find()` is defaulting to _pattern_ matching (rather than string literal matching). If you are using the `only_cwd` command in a directory with a `-` (for example) the option fails to work. This fix asks `string.find()` to interpret the arguments as literal strings rather than patterns. Reference: https://stackoverflow.com/a/15258515/181902
This commit is contained in:
@@ -569,7 +569,7 @@ internal.buffers = function(opts)
|
|||||||
if opts.ignore_current_buffer and b == vim.api.nvim_get_current_buf() then
|
if opts.ignore_current_buffer and b == vim.api.nvim_get_current_buf() then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
if opts.only_cwd and not string.find(vim.api.nvim_buf_get_name(b), vim.loop.cwd()) then
|
if opts.only_cwd and not string.find(vim.api.nvim_buf_get_name(b), vim.loop.cwd(), 1, true) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
|
|||||||
Reference in New Issue
Block a user