diff options
author | Joe <rbo@gmx.us> | 2024-01-15 20:20:20 +0100 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2024-01-15 20:20:20 +0100 |
commit | b07086cba67d3f6629bf7fae063a056e95a4bf92 (patch) | |
tree | 89ae6f0ce43b5d5e802dfbdcf83df0cf7e5ad443 | |
parent | cleaner i guess (diff) | |
download | hardflip-b07086cba67d3f6629bf7fae063a056e95a4bf92.tar.gz hardflip-b07086cba67d3f6629bf7fae063a056e95a4bf92.tar.bz2 hardflip-b07086cba67d3f6629bf7fae063a056e95a4bf92.tar.xz hardflip-b07086cba67d3f6629bf7fae063a056e95a4bf92.tar.zst hardflip-b07086cba67d3f6629bf7fae063a056e95a4bf92.zip |
fix
-rw-r--r-- | c_litems.go | 4 | ||||
-rw-r--r-- | i_events.go | 2 | ||||
-rw-r--r-- | i_ui.go | 61 |
3 files changed, 37 insertions, 30 deletions
diff --git a/c_litems.go b/c_litems.go index 86841ca..e3f26bb 100644 --- a/c_litems.go +++ b/c_litems.go @@ -169,7 +169,7 @@ func (litems *ItemsList) inc(jump int) { // returns the previous dir func (item *ItemsNode) prev_dir() *ItemsNode { - for ptr := item.prev; ptr != nil && ptr.prev != nil; ptr = ptr.prev { + for ptr := item.prev; ptr != nil; ptr = ptr.prev { if ptr.is_dir() == true { return ptr } @@ -179,7 +179,7 @@ func (item *ItemsNode) prev_dir() *ItemsNode { // returns the next dir func (item *ItemsNode) next_dir() *ItemsNode { - for ptr := item.next; ptr != nil && ptr.next != nil; ptr = ptr.next { + for ptr := item.next; ptr != nil; ptr = ptr.next { if ptr.is_dir() == true { return ptr } diff --git a/i_events.go b/i_events.go index f1cf3c4..bdc4afe 100644 --- a/i_events.go +++ b/i_events.go @@ -43,7 +43,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * hardflip: src/i_events.go - * Mon Jan 15 13:54:57 2024 + * Mon Jan 15 17:00:37 2024 * Joe * * events in the code @@ -43,7 +43,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * hardflip: src/i_ui.go - * Mon Jan 15 13:54:53 2024 + * Mon Jan 15 17:00:43 2024 * Joe * * interfacing with the user @@ -302,18 +302,6 @@ func i_host_panel(ui HardUI, icons bool, litems *ItemsList, data *HardData) { line++ } } - if litems.head != nil { - i_draw_text(ui.s, - 1, ui.dim[H] - 2, (ui.dim[W] / 3) - 1, ui.dim[H] - 2, - ui.def_style, - " " + strconv.Itoa(litems.curr.ID) + "/" + - strconv.Itoa(int(litems.last.ID)) + " items ") - } else { - i_draw_text(ui.s, - 1, ui.dim[H] - 2, (ui.dim[W] / 3) - 1, ui.dim[H] - 2, - ui.def_style, - " 0 hosts ") - } } func i_info_panel_dirs(ui HardUI, dir *DirsNode) { @@ -341,20 +329,7 @@ func i_info_panel_dirs(ui HardUI, dir *DirsNode) { ui.def_style, dir.path()) } -func i_info_panel(ui HardUI, litems *ItemsList) { - i_draw_box(ui.s, (ui.dim[W] / 3), 0, - ui.dim[W] - 1, ui.dim[H] - 2, - " Infos ", false) - ui.s.SetContent(ui.dim[W] / 3, 0, tcell.RuneTTee, nil, ui.def_style) - ui.s.SetContent(ui.dim[W] / 3, ui.dim[H] - 2, - tcell.RuneBTee, nil, ui.def_style) - if litems.head == nil { - return - } else if litems.curr.is_dir() == true { - i_info_panel_dirs(ui, litems.curr.Dirs) - return - } - host := litems.curr.Host +func i_info_panel_host(ui HardUI, host *HostNode) { host_type := host.protocol_str() curr_line := 2 // name, type @@ -514,6 +489,38 @@ func i_info_panel(ui HardUI, litems *ItemsList) { } } +func i_info_panel(ui HardUI, litems *ItemsList) { + i_draw_box(ui.s, (ui.dim[W] / 3), 0, + ui.dim[W] - 1, ui.dim[H] - 2, + " Infos ", false) + ui.s.SetContent(ui.dim[W] / 3, 0, tcell.RuneTTee, nil, ui.def_style) + ui.s.SetContent(ui.dim[W] / 3, ui.dim[H] - 2, + tcell.RuneBTee, nil, ui.def_style) + if litems.head == nil { + return + } else if litems.curr.is_dir() == true { + i_info_panel_dirs(ui, litems.curr.Dirs) + } else { + i_info_panel_host(ui, litems.curr.Host) + } + // number display + if litems.head != nil { + text := " " + strconv.Itoa(litems.curr.ID) + " of " + + strconv.Itoa(int(litems.last.ID)) + " " + i_draw_text(ui.s, + (ui.dim[W] - 1) - len(text), + ui.dim[H] - 2, + (ui.dim[W] - 1) - 1, ui.dim[H] - 2, + ui.def_style, + text) + } else { + i_draw_text(ui.s, + 1, ui.dim[H] - 2, (ui.dim[W] / 3) - 1, ui.dim[H] - 2, + ui.def_style, + " 0 hosts ") + } +} + func i_ui(data *HardData) { var err error ui := &data.ui |