Skip to content

Commit 3a4c93f

Browse files
committed
fix(statuscolumn): List values now get properly applied for folds
1 parent 043cae8 commit 3a4c93f

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

lua/bars/components/statuscolumn.lua

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ scC.lnum = function (buffer, window, config)
5151
end
5252

5353
if vim.v.virtnum ~= 0 then
54+
--- TODO, lines with `virtnum`
55+
--- when outside of the screen
56+
--- given incorrect values.
57+
---
58+
--- This should be rare so we won't
59+
--- be fixing it.
5460
if vim.v.virtnum < 0 then
5561
_o = table.concat({
5662
_o,
@@ -158,7 +164,19 @@ scC.folds = function (buffer, window, config)
158164
local function get (entry, index, ignore)
159165
if vim.islist(entry) then
160166
local current = vim.api.nvim_get_current_win() == window;
161-
local i = utils.clamp(index, 1, #entry);
167+
local indexes = {};
168+
169+
--- TODO, Do we really need to do this?
170+
for i = 1, #entry do
171+
table.insert(indexes, i);
172+
end
173+
174+
for _ = 2, index do
175+
local _tmp = table.remove(indexes, 1);
176+
table.insert(indexes, _tmp)
177+
end
178+
179+
local i = indexes[1] or 1 ;
162180

163181
if ignore == true then
164182
return entry[i];

0 commit comments

Comments
 (0)