You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great if the highlight would be on the parent container
Provide background
Currently the highlight is on the closest container
What is the significance of this feature?
nice to have
Additional details
"nice to have" since I don't expect this to hit release anytime soon and I use the following patch which works so far
diff --git a/lua/aerial/render.lua b/lua/aerial/render.lua
index 0661915..1ab0b87 100644
--- a/lua/aerial/render.lua+++ b/lua/aerial/render.lua@@ -231,7 +231,7 @@ M.update_highlights = function(buf)
if hl_mode == "last" then
local pos = bufdata.positions[bufdata.last_win]
if pos and (config.highlight_closest or pos.exact_symbol) then
- M.highlight_line(aer_bufnr, ns, "AerialLine", pos.lnum - 1, 0, -1)+ M.highlight_line(aer_bufnr, ns, "AerialLine", ((config.highlight_closest or not pos.exact_lnum) and pos.lnum or pos.exact_lnum) - 1, 0, -1)
end
return
end
@@ -247,7 +247,7 @@ M.update_highlights = function(buf)
local pos = bufdata.positions[winid]
if config.highlight_closest or pos.exact_symbol then
local hl_group = winid == bufdata.last_win and "AerialLine" or "AerialLineNC"
- M.highlight_line(aer_bufnr, ns, hl_group, pos.lnum - 1, start_hl, end_hl)+ M.highlight_line(aer_bufnr, ns, hl_group, ((config.highlight_closest or not pos.exact_lnum) and pos.lnum or pos.exact_lnum) - 1, start_hl, end_hl)
end
if hl_mode ~= "full_width" then
start_hl = end_hl
diff --git a/lua/aerial/window.lua b/lua/aerial/window.lua
index 414b407..9e6e592 100644
--- a/lua/aerial/window.lua+++ b/lua/aerial/window.lua@@ -424,12 +424,14 @@ M.get_symbol_position = function(bufdata, lnum, col, include_hidden)
local relative = "above"
local prev = nil
local exact_symbol
+ local exact_lnum
local symbol
for _, item in bufdata:iter({ skip_hidden = not include_hidden }) do
local cmp, inside = compare(item, lnum, col)
if inside then
exact_symbol = item
+ exact_lnum = selected + 1
if item.selection_range then
cmp = compare(item.selection_range, lnum, col)
end
@@ -456,6 +458,7 @@ M.get_symbol_position = function(bufdata, lnum, col, include_hidden)
lnum = math.max(1, selected),
closest_symbol = symbol,
exact_symbol = exact_symbol,
+ exact_lnum = exact_lnum,
relative = relative,
}
end
@@ -519,8 +522,11 @@ M.update_position = function(winids, last_focused_win)
-- When aerial window is global, the items can change and cursor will move
-- before the symbols are published, which causes the line number to be
-- invalid.
- if last_position and num_lines >= last_position.lnum then- vim.api.nvim_win_set_cursor(aer_winid, { last_position.lnum, 0 })+ if last_position then+ local lnum = (config.highlight_closest or not last_position.exact_lnum) and last_position.lnum or last_position.exact_lnum+ if lnum <= num_lines then+ vim.api.nvim_win_set_cursor(aer_winid, { lnum, 0 })+ end
end
end
end
The text was updated successfully, but these errors were encountered:
Did you check existing requests?
Describe the feature
It would be great if the highlight would be on the parent container
Provide background
Currently the highlight is on the closest container
What is the significance of this feature?
nice to have
Additional details
"nice to have" since I don't expect this to hit release anytime soon and I use the following patch which works so far
The text was updated successfully, but these errors were encountered: