diff options
author | Joe <rbo@gmx.us> | 2024-01-15 20:20:20 +0100 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2024-01-15 20:20:20 +0100 |
commit | aba641ac44bfb641dd56f0c73ccd5c11689d4c01 (patch) | |
tree | d84b0e73a02e79ddb03e627949af69e9893d9c43 /c_litems.go | |
parent | fuck i dont get it (diff) | |
download | hardflip-aba641ac44bfb641dd56f0c73ccd5c11689d4c01.tar.gz hardflip-aba641ac44bfb641dd56f0c73ccd5c11689d4c01.tar.bz2 hardflip-aba641ac44bfb641dd56f0c73ccd5c11689d4c01.tar.xz hardflip-aba641ac44bfb641dd56f0c73ccd5c11689d4c01.tar.zst hardflip-aba641ac44bfb641dd56f0c73ccd5c11689d4c01.zip |
go
Diffstat (limited to 'c_litems.go')
-rw-r--r-- | c_litems.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/c_litems.go b/c_litems.go index 33a3840..031432d 100644 --- a/c_litems.go +++ b/c_litems.go @@ -166,3 +166,27 @@ func (litems *ItemsList) inc(jump int) { } litems.curr = new_item } + +// returns the next directory in line with the same or lower depth +func (item *ItemsNode) get_next_level() *ItemsNode { + if item == nil || item.Dirs == nil { + return nil + } + dir := item.Dirs + ptr := dir.next + for ptr != nil && ptr.Depth > dir.Depth { + ptr = ptr.next + } + item_ptr := item + for item_ptr != nil { + if item_ptr.is_dir() == false { + continue + } + if item_ptr.Dirs == ptr { + break + } + item_ptr = item_ptr.next + } + return item_ptr +} + |