ref: c593a3efa4079f5b79702bf3bb3213e2448c8888
parent: dbb671ecef53dad19cb42f61dfe782e65ca9be68
author: phil9 <[email protected]>
date: Mon Feb 1 04:11:13 EST 2021
truncate and add ellipsis to long lines
--- a/vdiff.c
+++ b/vdiff.c
@@ -44,6 +44,7 @@
Line **lines;
int lsize;
int lcount;
+const char ellipsis[] = "...";
void
drawline(Rectangle r, Line *l)
@@ -58,7 +59,10 @@
for(s = l->s; *s; s++){
if(*s == '\t')
p = string(screen, p, display->black, ZP, font, " ");
- else
+ else if((p.x+Hpadding+stringwidth(font, " ")+stringwidth(font, ellipsis)>=textr.max.x)){
+ string(screen, p, display->black, ZP, font, ellipsis);
+ break;
+ }else
p = stringn(screen, p, display->black, ZP, font, s, 1);
}
}