From 66847247b3ee4c6fe6ffe8fd2a6cbb4fffb6f862 Mon Sep 17 00:00:00 2001 From: patriceckhart Date: Mon, 25 May 2026 17:08:54 +0200 Subject: [PATCH] fix: full-width extensions divider in slash command popup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit len(label) counted bytes, but the leading "── " glyphs are multi-byte runes, so the rule was padded ~4 columns short of the right edge. Switched to runewidth.StringWidth(label) to match dialog_frame.go. --- internal/agent/modes/slash_suggest.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/agent/modes/slash_suggest.go b/internal/agent/modes/slash_suggest.go index f843175..69a3830 100644 --- a/internal/agent/modes/slash_suggest.go +++ b/internal/agent/modes/slash_suggest.go @@ -4,6 +4,8 @@ import ( "sort" "strings" + "github.com/mattn/go-runewidth" + "github.com/patriceckhart/zot/internal/tui" ) @@ -408,8 +410,10 @@ func (s *slashSuggester) Render(input string, th tui.Theme, width int) []string lines = append(lines, "") rule := strings.Repeat("─", width) label := "── " + c.Name + " " - if len(label) < width { - rule = label + strings.Repeat("─", width-len(label)) + // runewidth, not len: the leading "── " glyphs are multi-byte, + // so byte-length padding leaves the rule short of the right edge. + if lw := runewidth.StringWidth(label); lw < width { + rule = label + strings.Repeat("─", width-lw) } lines = append(lines, th.FG256(th.Muted, rule)) lines = append(lines, "")