diff options
-rw-r--r-- | i_events.go | 2 | ||||
-rw-r--r-- | i_ui.go | 15 |
2 files changed, 7 insertions, 10 deletions
diff --git a/i_events.go b/i_events.go index 1a8b4ca..9d5adce 100644 --- a/i_events.go +++ b/i_events.go @@ -102,7 +102,7 @@ func i_events(data *HardData) { event.Key() == tcell.KeyUp { ui.inc_sel(-1, data) } else if event.Key() == tcell.KeyCtrlD { - ui.inc_sel(ui.dim[H] / 4, data) + ui.inc_sel(+(ui.dim[H] / 4), data) } else if event.Key() == tcell.KeyCtrlU { ui.inc_sel(-(ui.dim[H] / 4), data) } else if event.Rune() == 'g' { @@ -63,7 +63,6 @@ type HardUI struct { list_start int mode uint8 sel_max int - sel_id int count_dirs int count_hosts int def_style tcell.Style @@ -73,17 +72,14 @@ type HardUI struct { } func (ui *HardUI) inc_sel(n int, data *HardData) { - // HACK: ui.sel_id and litems.curr.ID are essentially the same thing - // NOTE: maybe keep only one there, see later if data.litems.curr == nil { return } data.litems.curr = data.litems.curr.inc(n) - ui.sel_id = data.litems.curr.ID - if ui.sel_id > ui.list_start + ui.dim[H] - 4 { - ui.list_start = (ui.sel_id + 1) - (ui.dim[H] + 3) - } else if ui.sel_id < ui.list_start { - ui.list_start = ui.sel_id + if data.litems.curr.ID > ui.list_start + ui.dim[H] - 4 { + ui.list_start = (data.litems.curr.ID + 1) - (ui.dim[H] + 3) + } else if data.litems.curr.ID < ui.list_start { + ui.list_start = data.litems.curr.ID } } @@ -358,7 +354,8 @@ func i_info_panel(ui HardUI, lhost *HostList) { if lhost.head == nil { return } - host = lhost.sel(ui.sel_id) + // HACK: litems instead of this mess + // host = lhost.sel(ui.sel_id) host_type = host.protocol_str() // name, type i_draw_text(ui.s, |