fix(builtin.current_buffer_fuzzy_find): manually go through highlighted chars to pick smallest one (#2922)

This commit is contained in:
Anton Kastritskii
2024-02-15 13:54:21 +00:00
committed by GitHub
parent fac5da839e
commit 45d61cc8da

View File

@@ -546,7 +546,18 @@ files.current_buffer_fuzzy_find = function(opts)
local current_picker = action_state.get_current_picker(prompt_bufnr) local current_picker = action_state.get_current_picker(prompt_bufnr)
local searched_for = require("telescope.actions.state").get_current_line() local searched_for = require("telescope.actions.state").get_current_line()
local highlighted = current_picker.sorter:highlighter(searched_for, selection.ordinal) local highlighted = current_picker.sorter:highlighter(searched_for, selection.ordinal)
local column = math.min(unpack(highlighted) or 1) - 1 highlighted = highlighted or {}
local column = highlighted[1]
for _, v in ipairs(highlighted) do
if v < column then
column = v
end
end
if column then
column = column - 1
else
column = 0
end
actions.close(prompt_bufnr) actions.close(prompt_bufnr)
vim.schedule(function() vim.schedule(function()