From 78b038e6874f9bcb5d95fc85ca1f49445d05ee82 Mon Sep 17 00:00:00 2001 From: garsue Date: Sat, 29 May 2021 19:48:02 +0900 Subject: [PATCH] Use runewidth to increment x in TextView --- widgets/view.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/widgets/view.go b/widgets/view.go index 1347de1..60166f0 100644 --- a/widgets/view.go +++ b/widgets/view.go @@ -2,6 +2,7 @@ package widgets import ( ui "github.com/gizak/termui" + "github.com/mattn/go-runewidth" ) type ToggleText interface { @@ -70,7 +71,7 @@ func (t *TextView) Buffer() ui.Buffer { for _, ch := range line { cell = ui.Cell{Ch: ch, Fg: t.TextFgColor, Bg: t.TextBgColor} buf.Set(x, y, cell) - x++ + x = x + runewidth.RuneWidth(ch) } x = t.Block.X + t.padding[0] y++