diff options
author | Joe <rbo@gmx.us> | 2024-01-08 20:20:20 +0100 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2024-01-08 20:20:20 +0100 |
commit | 17b7d77493da530519c087d7a8168981afb406de (patch) | |
tree | fe8649fecd46774fa9b89e5a44ce48825de18f7b /c_litems.go | |
parent | ok good (diff) | |
download | hardflip-17b7d77493da530519c087d7a8168981afb406de.tar.gz hardflip-17b7d77493da530519c087d7a8168981afb406de.tar.bz2 hardflip-17b7d77493da530519c087d7a8168981afb406de.tar.xz hardflip-17b7d77493da530519c087d7a8168981afb406de.tar.zst hardflip-17b7d77493da530519c087d7a8168981afb406de.zip |
pretty fast
Diffstat (limited to 'c_litems.go')
-rw-r--r-- | c_litems.go | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/c_litems.go b/c_litems.go index 24a7844..0a1acf0 100644 --- a/c_litems.go +++ b/c_litems.go @@ -43,7 +43,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * hardflip: src/c_litems.go - * Mon Jan 08 11:53:22 2024 + * Mon Jan 08 13:36:49 2024 * Joe * * the dir and hosts linked list @@ -63,6 +63,7 @@ type ItemsList struct { head *ItemsNode last *ItemsNode curr *ItemsNode + draw_start *ItemsNode } // adds an item node to the list @@ -102,32 +103,33 @@ func (item *ItemsNode) is_dir() bool { return true } -func (item *ItemsNode) inc(jump int) *ItemsNode { +func (litems *ItemsList) inc(jump int) { + item := litems.curr if item == nil { - return nil + return } if jump == 0 { - return item + litems.curr = item } else if jump == 1 { if item.next != nil { - return item.next + litems.curr = item.next } - return item + litems.curr = item } else if jump == -1 { if item.prev != nil { - return item.prev + litems.curr = item.prev } - return item + litems.curr = item } new_item := item if jump > 0 { for i := 0; new_item.next != nil && i < jump; i++ { new_item = new_item.next } - return new_item + litems.curr = new_item } for i := 0; new_item.prev != nil && i > jump; i-- { new_item = new_item.prev } - return new_item + litems.curr = new_item } |