Skip to content

Commit 0577561

Browse files
committed
fix: Fix fold levels
Currently the fold is pretty much never reset to 0 so if you use fold levels for determining if there is fold or not you cant tell. Vim somehow can by default but any custom logic (for example custom statuscolumn) cant.
1 parent c340352 commit 0577561

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

lua/CopilotChat/chat.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ local is_stable = utils.is_stable
2323
local class = utils.class
2424

2525
function CopilotChatFoldExpr(lnum, separator)
26-
local line = vim.fn.getline(lnum)
27-
if string.match(line, separator .. '$') then
28-
return '>1'
26+
local to_match = separator .. '$'
27+
if string.match(vim.fn.getline(lnum), to_match) then
28+
return '1'
29+
elseif string.match(vim.fn.getline(lnum + 1), to_match) then
30+
return '0'
2931
end
30-
3132
return '='
3233
end
3334

0 commit comments

Comments
 (0)