Skip to content

Commit

Permalink
Fix string width for different sized tabs
Browse files Browse the repository at this point in the history
Fixes #475
  • Loading branch information
zyedidia committed Dec 6, 2016
1 parent 44fa0d7 commit 67ac3f1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/micro/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down

0 comments on commit 67ac3f1

Please sign in to comment.