Fix string width for different sized tabs

Fixes #475
This commit is contained in:
Zachary Yedidia
2016-12-06 09:09:24 -05:00
parent 44fa0d77ff
commit 67ac3f1a24

View File

@@ -889,6 +889,7 @@ func (v *View) DisplayView() {
v.drawCell(screenX-v.leftCol, screenY, ' ', nil, lineStyle)
}
}
strWidth += remainder
} else if runewidth.RuneWidth(ch) > 1 {
if screenX-v.x-v.leftCol >= v.lineNumOffset {
v.drawCell(screenX, screenY, ch, nil, lineStyle)
@@ -899,15 +900,16 @@ func (v *View) DisplayView() {
v.drawCell(screenX-v.leftCol, screenY, '<', nil, lineStyle)
}
}
strWidth += StringWidth(string(ch), tabSize)
} else {
if screenX-v.x-v.leftCol >= v.lineNumOffset {
v.drawCell(screenX-v.leftCol, screenY, ch, nil, lineStyle)
}
strWidth += StringWidth(string(ch), tabSize)
}
charNum = charNum.Move(1, v.Buf)
screenX++
colN++
strWidth += StringWidth(string(ch), tabSize)
}
// Here we are at a newline