shithub: pplay

Download patch

ref: 5f1c56ab00a3ec14d605920c084d233f098282b8
parent: d8dffc9593a6d0784d948732393e710acc65d1e1
author: qwx <qwx@sciops.net>
date: Mon Jan 30 22:54:17 EST 2023

draw: fix markers disappearing when panning zoomed in

--- a/draw.c
+++ b/draw.c
@@ -70,14 +70,12 @@
 static int
 drawpos(usize pos, Image *c)
 {
-	int x;
 	Rectangle r;
 
-	x = (pos - views) / T;
-	if(x <= views || x >= viewe)
+	if(pos <= views || pos >= viewe)
 		return 0;
 	r = view->r;
-	r.min.x += x;
+	r.min.x += (pos - views) / T;
 	r.max.x = r.min.x + 1;
 	draw(view, r, c, nil, ZP);
 	return 1;
@@ -93,8 +91,7 @@
 	for(p=views-off; p<viewe; p+=c->len, c=c->right){
 		if(p == 0)
 			continue;
-		if(!drawpos(p, col[Cchunk]) || c->len == 0)
-			break;
+		drawpos(p, col[Cchunk]);
 	}
 }
 
@@ -208,8 +205,8 @@
 	p = dot.pos;
 	lockdisplay(display);
 	drawview();
-	x = screen->r.min.x + (p - views) / T;
 	draw(screen, screen->r, view, nil, ZP);
+	x = screen->r.min.x + (p - views) / T;
 	liner.min.x = x;
 	liner.max.x = x + 1;
 	if(p >= views)