Skip to content

Commit 1d8621f

Browse files
Properly close fold from last line in subtree. Fixes #76.
1 parent ec151bc commit 1d8621f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lua/orgmode/org/mappings.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ function OrgMappings:cycle()
8282
end
8383
vim.cmd([[norm!j]])
8484
local is_next_item_closed = vim.fn.foldclosed('.') ~= -1
85+
local is_headline = vim.fn.getline('.'):match('^%*+%s+')
8586
vim.cmd([[norm!k]])
86-
if is_next_item_closed then
87+
if is_next_item_closed and not is_headline then
8788
return vim.cmd([[norm!zczO]])
8889
end
8990
if vim.fn.foldlevel('.') == 1 then

0 commit comments

Comments
 (0)