summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamon Timm <damontimm@gmail.com>2021-05-16 14:36:16 -0400
committerGitHub <noreply@github.com>2021-05-16 20:36:16 +0200
commit69eb5eacff421e05aeb1e02ff97ef64bfd955c53 (patch)
tree76d8eb3c586fd610e361cfb4155e13d8ab3372cc
parent4da66dab44f37d0de4b88cedf9e114c5b0855c20 (diff)
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
-rw-r--r--lua/telescope/builtin/internal.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/lua/telescope/builtin/internal.lua b/lua/telescope/builtin/internal.lua
index c412f69..2c4695f 100644
--- a/lua/telescope/builtin/internal.lua
+++ b/lua/telescope/builtin/internal.lua
@@ -569,7 +569,7 @@ internal.buffers = function(opts)
if opts.ignore_current_buffer and b == vim.api.nvim_get_current_buf() then
return false
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
end
return true