aboutsummaryrefslogtreecommitdiffstats
path: root/i_events.go
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-01-15 20:20:20 +0100
committerJoe <rbo@gmx.us>2024-01-15 20:20:20 +0100
commitfcaee1fad0de4cd76cab8a808b8f62010b5bfabb (patch)
tree807217030b6d650f4b26f51c6398bf0ba0d4a54e /i_events.go
parentgo (diff)
downloadhardflip-fcaee1fad0de4cd76cab8a808b8f62010b5bfabb.tar.gz
hardflip-fcaee1fad0de4cd76cab8a808b8f62010b5bfabb.tar.bz2
hardflip-fcaee1fad0de4cd76cab8a808b8f62010b5bfabb.tar.xz
hardflip-fcaee1fad0de4cd76cab8a808b8f62010b5bfabb.tar.zst
hardflip-fcaee1fad0de4cd76cab8a808b8f62010b5bfabb.zip
working?
Diffstat (limited to '')
-rw-r--r--i_events.go91
1 files changed, 18 insertions, 73 deletions
diff --git a/i_events.go b/i_events.go
index 9dfa43b..980bd83 100644
--- a/i_events.go
+++ b/i_events.go
@@ -53,7 +53,6 @@ package main
import (
// "fmt"
- "fmt"
"os"
"github.com/gdamore/tcell/v2"
@@ -102,18 +101,17 @@ func i_unfold_dir(data *HardData, item *ItemsNode) {
i_set_unfold(data, item)
return
}
- // item.next = fold.head
- // if fold.head != nil {
- // fold.head.prev = item
- // }
- // if fold.last != nil {
- // fold.last.next = after
- // }
- // if after != nil {
- // after.prev = fold.last
- // } else {
- // data.litems.last = fold.last
- // }
+ if data.litems.last == item {
+ data.litems.last = end
+ }
+ // non-emtpy dir
+ start.prev = item
+ end.next = item.next
+ if item.next != nil {
+ item.next.prev = end
+ }
+ item.next = start
+ i_set_unfold(data, item)
}
func i_set_fold(data *HardData, curr, start, end *ItemsNode) {
@@ -152,74 +150,21 @@ func i_fold_dir(data *HardData, item *ItemsNode) {
start.prev = nil
end = start
next_dir := item.get_next_level()
- data.ui.s.Fini()
- fmt.Println("qwe")
- os.Exit(0)
// this is the end
if next_dir == nil {
+ item.next = nil
+ end = data.litems.last
+ end.next = nil
+ data.litems.last = item
+ i_set_fold(data, item, start, end)
return
}
// this is not the end
end = next_dir.prev
+ end.next = nil
item.next = next_dir
+ next_dir.prev = item
i_set_fold(data, item, start, end)
-
-
- // item.next = after
- // if after != nil {
- // after.prev = item
- // } else {
- // data.litems.last = item
- // }
- // folds := data.folds
- // folded_start = item.next
- // if folded_start != nil {
- // folded_start.prev = nil
- // folded_end = item
- // } else {
- // folded_end = nil
- // }
- // next_dir := item.Dirs.get_next_level(data.folds)
- // ptr := item
- // for next_dir != nil && ptr != nil && ptr.Dirs != next_dir {
- // ptr = ptr.next
- // }
- // if ptr == item && ptr.next != nil {
- // ptr = ptr.next
- // // FIX: fix your crap
- // }
- // if ptr == nil {
- // folded_end = nil
- // after = nil
- // data.ui.s.Fini()
- // fmt.Println("ptr:", ptr)
- // os.Exit(0)
- // } else if ptr == item {
- // folded_end = nil
- // after = nil
- // data.ui.s.Fini()
- // fmt.Println("this is the end")
- // os.Exit(0)
- // } else {
- // folded_end = ptr.prev
- // // data.ui.s.Fini()
- // // fmt.Println("ptr.Dirs.Name:", ptr.Host.Name, "\nfolded_end:", folded_end)
- // // os.Exit(0)
- // after = folded_end.next
- // folded_end.next = nil
- // }
- // tmp := ItemsList{
- // folded_start,
- // folded_end,
- // nil,
- // nil,
- // }
- // item.next = after
- // if after != nil {
- // after.prev = item
- // } else {
- // data.litems.last = item
- // }
}
func i_reload_data(data *HardData) {