shithub: vdir

Download patch

ref: d03b0c36bceed888955d710d82e1af5564b8e55c
parent: 92ee06c644f4426dbe05a20aba234f15f1c8ccd3
author: phil9 <telephil9@gmail.com>
date: Wed Oct 6 14:38:17 EDT 2021

center icons vertically

	icons were not properly centered on their respective lines
	which was made visible using font with different sizes

--- a/vdir.c
+++ b/vdir.c
@@ -275,6 +275,7 @@
 	Image *img;
 	Point p;
 	Rectangle r;
+	int dy;
 
 	d = dirs[offset+n];
 	p = addpt(viewr.min, Pt(Toolpadding, Toolpadding));
@@ -286,7 +287,8 @@
 	free(t);
 	img = (d.qid.type&QTDIR) ? folder : file;
 	p.y -= Padding;
-	draw(screen, Rect(p.x, p.y+Padding, p.x+12, p.y+Padding+12), img, nil, ZP);
+	dy = (lineh-12)/2;
+	draw(screen, Rect(p.x, p.y+dy, p.x+12, p.y+dy+12), img, nil, ZP);
 	p.x += 12+4+Padding;
 	p.y += Padding;
 	string(screen, p, viewfg, ZP, font, d.name);