From 67ac3f1a244913273ece41fe78208de635c1d6db Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Tue, 6 Dec 2016 09:09:24 -0500 Subject: [PATCH] Fix string width for different sized tabs Fixes #475 --- cmd/micro/view.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/micro/view.go b/cmd/micro/view.go index 61b9b140..80ca4942 100644 --- a/cmd/micro/view.go +++ b/cmd/micro/view.go @@ -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