ref: 69d4e9e10a45517ad32d399bfbf61390d5a43208
parent: f22e9bf91474c356d6783293e05991013171a0bc
author: Aidan K. Wiggins <akw@oneiri.one>
date: Sat Mar 15 17:30:06 EDT 2025
Use Rio's scrollbar intervals. Sam originally used the following scrollbar indexing: ———————————————— |[0]| |[1]| |[2]| ... I changed it so that we could use the first line to scroll as well: ———————————————— |[1]| |[2]| |[3]| ... Effectively meaning that we go up/down by n lines when we click the nth line. But what we actually want is the arbitrary map: ———————————————— |[1]| |[1]| |[2]| |[3]| ... This is what Rio uses: attribute special meaning to the first line, and otherwise *jump* to line clicked.
--- a/samterm/scroll.c
+++ b/samterm/scroll.c
@@ -160,10 +160,10 @@
p0 = 0;
o = (tot / (s.max.y - s.min.y)) * (my - s.min.y);
}else{
- p0 = (but == 1 || but == 4)? -1: 1;
- p0 *= (my - s.min.y)/l->f.font->height+1;
+ p0 = (my - s.min.y)/l->f.font->height;
+ p0 += p0 == 0;
+ p0 *= (but == 1 || but == 4)? -1: 1;
o = l->origin;
-
}
mouseunblock();
center(l, o, p0, 1);