fix: full-width extensions divider in slash command popup

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.
This commit is contained in:
patriceckhart 2026-05-25 17:08:54 +02:00
parent 5293277d36
commit 66847247b3

View file

@ -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, "")