fix: fix group overflow in tui

This commit is contained in:
Slug-Boi
2024-11-15 12:39:12 +01:00
parent bbc2e758e5
commit ed7cdb0467
+13
View File
@@ -111,8 +111,21 @@ func (m mainModel) View() string {
squares = append(squares, modelStyle.Render(c)) squares = append(squares, modelStyle.Render(c))
} }
} }
// Take the first 5 elements and join them horizontally
// then take the next 5 and join them horizontally if there are more than 5
// then join vertically
//TODO: Figure out what width is measured in and tie the number 5 to a variable that
// is width_of_term/item_width
for len(squares) > 5 {
s += lipgloss.JoinHorizontal(lipgloss.Top, squares[:5]...)
s += "\n"
squares = squares[5:]
}
s += lipgloss.JoinHorizontal(lipgloss.Top, squares...) s += lipgloss.JoinHorizontal(lipgloss.Top, squares...)
//s += lipgloss.JoinHorizontal(lipgloss.Top, squares...)
s += helpStyle.Render("\ntab/right: focus next • left: focus previous • enter: select group • q/esq: exit\n") s += helpStyle.Render("\ntab/right: focus next • left: focus previous • enter: select group • q/esq: exit\n")
return s return s
} }