fix(live_grep/grep_string): support non-utf8 patterns (#2570)
This commit is contained in:
@@ -126,6 +126,10 @@ files.live_grep = function(opts)
|
||||
end
|
||||
end
|
||||
|
||||
if opts.file_encoding then
|
||||
additional_args[#additional_args + 1] = "--encoding=" .. opts.file_encoding
|
||||
end
|
||||
|
||||
local args = flatten { vimgrep_arguments, additional_args }
|
||||
opts.__inverted, opts.__matches = opts_contain_invert(args)
|
||||
|
||||
@@ -187,6 +191,10 @@ files.grep_string = function(opts)
|
||||
end
|
||||
end
|
||||
|
||||
if opts.file_encoding then
|
||||
additional_args[#additional_args + 1] = "--encoding=" .. opts.file_encoding
|
||||
end
|
||||
|
||||
if search == "" then
|
||||
search = { "-v", "--", "^[[:space:]]*$" }
|
||||
else
|
||||
|
||||
@@ -326,10 +326,9 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
local text = opts.file_encoding and vim.iconv(entry.text, opts.file_encoding, "utf8") or entry.text
|
||||
local display, hl_group, icon = utils.transform_devicons(
|
||||
entry.filename,
|
||||
string.format(display_string, display_filename, coordinates, text),
|
||||
string.format(display_string, display_filename, coordinates, entry.text),
|
||||
disable_devicons
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user