fix: Guide and fold highlight offsets
Was a silly mistake due to copying code from previous implementation.
This commit is contained in:
@@ -137,8 +137,8 @@ function M.make_outline(bufnr, items)
|
|||||||
local function add_guide_hl(from, to)
|
local function add_guide_hl(from, to)
|
||||||
table.insert(hl, {
|
table.insert(hl, {
|
||||||
#flattened,
|
#flattened,
|
||||||
from + lineno_offset,
|
from,
|
||||||
to + lineno_offset,
|
to,
|
||||||
"OutlineGuides"
|
"OutlineGuides"
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
@@ -146,8 +146,8 @@ function M.make_outline(bufnr, items)
|
|||||||
local function add_fold_hl(from, to)
|
local function add_fold_hl(from, to)
|
||||||
table.insert(hl, {
|
table.insert(hl, {
|
||||||
#flattened,
|
#flattened,
|
||||||
from + lineno_offset,
|
from,
|
||||||
to + lineno_offset,
|
to,
|
||||||
"OutlineFoldMarker"
|
"OutlineFoldMarker"
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
@@ -202,12 +202,13 @@ function M.make_outline(bufnr, items)
|
|||||||
-- Finished with guide prefix
|
-- Finished with guide prefix
|
||||||
-- Join all prefix chars by a space
|
-- Join all prefix chars by a space
|
||||||
local pref_str = table.concat(pref, ' ')
|
local pref_str = table.concat(pref, ' ')
|
||||||
|
local total_pref_len = lineno_offset + #pref_str
|
||||||
|
|
||||||
-- Guide hl goes from start of prefix till before the fold marker, if any.
|
-- Guide hl goes from start of prefix till before the fold marker, if any.
|
||||||
-- Fold hl goes from start of fold marker until before the icon.
|
-- Fold hl goes from start of fold marker until before the icon.
|
||||||
add_guide_hl(lineno_offset, #pref_str - fold_marker_width)
|
add_guide_hl(lineno_offset, total_pref_len - fold_marker_width)
|
||||||
if fold_marker_width > 0 then
|
if fold_marker_width > 0 then
|
||||||
add_fold_hl(#pref_str - fold_marker_width, #pref_str + 1)
|
add_fold_hl(total_pref_len - fold_marker_width, total_pref_len + 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
local line = lineno_prefix..pref_str..' '..node.icon..' '..node.name
|
local line = lineno_prefix..pref_str..' '..node.icon..' '..node.name
|
||||||
|
|||||||
Reference in New Issue
Block a user