From c2ab5210d056b27166777676cd5165eaebefb913 Mon Sep 17 00:00:00 2001 From: Engin Date: Mon, 2 Sep 2024 21:29:29 +0300 Subject: [PATCH] Calculate dash count even have any unicode char --- header.go | 2 +- widget.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/header.go b/header.go index fa83a93..0dc7995 100644 --- a/header.go +++ b/header.go @@ -164,7 +164,7 @@ func (h *header) SendIsTerminalSizeEnough(isEnough bool) { func (h *header) calculateTitleLength() { var titleLen int for _, hdr := range h.headers { - titleLen += len(hdr.title) + titleLen += len([]rune(hdr.title)) titleLen += h.properties.leftTabPadding + h.properties.rightTabPadding titleLen += 2 // for the border between titles } diff --git a/widget.go b/widget.go index 63c59e0..1690fd6 100644 --- a/widget.go +++ b/widget.go @@ -223,7 +223,7 @@ func (w *widget) Update(msg tea.Msg) (*widget, tea.Cmd) { func (w *widget) calculateWidgetLength() { var widgetLen int for _, widget := range w.widgets { - widgetLen += len(widget.Value) + widgetLen += len([]rune(widget.Value)) widgetLen += w.properties.leftTabPadding + w.properties.rightTabPadding widgetLen += 2 // for the border between widgets }