Skip to content

Commit

Permalink
fix(buffers): bad sort_lastused result selection (#3289)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jamestrew authored Sep 12, 2024
1 parent cfaf684 commit 1398e11
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions lua/telescope/builtin/__internal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1398e11

Please sign in to comment.