Skip to content

Commit

Permalink
feat(commands/go_to): go to the last element if index out of bounds (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
utkarshgupta137 committed Jun 17, 2023
1 parent 02d7950 commit 6073426
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/bufferline/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ function M.go_to(num, absolute)
num = type(num) == "string" and tonumber(num) or num
local list = absolute and state.components or state.visible_components
local element = list[num]
if num == -1 then element = list[#list] end
if element then open_element(element.id) end
if num == -1 or not element then element = list[#list] end
open_element(element.id)
end

---@param current_state bufferline.State
Expand Down

0 comments on commit 6073426

Please sign in to comment.