-
-
Notifications
You must be signed in to change notification settings - Fork 853
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
fix: previewers & entry maker file encoding #2430
fix: previewers & entry maker file encoding #2430
Conversation
7459b81
to
191fb37
Compare
One other note would be since:
Maybe we should default back to using the input text if we get |
I'm not super familiar either but probably a good idea to handle this case. Updated the code. |
@@ -60,7 +60,12 @@ local function split(s, sep, plain, opts) | |||
opts = opts or {} | |||
local t = {} | |||
for c in vim.gsplit(s, sep, plain) do | |||
table.insert(t, c) | |||
local line = opts.file_encoding and vim.iconv(c, opts.file_encoding, "utf8") or c | |||
if line ~= nil then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i prefer something like line = line or c
and then do the insert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, going back to the handling nil
thing, if vim.iconv
returns nil
wouldn't the above "ternary operator" handle it and just return c
.
We should be able to simply table.insert(t, line)
.
sorry, one little nit and then we can merge. Thanks :) |
d717447
to
54474b0
Compare
thanks :) |
and sorry for my really late response. i just rebased and fixed the conflicts |
(cherry picked from commit c8b6523)
Just tested this change. Even though I can now see the preview correctly I still can't search for this characters. Fox example, in a file with the content |
can you open a new issue, for that? also it would be good to know which sorter you use. |
Description
Previewers and some entry_makers currently has poor support for non UTF8 encoded files.
This PR looks to add a new option
file_encoding
to pickers with for previewersfile_previewer
&grep_previewer
,qflist_previewer
.This new option is consumed by
buffer_previewer.file_maker
to do some string processing withvim.iconv
. A similar thing also happens inmake_entry.gen_from_vimgrep
.Fixes #2415
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list relevant details about your configuration
This change impacts the following pickers:
live_grep
grep_string
find_files
git_files
treesitter
current_buffer_fuzzy_find
oldfiles
buffers
marks
lsp_dynamic_workspace_symbols
lsp_workspace_symbols
lsp_document_symbols
lsp_implementations
lsp_type_definitions
lsp_definitions
lsp_outgoing_calls
lsp_incoming_calls
lsp_references
acentuação
:write ++enc=latin1
:Telescope <picker> file_encoding=latin1
and verify previewer/entryfile_encoding
optionConfiguration:
NVIM v0.9.0-dev-1070+g2630341db
Linux archlinux 6.2.5-arch1-1
Checklist: