From 1398e11b06f67276881ed44dcefda5050d8ecd0c Mon Sep 17 00:00:00 2001 From: James Trew <66286082+jamestrew@users.noreply.github.com> Date: Thu, 12 Sep 2024 01:49:25 +0000 Subject: [PATCH] fix(buffers): bad `sort_lastused` result selection (#3289) Bad condition led to the selection being stuck at idx = 2 until only one result is left, despite idx = 1 result being a better match. Neither `sort_lastused` or `ignore_current_buffer` should affect the position of the selection. Former is used simply to sort the buffer list. The latter is used to filter out the current buffer. --- lua/telescope/builtin/__internal.lua | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lua/telescope/builtin/__internal.lua b/lua/telescope/builtin/__internal.lua index d7d74e7..958a474 100644 --- a/lua/telescope/builtin/__internal.lua +++ b/lua/telescope/builtin/__internal.lua @@ -938,10 +938,6 @@ internal.buffers = function(opts) for i, bufnr in ipairs(bufnrs) do local flag = bufnr == vim.fn.bufnr "" and "%" or (bufnr == vim.fn.bufnr "#" and "#" or " ") - if opts.sort_lastused and not opts.ignore_current_buffer and flag == "#" then - default_selection_idx = 2 - end - local element = { bufnr = bufnr, flag = flag,