fix(buffers): select_current not selecting current buffer index (#3147)
Co-authored-by: Yeri <yeri@accelbyte.net>
This commit is contained in:
@@ -933,7 +933,7 @@ internal.buffers = function(opts)
|
|||||||
|
|
||||||
local buffers = {}
|
local buffers = {}
|
||||||
local default_selection_idx = 1
|
local default_selection_idx = 1
|
||||||
for _, bufnr in ipairs(bufnrs) do
|
for i, bufnr in ipairs(bufnrs) do
|
||||||
local flag = bufnr == vim.fn.bufnr "" and "%" or (bufnr == vim.fn.bufnr "#" and "#" or " ")
|
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
|
if opts.sort_lastused and not opts.ignore_current_buffer and flag == "#" then
|
||||||
@@ -951,7 +951,7 @@ internal.buffers = function(opts)
|
|||||||
table.insert(buffers, idx, element)
|
table.insert(buffers, idx, element)
|
||||||
else
|
else
|
||||||
if opts.select_current and flag == "%" then
|
if opts.select_current and flag == "%" then
|
||||||
default_selection_idx = bufnr
|
default_selection_idx = i
|
||||||
end
|
end
|
||||||
table.insert(buffers, element)
|
table.insert(buffers, element)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user