aboutsummaryrefslogtreecommitdiff
path: root/text.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-05-22 14:50:41 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-05-22 14:50:41 +0200
commit300b431cf2bcd362d0db3d106909a39fb1854e4b (patch)
tree349ca8c666a870a8f3d05be2cc473362b1565ca2 /text.go
parentea653ce3bf266fb3c3f6b917b3924b0328f5d4a4 (diff)
Fix tab position
Diffstat (limited to 'text.go')
-rw-r--r--text.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/text.go b/text.go
index d13f766..ff21e18 100644
--- a/text.go
+++ b/text.go
@@ -45,7 +45,9 @@ func (f Font) putchar(c *bufio.Writer, s string, scale Unit, off *Point) {
}
off.Y += gl.W * scale
} else if ch == '\t' {
- off.Y += f[' '].W * 8 * scale
+ tab := 8 * f['W'].W * scale // widest char
+ pos := int(off.Y / tab)
+ off.Y = Unit(pos+1) * tab
}
}
off.X += height * scale