-
-
Notifications
You must be signed in to change notification settings - Fork 810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Telescope find_files not escape file name properly #2315
Labels
bug
Something isn't working
Comments
so I managed to fixed the issue by doing this change, it seems like everything else is working as well as expected so I don't think I broke anything, but obviously I don't really know the project well. @Conni2461 do you have any comments or suggestions? I'm asking you because there is a TODO with your name on that file so you might have some comments diff --git a/lua/telescope/from_entry.lua b/lua/telescope/from_entry.lua
index 486b57c..11c4792 100644
--- a/lua/telescope/from_entry.lua
+++ b/lua/telescope/from_entry.lua
@@ -30,7 +30,8 @@ function from_entry.path(entry, validate, escape)
-- TODO(conni2461): we are not going to return the expanded path because
-- this would lead to cache misses in the perviewer.
-- Requires overall refactoring in previewer interface
- local expanded = vim.fn.expand(path)
+ local escaped_path = vim.fn.escape(path, '?*[]')
+ local expanded = vim.fn.expand(escaped_path)
if (vim.fn.filereadable(expanded) + vim.fn.isdirectory(expanded)) == 0 then
return
end
|
4 tasks
just merged a fix, thanks to everyone for debugging :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Telescope find_files doesn't handle well file names containing specific regex like substrings.
Neovim version
Operating system and version
macOs 12.6.2
Telescope version / branch / rev
04af51d
checkhealth telescope
Steps to reproduce
Steps to reproduce
[Ar-h] foo bar (cpp)"
Expected behavior
no error when cursor goes onto the file into the picker
Actual behavior
E5108: Error executing lua Vim:E944: Reverse range in character class
stack traceback:
[C]: in function 'expand'
....vim/plugged/telescope.nvim/lua/telescope/from_entry.lua:33: in function 'path'
...scope.nvim/lua/telescope/previewers/buffer_previewer.lua:428: in function 'define_preview'
...scope.nvim/lua/telescope/previewers/buffer_previewer.lua:388: in function 'preview'
...en/.vim/plugged/telescope.nvim/lua/telescope/pickers.lua:1075: in function 'refresh_previewer'
...en/.vim/plugged/telescope.nvim/lua/telescope/pickers.lua:1028: in function 'set_selection'
...en/.vim/plugged/telescope.nvim/lua/telescope/pickers.lua:792: in function 'move_selection'
...vim/plugged/telescope.nvim/lua/telescope/actions/set.lua:39: in function 'run_replace_or_original'
....vim/plugged/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'shift_selection'
...im/plugged/telescope.nvim/lua/telescope/actions/init.lua:81: in function 'run_replace_or_original'
....vim/plugged/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'key_func'
...n/.vim/plugged/telescope.nvim/lua/telescope/mappings.lua:352: in function 'execute_keymap'
[string ":lua"]:1: in main chunk
Minimal config
The text was updated successfully, but these errors were encountered: