shithub: vdiff

Download patch

ref: 993cc78a865dd03801b8f01e208e32de07840beb
parent: e3edf164fb6691ef6e98e477a2412cc0e3f55340
author: phil9 <telephil9@gmail.com>
date: Wed Mar 2 00:00:41 EST 2022

fix tab printing (thanks qwx)

--- a/vdiff.c
+++ b/vdiff.c
@@ -69,8 +69,8 @@
 	draw(screen, r, cols[l->t].bg, nil, ZP);
 	p = Pt(r.min.x + Hpadding, r.min.y + (Dy(r)-font->height)/2);
 	off = Δpan / stringwidth(font, " ");
-	for(s = l->s, nc = 0, tab = 0; *s; nc++, tab--, off--){
-		if(*s == '\t'){
+	for(s = l->s, nc = -1, tab = 0; *s; nc++, tab--, off--){
+		if(tab <= 0 && *s == '\t'){
 			tab = 4 - nc % 4;
 			s++;
 		}