Skip to content

Commit 9635d2b

Browse files
committed
fix(ui): guard renderTrackInfo against negative panel width
Prevents makeslice panic when terminal is narrow enough that ui.PanelWidth - 4 becomes negative.
1 parent f308f18 commit 9635d2b

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

ui/model/view.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ func (m Model) renderTrackInfo() string {
223223
}
224224

225225
maxW := ui.PanelWidth - 4
226+
if maxW < 1 {
227+
return trackStyle.Render("♫ " + name)
228+
}
226229
nameRunes := []rune(name)
227230

228231
if album != "" {

0 commit comments

Comments
 (0)