Skip to content

Commit

Permalink
fix: aerial tree collapse state shouldn't affect get_location (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Oct 16, 2022
1 parent 4530412 commit c248731
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lua/aerial/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ M.get_location = function(exact)
end
local winid = vim.api.nvim_get_current_win()
local bufdata = data[0]
local pos = bufdata.positions[winid]
local cur = vim.api.nvim_win_get_cursor(winid)
local pos = window.get_symbol_position(bufdata, cur[1], cur[2], true)
if not pos then
return {}
end
Expand Down
5 changes: 3 additions & 2 deletions lua/aerial/window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,9 @@ end
---@param bufdata aerial.BufData
---@param lnum integer
---@param col integer
---@param include_hidden nil|boolean
---@return aerial.CursorPosition
M.get_symbol_position = function(bufdata, lnum, col)
M.get_symbol_position = function(bufdata, lnum, col, include_hidden)
local selected = 0
local relative = "above"
local prev = nil
Expand All @@ -387,7 +388,7 @@ M.get_symbol_position = function(bufdata, lnum, col)
end
prev = item
selected = selected + 1
end)
end, { incl_hidden = include_hidden })
-- Check if we're on the last symbol
if symbol == nil then
symbol = prev
Expand Down

0 comments on commit c248731

Please sign in to comment.