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 | 6fb701c81ac549ef3e7f0f288456a8eb8103c155 (patch) | |
tree | fbe56b5000982a7e1c43d57c29c6035c7fa8bc9d | |
parent | mixed is good (diff) | |
download | hardflip-6fb701c81ac549ef3e7f0f288456a8eb8103c155.tar.gz hardflip-6fb701c81ac549ef3e7f0f288456a8eb8103c155.tar.bz2 hardflip-6fb701c81ac549ef3e7f0f288456a8eb8103c155.tar.xz hardflip-6fb701c81ac549ef3e7f0f288456a8eb8103c155.tar.zst hardflip-6fb701c81ac549ef3e7f0f288456a8eb8103c155.zip |
this is going forward
Diffstat (limited to '')
-rw-r--r-- | c_hardflip.go | 12 | ||||
-rw-r--r-- | i_ui.go | 23 |
2 files changed, 23 insertions, 12 deletions
diff --git a/c_hardflip.go b/c_hardflip.go index 6e33d98..9451056 100644 --- a/c_hardflip.go +++ b/c_hardflip.go @@ -43,7 +43,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * hardflip: src/c_hardflip.go - * Tue Dec 26 14:40:37 2023 + * Thu Jan 04 15:37:01 2024 * Joe * * the main @@ -69,6 +69,15 @@ type HardData struct { ptr HardPtr } +func c_reset_ptr(data *HardData) { + if data.ptr = data.ldirs.head.lhost.head; data.ptr != nil { + data.ui.line = 1 + return + } + data.ptr = data.ldirs.head.next + data.ui.line = 1 +} + func main() { data_dir := c_get_data_dir() opts := HardOpts{true, true, false} @@ -81,6 +90,7 @@ func main() { data_dir, nil, } + c_reset_ptr(&data) // for ptr = ldirs.head; ptr != nil ; ptr = ptr.next { // spaces := "" @@ -43,7 +43,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * hardflip: src/i_ui.go - * Thu 04 Jan 2024 12:03:11 PM CET + * Thu Jan 04 15:36:48 2024 * Joe * * interfacing with the user @@ -74,6 +74,17 @@ type HardUI struct { 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 + } + 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 { + ui.list_start = ui.line + } } func i_draw_text(s tcell.Screen, @@ -533,15 +544,5 @@ func i_ui(data *HardData) { } ui.s.Show() i_events(data) - if ui.line >= ui.sel_max { - ui.line = ui.sel_max - 1 - } else if ui.line < 0 { - ui.line = 0 - } - if int(ui.line) > ui.list_start + ui.dim[H] - 4 { - ui.list_start = int(ui.line + 1) - ui.dim[H] + 3 - } else if int(ui.line) < ui.list_start { - ui.list_start = int(ui.line) - } } } |