Use runewidth to increment x in TextView

This commit is contained in:
garsue 2021-05-29 19:48:02 +09:00
parent 0094cba5ea
commit 78b038e687
1 changed files with 2 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package widgets
import ( import (
ui "github.com/gizak/termui" ui "github.com/gizak/termui"
"github.com/mattn/go-runewidth"
) )
type ToggleText interface { type ToggleText interface {
@ -70,7 +71,7 @@ func (t *TextView) Buffer() ui.Buffer {
for _, ch := range line { for _, ch := range line {
cell = ui.Cell{Ch: ch, Fg: t.TextFgColor, Bg: t.TextBgColor} cell = ui.Cell{Ch: ch, Fg: t.TextFgColor, Bg: t.TextBgColor}
buf.Set(x, y, cell) buf.Set(x, y, cell)
x++ x = x + runewidth.RuneWidth(ch)
} }
x = t.Block.X + t.padding[0] x = t.Block.X + t.padding[0]
y++ y++