Skip to content

Commit

Permalink
Properly draw wide characters in topbar widgets (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
kimtore committed Dec 24, 2023
1 parent 99f07b5 commit 6cb49ef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion widgets/topbar.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/ambientsound/pms/topbar"
"github.com/gdamore/tcell/v2"
"github.com/gdamore/tcell/v2/views"
`github.com/mattn/go-runewidth`
)

// Pieces may be aligned to left, center or right.
Expand Down Expand Up @@ -79,7 +80,7 @@ func (w *Topbar) Draw() {
func (w *Topbar) drawNext(x, y int, s string, style tcell.Style) int {
for _, r := range s {
w.view.SetContent(x, y, r, nil, style)
x++
x += runewidth.RuneWidth(r)
}
return x
}
Expand Down

0 comments on commit 6cb49ef

Please sign in to comment.