Fix Menu Want Width

This commit is contained in:
2025-07-17 11:27:58 -05:00
parent 34f77473e6
commit c152a52304

View File

@@ -108,7 +108,7 @@ func (w *Menu) drawHMenu(screen tcell.Screen) {
x, y := w.x, w.y
if len(w.label) > 0 {
h.DrawText(x, y, w.label, st, screen)
x = x + len(w.label) + 1
x = x + len(w.label) + 2
}
x += 2
if w.expanded || (w.active && !w.manualExpand) {
@@ -116,7 +116,7 @@ func (w *Menu) drawHMenu(screen tcell.Screen) {
w.items[i].SetActive(w.active && w.cursor == i)
w.items[i].SetPos(Coord{X: x, Y: y})
w.items[i].Draw(screen)
x += w.items[i].WantW() + 1
x += w.items[i].WantW() + 2
}
}
}
@@ -168,6 +168,9 @@ func (w *Menu) WantW() int {
maxW = w.items[i].WantW()
}
}
if maxW < len(w.label) {
maxW = len(w.label)
}
return maxW
}