diff options
author | Joe <rbo@gmx.us> | 2023-12-21 20:20:20 +0100 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2023-12-21 20:20:20 +0100 |
commit | cd5c1143d377c6238ccea57862bd20d4f997ca77 (patch) | |
tree | 925b5db30d66e3f2f20999d139302a359f38ada2 /i_ui.go | |
parent | cool delete (diff) | |
download | hardflip-cd5c1143d377c6238ccea57862bd20d4f997ca77.tar.gz hardflip-cd5c1143d377c6238ccea57862bd20d4f997ca77.tar.bz2 hardflip-cd5c1143d377c6238ccea57862bd20d4f997ca77.tar.xz hardflip-cd5c1143d377c6238ccea57862bd20d4f997ca77.tar.zst hardflip-cd5c1143d377c6238ccea57862bd20d4f997ca77.zip |
fixed segv
Diffstat (limited to 'i_ui.go')
-rw-r--r-- | i_ui.go | 22 |
1 files changed, 17 insertions, 5 deletions
@@ -237,11 +237,18 @@ func i_host_panel(ui HardUI, lhost *HostList) { style, host.Folder + host.Name + spaces) host = host.next } - i_draw_text(ui.s, - 1, ui.dim[H] - 2, (ui.dim[W] / 3) - 1, ui.dim[H] - 2, - ui.def_style, - " " + strconv.Itoa(int(ui.sel + 1)) + "/" + - strconv.Itoa(int(ui.sel_max)) + " hosts ") + if ui.sel_max == 0 { + i_draw_text(ui.s, + 1, ui.dim[H] - 2, (ui.dim[W] / 3) - 1, ui.dim[H] - 2, + ui.def_style, + " " + strconv.Itoa(int(ui.sel_max)) + " hosts ") + } else { + i_draw_text(ui.s, + 1, ui.dim[H] - 2, (ui.dim[W] / 3) - 1, ui.dim[H] - 2, + ui.def_style, + " " + strconv.Itoa(int(ui.sel + 1)) + "/" + + strconv.Itoa(int(ui.sel_max)) + " hosts ") + } } func i_info_panel(ui HardUI, lhost *HostList) { @@ -455,6 +462,11 @@ func i_ui(data *HardData) { } ui.s.Show() i_events(data) + if ui.sel > ui.sel_max { + ui.sel = ui.sel_max + } else if ui.sel < 0 { + ui.sel = 0 + } if int(ui.sel) > ui.list_start + ui.dim[H] - 4 { ui.list_start = int(ui.sel + 1) - ui.dim[H] + 3 } else if int(ui.sel) < ui.list_start { |