diff options
author | Joe <rbo@gmx.us> | 2024-01-04 20:20:20 +0100 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2024-01-04 20:20:20 +0100 |
commit | 303764a80bf0e4a79a463d2dd41b7baad6c38038 (patch) | |
tree | 21a2e67b3e7c274a7ccdce329187140f80c5eb35 /i_ui.go | |
parent | works for now (diff) | |
download | hardflip-303764a80bf0e4a79a463d2dd41b7baad6c38038.tar.gz hardflip-303764a80bf0e4a79a463d2dd41b7baad6c38038.tar.bz2 hardflip-303764a80bf0e4a79a463d2dd41b7baad6c38038.tar.xz hardflip-303764a80bf0e4a79a463d2dd41b7baad6c38038.tar.zst hardflip-303764a80bf0e4a79a463d2dd41b7baad6c38038.zip |
awy
Diffstat (limited to 'i_ui.go')
-rw-r--r-- | i_ui.go | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -72,14 +72,13 @@ type HardUI struct { dim [2]int } -func (ui *HardUI) inc_sel(n int) { - ui.line += n - if ui.line < 1 { - ui.line = 1 - } - if ui.line >= ui.sel_max { - ui.line = ui.sel_max - 1 +func (ui *HardUI) inc_sel(n int, data *HardData) { + if ui.line + n < 1 || + ui.line + n >= ui.sel_max { + n = 0 } + ui.line += n + data.sel_unique_id(ui.line) if ui.line > ui.list_start + ui.dim[H] - 4 { ui.list_start = (ui.line + 1) - (ui.dim[H] + 3) } else if ui.line < ui.list_start { |