aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-01-10 20:20:20 +0100
committerJoe <rbo@gmx.us>2024-01-10 20:20:20 +0100
commit43e669eb01791b87ed570ab424a66984f26da399 (patch)
tree5806bdbc0061f4950d8f20d0110a41f7529320e9
parenttrying that map (diff)
downloadhardflip-43e669eb01791b87ed570ab424a66984f26da399.tar.gz
hardflip-43e669eb01791b87ed570ab424a66984f26da399.tar.bz2
hardflip-43e669eb01791b87ed570ab424a66984f26da399.tar.xz
hardflip-43e669eb01791b87ed570ab424a66984f26da399.tar.zst
hardflip-43e669eb01791b87ed570ab424a66984f26da399.zip
tmp
-rw-r--r--c_ldirs.go1
-rw-r--r--c_litems.go30
-rw-r--r--i_events.go20
-rw-r--r--i_ui.go2
4 files changed, 34 insertions, 19 deletions
diff --git a/c_ldirs.go b/c_ldirs.go
index d7628e7..96381fd 100644
--- a/c_ldirs.go
+++ b/c_ldirs.go
@@ -57,6 +57,7 @@ type DirsNode struct {
Parent *DirsNode
Depth uint16
lhost *HostList
+ // HACK: remove Folded bool if maps work
Folded bool
next *DirsNode
}
diff --git a/c_litems.go b/c_litems.go
index 03c2ae1..689a5e0 100644
--- a/c_litems.go
+++ b/c_litems.go
@@ -180,18 +180,18 @@ func (litems *ItemsList) inc(jump int) {
litems.curr = new_item
}
-func (item *ItemsNode) folded_parents() bool {
- var ptr *DirsNode
-
- if item.is_dir() == false {
- ptr = item.Host.Parent
- } else {
- ptr = item.Dirs.Parent
- }
- for ; ptr.Parent != nil; ptr = ptr.Parent {
- if ptr.Folded == true {
- return true
- }
- }
- return false
-}
+// func (item *ItemsNode) folded_parents() bool {
+// var ptr *DirsNode
+//
+// if item.is_dir() == false {
+// ptr = item.Host.Parent
+// } else {
+// ptr = item.Dirs.Parent
+// }
+// for ; ptr.Parent != nil; ptr = ptr.Parent {
+// if ptr.Folded == true {
+// return true
+// }
+// }
+// return false
+// }
diff --git a/i_events.go b/i_events.go
index 8caf2d5..8cf9a82 100644
--- a/i_events.go
+++ b/i_events.go
@@ -92,6 +92,17 @@ func i_list_follow_cursor(litems *ItemsList, ui *HardUI) {
// }
}
+func i_fold_dir(data *HardData, item *ItemsNode) {
+ litems := data.litems
+ folds := data.folds
+
+ folds[item] = &ItemsList{
+ nil,
+ nil,
+ nil,
+ }
+}
+
func i_reload_data(data *HardData) {
// TODO: remove this after debug
fmt.Println("remove me sometime")
@@ -164,10 +175,10 @@ func i_events(data *HardData) {
data.litems.draw_start = data.litems.head
} else if event.Rune() == 'G' {
data.litems.curr = data.litems.last
- for data.litems.curr.prev != nil &&
- data.litems.curr.folded_parents() == true {
- data.litems.curr = data.litems.curr.prev
- }
+ // for data.litems.curr.prev != nil &&
+ // data.litems.curr.folded_parents() == true {
+ // data.litems.curr = data.litems.curr.prev
+ // }
} else if event.Rune() == 'D' &&
data.ldirs.head != nil &&
ui.sel_max != 0 {
@@ -195,6 +206,7 @@ func i_events(data *HardData) {
} else {
data.litems.curr.Dirs.Folded = false
}
+ i_fold_dir(data, data.litems.curr)
}
} else if event.Rune() == ' ' {
if data.litems.curr == nil ||
diff --git a/i_ui.go b/i_ui.go
index d4b19ff..e0c74e0 100644
--- a/i_ui.go
+++ b/i_ui.go
@@ -52,6 +52,8 @@
package main
import (
+ "fmt"
+ "os"
"strconv"
"github.com/gdamore/tcell/v2"