git: 9front

Download patch

ref: 0260be4e9f73d03d30b9294323056695c82cbb2f
parent: 32077be8e30da961d61a7ad57f302bdae45f7de5
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Jan 7 00:24:14 EST 2026

samterm: dont burn 100% cpu when button 2 scrolling

Fix buggy behaviour introduced in commit:

479ecb171f1221861208ad62bc8b3ee412644489 samterm: Make scrollbar act like rio's

Do blocking readmouse() to get next mouse
event instead of the nbrecv() when using
button 2 scrolling.

--- a/sys/src/cmd/samterm/scroll.c
+++ b/sys/src/cmd/samterm/scroll.c
@@ -104,6 +104,8 @@
 			o = (tot / (s.max.y - s.min.y)) * my;
 			n = 0;
 			forcenter(l, o, n);
+			if(readmouse(mousectl) < 0)
+				panic("mouse");
 		}else{
 			o = l->origin;
 			n = my/l->f.font->height;
@@ -120,8 +122,8 @@
 				sleep(175);
 			}
 			sleep(25);
+			if(nbrecv(mousectl->c, mousectl) < 0)
+				panic("mouse");
 		}
-		if(nbrecv(mousectl->c, mousectl) < 0)
-			panic("mouse");
 	}while(mousectl->buttons & (1 << (but-1)));
 }
--