Skip to content

Commit

Permalink
fix(nightly): Toggle headline checkbox cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
kristijanhusak committed Oct 24, 2024
1 parent 625f060 commit c654095
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lua/orgmode/files/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,15 @@ function OrgFiles:get_closest_headline(cursor)
end

function OrgFiles:get_closest_listitem()
local node = ts_utils.closest_node(ts_utils.get_node_at_cursor(), 'listitem')
local get_listitem_node = function()
local node_at_cursor = ts_utils.get_node_at_cursor()
if node_at_cursor and node_at_cursor:type() == 'list' then
return node_at_cursor:named_child(0)
end
return ts_utils.closest_node(node_at_cursor, 'listitem')
end

local node = get_listitem_node()
if node then
return Listitem:new(node, self:get_current_file())
end
Expand Down

0 comments on commit c654095

Please sign in to comment.