aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-01-11 20:20:20 +0100
committerJoe <rbo@gmx.us>2024-01-11 20:20:20 +0100
commit9938cdc8e6e6b644e013de8e1c46771cd7e7ad87 (patch)
treea07f5598fc7242c0199ef4a0c7d31394063a900e
parentfix that now (diff)
downloadhardflip-9938cdc8e6e6b644e013de8e1c46771cd7e7ad87.tar.gz
hardflip-9938cdc8e6e6b644e013de8e1c46771cd7e7ad87.tar.bz2
hardflip-9938cdc8e6e6b644e013de8e1c46771cd7e7ad87.tar.xz
hardflip-9938cdc8e6e6b644e013de8e1c46771cd7e7ad87.tar.zst
hardflip-9938cdc8e6e6b644e013de8e1c46771cd7e7ad87.zip
cool
Diffstat (limited to '')
-rw-r--r--c_ldirs.go13
-rw-r--r--i_events.go6
2 files changed, 12 insertions, 7 deletions
diff --git a/c_ldirs.go b/c_ldirs.go
index 266bf5b..1a4157c 100644
--- a/c_ldirs.go
+++ b/c_ldirs.go
@@ -51,6 +51,8 @@
package main
+import "fmt"
+
type DirsNode struct {
ID int
Name string
@@ -156,17 +158,18 @@ func (dir *DirsNode) count_hosts() int {
// return the number of hosts and subfolders of the dir
func (dir *DirsNode) count_elements(skip_folds bool,
- folds map[*DirsNode]*ItemsList) int {
+ folds map[*DirsNode]*ItemsList) int {
items := 0
items += dir.count_hosts()
for ptr := dir.next; ptr != nil && ptr.Depth > dir.Depth; ptr = ptr.next {
- if skip_folds == true && lfold := folds[ptr] != nil {
- lfold.head
- for i := 1; i < count; i++ {
+ if lfold := folds[ptr]; skip_folds == true && lfold != nil {
+ count := lfold.last.ID - lfold.head.ID
+ fmt.Println(count)
+ // FIX: here
+ for i := 1; ptr != nil && i < count; i++ {
ptr = ptr.next
}
- // FIX: fix you shit
} else {
items += ptr.count_hosts() + 1
}
diff --git a/i_events.go b/i_events.go
index 20cf306..cc31ff7 100644
--- a/i_events.go
+++ b/i_events.go
@@ -62,12 +62,12 @@ func i_list_follow_cursor(litems *ItemsList, ui *HardUI) {
if litems.draw_start == nil || litems.curr == nil {
return
}
- virt_id := litems.curr.ID - (ui.dim[H] - 4)
+ virt_id := litems.curr.ID - (ui.dim[H] - 4) + 4
for litems.draw_start.ID < virt_id &&
litems.draw_start.next != nil {
litems.draw_start = litems.draw_start.next
}
- for litems.draw_start.ID > litems.curr.ID &&
+ for litems.draw_start.ID > litems.curr.ID - 4 &&
litems.draw_start.prev != nil {
litems.draw_start = litems.draw_start.prev
}
@@ -274,6 +274,8 @@ func i_events(data *HardData) {
} else if data.litems.curr.Dirs != nil &&
data.folds[data.litems.curr.Dirs] == nil {
i_fold_dir(data, data.litems.curr)
+ ui.s.Fini()
+ os.Exit(0)
} else {
i_unfold_dir(data, data.litems.curr)
}