aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-01-15 20:20:20 +0100
committerJoe <rbo@gmx.us>2024-01-15 20:20:20 +0100
commit2f8a224b62402a32fc319f333722838e747bc7f3 (patch)
tree53b69c531aa3f060e3b938f46c5fddddacfb483a
parentfuck scrollbar (diff)
downloadhardflip-2f8a224b62402a32fc319f333722838e747bc7f3.tar.gz
hardflip-2f8a224b62402a32fc319f333722838e747bc7f3.tar.bz2
hardflip-2f8a224b62402a32fc319f333722838e747bc7f3.tar.xz
hardflip-2f8a224b62402a32fc319f333722838e747bc7f3.tar.zst
hardflip-2f8a224b62402a32fc319f333722838e747bc7f3.zip
honestly i dont know how this can work
-rw-r--r--i_events.go9
-rw-r--r--i_ui.go23
2 files changed, 30 insertions, 2 deletions
diff --git a/i_events.go b/i_events.go
index bdc4afe..1043bc5 100644
--- a/i_events.go
+++ b/i_events.go
@@ -63,12 +63,17 @@ func i_list_follow_cursor(litems *ItemsList, ui *HardUI) {
return
}
// HACK: find workaround to kill ids
- virt_id := litems.curr.ID - (ui.dim[H] - 4) + 4
+ scrolloff := 4
+ if litems.last.ID - (ui.dim[H] - 4) <= litems.draw.ID {
+ scrolloff = 0
+ }
+ virt_id := litems.curr.ID - (ui.dim[H] - 4) + scrolloff
for litems.draw.ID < virt_id &&
litems.draw.next != nil {
litems.draw = litems.draw.next
}
- for litems.draw.ID > litems.curr.ID - 4 &&
+ scrolloff = 4
+ for litems.draw.ID > litems.curr.ID - scrolloff &&
litems.draw.prev != nil {
litems.draw = litems.draw.prev
}
diff --git a/i_ui.go b/i_ui.go
index de1bb29..5c11d31 100644
--- a/i_ui.go
+++ b/i_ui.go
@@ -527,6 +527,28 @@ func i_info_panel(ui HardUI, litems *ItemsList) {
}
}
+func i_scrollhint(ui HardUI, litems *ItemsList) {
+ if litems.head == nil {
+ return
+ }
+ h := ui.dim[H] - 4
+ max := litems.last.ID
+ if max <= h {
+ return
+ }
+ if litems.draw.ID > 1 {
+ ui.s.SetContent(0, 0,
+ '▲',
+ nil, ui.def_style)
+ }
+ if max - litems.draw.ID > h {
+ ui.s.SetContent(0, ui.dim[H] - 2,
+ '▼',
+ nil, ui.def_style)
+ return
+ }
+}
+
func i_ui(data *HardData) {
var err error
ui := &data.ui
@@ -553,6 +575,7 @@ func i_ui(data *HardData) {
i_bottom_text(*ui)
i_host_panel(data.ui, data.opts.Icon, data.litems, data)
i_info_panel(data.ui, data.litems)
+ i_scrollhint(data.ui, data.litems)
if data.litems.head == nil {
i_draw_zhosts_box(*ui)
}