diff options
-rw-r--r-- | c_ldirs.go | 1 | ||||
-rw-r--r-- | c_litems.go | 30 | ||||
-rw-r--r-- | i_events.go | 20 | ||||
-rw-r--r-- | i_ui.go | 2 |
4 files changed, 34 insertions, 19 deletions
@@ -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 || @@ -52,6 +52,8 @@ package main import ( + "fmt" + "os" "strconv" "github.com/gdamore/tcell/v2" |