Truncate statues message from the left, not from the right

This commit is contained in:
Daisuke Maki 2014-07-15 13:17:49 +09:00
parent 065ca648c4
commit 529944a74a

View file

@ -70,8 +70,10 @@ func (v *View) printStatus(msg string) {
w, h := termbox.Size()
width := runewidth.StringWidth(msg)
if width > w {
msg = runewidth.Truncate(msg, width-(width-w), "")
for width > w {
_, rw := utf8.DecodeRuneInString(msg)
width = width - rw
msg = msg[rw:]
}
var pad []byte