ref: c471b6bf820684b415d206b50ac09e80c14352ac
parent: b7f238577616a8ca247ef68ee00924cc9d0caf02
author: phil9 <telephil9@gmail.com>
date: Fri Feb 4 13:36:25 EST 2022
add galaxy brain scrolling to index allows scrolling with your usual click on mouse left/middle/right in the scrollbar.
--- a/index.c
+++ b/index.c
@@ -286,7 +286,7 @@
void
indexmouse(Mouse m)
{
- int sl;
+ int n;
if(!ptinrect(m.xy, viewr))
return;
@@ -298,11 +298,22 @@
}else if(m.buttons & 4){
select(indexat(m.xy), showc);
}else if(m.buttons & 8){
- sl = mousescrollsize(nlines);
- scroll(-sl);
+ n = mousescrollsize(nlines);
+ scroll(-n);
}else if(m.buttons & 16){
- sl = mousescrollsize(nlines);
- scroll(sl);
+ n = mousescrollsize(nlines);
+ scroll(n);
+ }
+ }else if(ptinrect(m.xy, scrollr)){
+ if(m.buttons & 1){
+ n = (m.xy.y - scrollr.min.y) / lineh;
+ scroll(-n);
+ }else if(m.buttons & 2){
+ offset = (m.xy.y - scrollr.min.y) * mbox->list->nelts / Dy(scrollr);
+ indexdrawsync();
+ }else if(m.buttons & 4){
+ n = (m.xy.y - scrollr.min.y) / lineh;
+ scroll(n);
}
}
}