diff options
author | Joe <rbo@gmx.us> | 2024-01-05 20:20:20 +0100 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2024-01-05 20:20:20 +0100 |
commit | b86e613a96d23e90668b5f9aabd2a38b76c30fa4 (patch) | |
tree | eac72d2b8280203651a74b515a96c12edc891690 /c_litems.go | |
parent | googo (diff) | |
download | hardflip-b86e613a96d23e90668b5f9aabd2a38b76c30fa4.tar.gz hardflip-b86e613a96d23e90668b5f9aabd2a38b76c30fa4.tar.bz2 hardflip-b86e613a96d23e90668b5f9aabd2a38b76c30fa4.tar.xz hardflip-b86e613a96d23e90668b5f9aabd2a38b76c30fa4.tar.zst hardflip-b86e613a96d23e90668b5f9aabd2a38b76c30fa4.zip |
now draw litems list
Diffstat (limited to 'c_litems.go')
-rw-r--r-- | c_litems.go | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/c_litems.go b/c_litems.go index 44831ff..68d7137 100644 --- a/c_litems.go +++ b/c_litems.go @@ -43,7 +43,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * hardflip: src/c_litems.go - * Fri Jan 05 12:29:08 2024 + * Fri Jan 05 15:04:07 2024 * Joe * * the dir and hosts linked list @@ -62,8 +62,10 @@ type ItemsNode struct { type ItemsList struct { head *ItemsNode last *ItemsNode + curr *ItemsNode } +// adds an item node to the list func (litems *ItemsList) add_back(node *ItemsNode) { if litems.head == nil { litems.head = node @@ -77,6 +79,22 @@ func (litems *ItemsList) add_back(node *ItemsNode) { litems.last = last.next } +// sets litems.curr to be used +func (litems *ItemsList) sel(id int) { + curr := litems.head + + if curr == nil { + litems.curr = nil + } + for curr.next != nil && curr.ID != id { + curr = curr.next + } + if curr.ID != id { + litems.curr = nil + } + litems.curr = curr +} + func (item *ItemsNode) is_dir() bool { if item.Dirs == nil { return false @@ -85,6 +103,9 @@ func (item *ItemsNode) is_dir() bool { } func (item *ItemsNode) inc(jump int) *ItemsNode { + if item == nil { + return nil + } if jump == 0 { return item } else if jump == 1 { |