From 28108920b5e4c6ad916b4c974319b14b3be27798 Mon Sep 17 00:00:00 2001 From: Joe Date: Mon, 8 Jan 2024 20:20:20 +0100 Subject: factor --- i_ui.go | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'i_ui.go') diff --git a/i_ui.go b/i_ui.go index f81e04c..2d5294e 100644 --- a/i_ui.go +++ b/i_ui.go @@ -43,7 +43,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * hardflip: src/i_ui.go - * Mon Jan 08 12:18:01 2024 + * Mon Jan 08 14:53:10 2024 * Joe * * interfacing with the user @@ -61,8 +61,6 @@ type HardUI struct { s tcell.Screen mode uint8 sel_max int - count_dirs int - count_hosts int def_style tcell.Style dir_style tcell.Style title_style tcell.Style @@ -321,7 +319,6 @@ func i_info_panel(ui HardUI, lhost *HostList) { if lhost.head == nil { return } - // HACK: litems instead of this mess // host = lhost.sel(ui.sel_id) host_type = host.protocol_str() // name, type @@ -481,20 +478,11 @@ func i_info_panel(ui HardUI, lhost *HostList) { } } -func i_get_sel_max(ldirs *DirsList) (int, int, int) { - count_dirs, count_hosts := ldirs.count() - - count_dirs -= 1 - return count_dirs + count_hosts, count_dirs, count_hosts -} - func i_ui(data *HardData) { // TODO: replace everything ui with litems var err error ui := &data.ui - // TODO: get better counts - // NOTE: put this in c_load_data and also produce better code - ui.sel_max, ui.count_dirs, ui.count_hosts = i_get_sel_max(data.ldirs) + ui.sel_max = data.litems.last.ID ui.s, err = tcell.NewScreen() if err != nil { -- cgit v1.2.3