From ed7cdb046749b9464e8f8a8bdb8a3abc130ec6fe Mon Sep 17 00:00:00 2001 From: Slug-Boi Date: Fri, 15 Nov 2024 12:39:12 +0100 Subject: [PATCH] fix: fix group overflow in tui --- src/cmd/tui/tui_groups.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/cmd/tui/tui_groups.go b/src/cmd/tui/tui_groups.go index a44ad7a..4e3de40 100644 --- a/src/cmd/tui/tui_groups.go +++ b/src/cmd/tui/tui_groups.go @@ -111,8 +111,21 @@ func (m mainModel) View() string { 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 += helpStyle.Render("\ntab/right: focus next • left: focus previous • enter: select group • q/esq: exit\n") return s }