From 108a9aee6da2b7a447bfbac8daf484655cd262bb Mon Sep 17 00:00:00 2001 From: Ismael Arias Date: Thu, 21 Jul 2022 20:31:32 +0200 Subject: [PATCH] Changed in the height of the list. Still broken when filtering (related to the itemDelegate and the simple list) --- internal/tui/common/styles.go | 2 +- internal/tui/group/update.go | 4 +++- internal/tui/user/update.go | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/internal/tui/common/styles.go b/internal/tui/common/styles.go index 9b069f0..2d1055e 100644 --- a/internal/tui/common/styles.go +++ b/internal/tui/common/styles.go @@ -7,7 +7,7 @@ var ( Width(35). PaddingRight(3). MarginRight(3). - Border(lipgloss.RoundedBorder(), false, true, false, false) + Border(lipgloss.RoundedBorder()) ListColorStyle = lipgloss.NewStyle(). Background(lipgloss.Color("#3d719c")) ListItemStyle = lipgloss.NewStyle(). diff --git a/internal/tui/group/update.go b/internal/tui/group/update.go index 842fc1c..0253f28 100644 --- a/internal/tui/group/update.go +++ b/internal/tui/group/update.go @@ -1,6 +1,7 @@ package group import ( + "github.com/ariasmn/ugm/internal/tui/common" "github.com/charmbracelet/bubbles/viewport" tea "github.com/charmbracelet/bubbletea" ) @@ -8,7 +9,8 @@ import ( func (bg BubbleGroup) Update (msg tea.Msg) (BubbleGroup, tea.Cmd) { switch msg := msg.(type) { case tea.WindowSizeMsg: - bg.list.SetSize(msg.Width, msg.Height) + h, v := common.ListStyle.GetFrameSize() + bg.list.SetSize(msg.Width-h, msg.Height-v) bg.viewport = viewport.New(msg.Width, msg.Height) bg.viewport.SetContent(bg.detailView()) } diff --git a/internal/tui/user/update.go b/internal/tui/user/update.go index a1b7fcf..ad9c2a9 100644 --- a/internal/tui/user/update.go +++ b/internal/tui/user/update.go @@ -1,6 +1,7 @@ package user import ( + "github.com/ariasmn/ugm/internal/tui/common" "github.com/charmbracelet/bubbles/viewport" tea "github.com/charmbracelet/bubbletea" ) @@ -8,7 +9,8 @@ import ( func (bu BubbleUser) Update(msg tea.Msg) (BubbleUser, tea.Cmd) { switch msg := msg.(type) { case tea.WindowSizeMsg: - bu.list.SetSize(msg.Width, msg.Height) + h, v := common.ListStyle.GetFrameSize() + bu.list.SetSize(msg.Width-h, msg.Height-v) bu.viewport = viewport.New(msg.Width, msg.Height) bu.viewport.SetContent(bu.detailView()) }