shithub: vdict

Download patch

ref: 0bb5ea6bf8c90ee7527637efe5ccf545e7149043
parent: a573d608ce237a853699162955a6ed18999d370b
author: phil9 <telephil9@gmail.com>
date: Wed Mar 23 12:08:43 EDT 2022

display definition source

--- a/dview.c
+++ b/dview.c
@@ -52,6 +52,7 @@
 	int i, l, n, w, mw, inlink, cl;
 	Point p, lp;
 	Image *c;
+	char buf[1024] = {0};
 
 	n = 0;
 	w = 0;
@@ -67,8 +68,12 @@
 			w += stringnwidth(font, d->text+i, 1);
 		}
 	}
+	snprint(buf, sizeof buf, "From %s", d->db);
+	w = stringwidth(font, buf);
+	if(w > mw)
+		mw = w;
 	b = emalloc(sizeof *b);
-	b->r = Rect(0, 0, Padding + mw + Padding, Padding+(n+1)*font->height+Padding);
+	b->r = Rect(0, 0, Padding + mw + Padding, Padding+(n+2)*font->height+2*Padding);
 	b->b = allocimage(display, b->r, screen->chan, 0, DNofill);
 	draw(b->b, b->r, cols->back, nil, ZP);
 	p = Pt(Padding, Padding);
@@ -103,6 +108,9 @@
 			break;
 		}
 	}
+	p.x = Padding;
+	p.y += Padding;
+	string(b->b, p, cols->scrl, ZP, font, buf);
 	return b;
 }