shithub: riscv

Download patch

ref: 83d5c827b7a9d3206be9d68a34e59e291e2c5143
parent: f80b35faca0eb1bc3b6f909c6fbd127e595d4859
author: cinap_lenrek <[email protected]>
date: Sat Apr 22 18:52:34 EDT 2017

vt: handle underline attribute

--- a/sys/src/cmd/vt/main.c
+++ b/sys/src/cmd/vt/main.c
@@ -340,6 +340,7 @@
 	uchar *ap, *cp;
 	Image *c;
 	Rune *rp;
+	Point p, q;
 
 	draw(screen, screen->r, bgcolor, nil, ZP);
 
@@ -370,9 +371,16 @@
 			ap = onscreena(x, y);
 			cp = onscreenc(x, y);
 			c = fgcol(*ap, *cp);
-			for(n = 1; x+n <= xmax && rp[n] != 0 && fgcol(ap[n], cp[n]) == c; n++)
+			for(n = 1; x+n <= xmax && rp[n] != 0 && fgcol(ap[n], cp[n]) == c
+			&& (ap[n] ^ *ap) & TUnderline == 0; n++)
 				;
-			runestringn(screen, pt(x, y), c, ZP, font, rp, n);
+			p = pt(x, y);
+			q = runestringn(screen, p, c, ZP, font, rp, n);
+			if(*ap & TUnderline){
+				p.y += font->ascent+1;
+				q.y += font->ascent+2;
+				draw(screen, Rpt(p, q), c, nil, ZP);
+			}
 		}
 		if(*onscreenr(x, y) == 0)
 			runestringn(screen, pt(x, y),