From 45d61cc8da213e4052cf698653692b6a4c961760 Mon Sep 17 00:00:00 2001 From: Anton Kastritskii Date: Thu, 15 Feb 2024 13:54:21 +0000 Subject: [PATCH] fix(builtin.current_buffer_fuzzy_find): manually go through highlighted chars to pick smallest one (#2922) --- lua/telescope/builtin/__files.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lua/telescope/builtin/__files.lua b/lua/telescope/builtin/__files.lua index 26d46bf..0d55ee0 100644 --- a/lua/telescope/builtin/__files.lua +++ b/lua/telescope/builtin/__files.lua @@ -546,7 +546,18 @@ files.current_buffer_fuzzy_find = function(opts) local current_picker = action_state.get_current_picker(prompt_bufnr) local searched_for = require("telescope.actions.state").get_current_line() 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) vim.schedule(function()