From ef4aa8a52a554535e1cca512f40caaf20fd3dace Mon Sep 17 00:00:00 2001 From: Stefan Rakel Date: Fri, 27 Oct 2023 12:14:02 +0200 Subject: [PATCH] Fix wrong findChildren logic skipping over siblings --- .gitignore | 1 + lua/checkbox.lua | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 6e92f57..dad0487 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ tags +test.md diff --git a/lua/checkbox.lua b/lua/checkbox.lua index edb3ce9..63080bf 100644 --- a/lua/checkbox.lua +++ b/lua/checkbox.lua @@ -133,10 +133,10 @@ local function findChildren(startCheckbox) if not skipped then return children end - else - if checkbox.indentation > startCheckbox.indentation then - table.insert(children, checkbox) - end + elseif checkbox.indentation == startCheckbox.indentation then + return children + elseif checkbox.indentation > startCheckbox.indentation then + table.insert(children, checkbox) end end return children