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
commit57d51f7de31da84b0aeece71d07fdabc25019968 (patch)
treedfc2134697009cb8cd4d7edb3bc1ed29877036ae
parentfolding ye (diff)
downloadhardflip-57d51f7de31da84b0aeece71d07fdabc25019968.tar.gz
hardflip-57d51f7de31da84b0aeece71d07fdabc25019968.tar.bz2
hardflip-57d51f7de31da84b0aeece71d07fdabc25019968.tar.xz
hardflip-57d51f7de31da84b0aeece71d07fdabc25019968.tar.zst
hardflip-57d51f7de31da84b0aeece71d07fdabc25019968.zip
cleanup
-rw-r--r--c_hardflip.go4
-rw-r--r--c_init.go2
-rw-r--r--c_lhosts.go2
-rw-r--r--c_litems.go31
-rw-r--r--i_events.go31
-rw-r--r--i_ui.go15
6 files changed, 8 insertions, 77 deletions
diff --git a/c_hardflip.go b/c_hardflip.go
index ed7c848..c36cd3e 100644
--- a/c_hardflip.go
+++ b/c_hardflip.go
@@ -43,7 +43,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* hardflip: src/c_hardflip.go
- * Wed Jan 10 11:03:24 2024
+ * Wed Jan 10 16:36:35 2024
* Joe
*
* the main
@@ -51,8 +51,6 @@
package main
-// import "fmt"
-
// the main data structure, holds up everything important
type HardData struct {
litems *ItemsList
diff --git a/c_init.go b/c_init.go
index 9dbb45b..2fd9033 100644
--- a/c_init.go
+++ b/c_init.go
@@ -43,7 +43,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* hardflip: src/c_init.go
- * Mon Jan 08 13:39:08 2024
+ * Wed Jan 10 16:36:49 2024
* Joe
*
* init functions
diff --git a/c_lhosts.go b/c_lhosts.go
index 691625f..2e99264 100644
--- a/c_lhosts.go
+++ b/c_lhosts.go
@@ -133,7 +133,7 @@ func (lhost *HostList) del(host *HostNode) {
}
}
-// return the list node with the according id
+// returns the list node with the according id
func (lhost *HostList) sel(id int) *HostNode {
curr := lhost.head
diff --git a/c_litems.go b/c_litems.go
index ce26648..76fd116 100644
--- a/c_litems.go
+++ b/c_litems.go
@@ -43,7 +43,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* hardflip: src/c_litems.go
- * Wed Jan 10 11:30:12 2024
+ * Wed Jan 10 16:36:44 2024
* Joe
*
* the dir and hosts linked list
@@ -164,34 +164,5 @@ func (litems *ItemsList) inc(jump int) {
new_item = new_item.prev
}
}
- // for jump > 0 &&
- // new_item.folded_parents() == true &&
- // new_item.next != nil {
- // new_item = new_item.next
- // }
- // for jump < 0 &&
- // new_item.folded_parents() == true &&
- // new_item.prev != nil {
- // new_item = new_item.prev
- // }
- // if new_item == litems.last && new_item.folded_parents() == true {
- // return
- // }
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
-// }
diff --git a/i_events.go b/i_events.go
index 8f2c675..c414eca 100644
--- a/i_events.go
+++ b/i_events.go
@@ -43,7 +43,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* hardflip: src/i_events.go
- * Wed Jan 10 12:04:16 2024
+ * Wed Jan 10 16:36:40 2024
* Joe
*
* events in the code
@@ -58,20 +58,11 @@ import (
"golang.org/x/term"
)
-// func i_update_folded_count(dir *DirsNode, ui *HardUI) {
-// delta := 0
-// delta += dir.count_elements()
-// if dir.Folded == false {
-// delta *= -1
-// }
-// ui.folded_count += delta
-// }
-
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) // - ui.folded_count
+ virt_id := litems.curr.ID - (ui.dim[H] - 4)
for litems.draw_start.ID < virt_id &&
litems.draw_start.next != nil {
litems.draw_start = litems.draw_start.next
@@ -80,15 +71,6 @@ func i_list_follow_cursor(litems *ItemsList, ui *HardUI) {
litems.draw_start.prev != nil {
litems.draw_start = litems.draw_start.prev
}
- // fmt.Println(">>>>> DRAW_START:", litems.draw_start.ID, "<<<<<<< >>>>>>>> VIRT_ID:", virt_id)
- // if litems.draw_start.prev != nil &&
- // litems.draw_start.prev.is_dir() == true &&
- // litems.draw_start.prev.Dirs.Folded == true {
- // tmp := litems.draw_start.prev.Dirs.count_elements()
- // for i := 0; i < tmp && litems.draw_start != nil; i++ {
- // litems.draw_start = litems.draw_start.next
- // }
- // }
}
func i_unfold_dir(data *HardData, item *ItemsNode) {
@@ -112,6 +94,7 @@ func i_unfold_dir(data *HardData, item *ItemsNode) {
for ptr := data.litems.head; ptr.next != nil; ptr = ptr.next {
ptr.next.ID = ptr.ID + 1
}
+ item.Dirs.Folded = false
}
func i_fold_dir(data *HardData, item *ItemsNode) {
@@ -144,6 +127,7 @@ func i_fold_dir(data *HardData, item *ItemsNode) {
for ptr := data.litems.head; ptr.next != nil; ptr = ptr.next {
ptr.next.ID = ptr.ID + 1
}
+ item.Dirs.Folded = true
}
func i_reload_data(data *HardData) {
@@ -216,10 +200,6 @@ 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
- // }
} else if event.Rune() == 'D' &&
data.ldirs.head != nil &&
ui.sel_max != 0 {
@@ -243,10 +223,8 @@ func i_events(data *HardData) {
}
} else {
if data.litems.curr.Dirs.Folded == false {
- data.litems.curr.Dirs.Folded = true
i_fold_dir(data, data.litems.curr)
} else {
- data.litems.curr.Dirs.Folded = false
i_unfold_dir(data, data.litems.curr)
}
}
@@ -260,7 +238,6 @@ func i_events(data *HardData) {
} else {
data.litems.curr.Dirs.Folded = false
}
- // i_update_folded_count(data.litems.curr.Dirs, ui)
} else if event.Key() == tcell.KeyCtrlR {
i_reload_data(data)
}
diff --git a/i_ui.go b/i_ui.go
index 8a78569..4e0b7c0 100644
--- a/i_ui.go
+++ b/i_ui.go
@@ -64,7 +64,6 @@ type HardUI struct {
def_style tcell.Style
dir_style tcell.Style
title_style tcell.Style
- // folded_count int
dim [2]int
}
@@ -282,9 +281,6 @@ func i_host_panel(ui HardUI, icons bool, litems *ItemsList) {
line := 1
ptr := litems.draw_start
for ; ptr != nil && line < ui.dim[H] - 2; ptr = ptr.next {
- // if ptr.folded_parents() == true {
- // continue
- // }
if ptr.is_dir() == false && ptr.Host != nil {
i_host_panel_host(ui,
icons,
@@ -292,22 +288,12 @@ func i_host_panel(ui HardUI, icons bool, litems *ItemsList) {
ptr.Host,
litems.curr.Host,
line)
- // FIX: === delete this after fix
- // i_draw_text(ui.s,
- // 1, line, ui.dim[W] / 3, line,
- // ui.def_style, strconv.Itoa(ptr.ID))
- // FIX: ===
line++
} else if ptr.Dirs != nil {
i_host_panel_dirs(ui, icons,
ptr.Dirs,
litems.curr.Dirs,
line)
- // FIX: === delete this after fix
- // i_draw_text(ui.s,
- // 1, line, ui.dim[W] / 3, line,
- // ui.def_style, strconv.Itoa(ptr.ID))
- // FIX: ===
line++
}
}
@@ -323,7 +309,6 @@ func i_host_panel(ui HardUI, icons bool, litems *ItemsList) {
ui.def_style,
" 0 hosts ")
}
- // FIX: bug on draw_start with folded folders
}
func i_info_panel_dirs(ui HardUI, dir *DirsNode) {