diff --git a/components/table/table.go b/components/table/table.go index 362b49f..3f1e32a 100644 --- a/components/table/table.go +++ b/components/table/table.go @@ -108,6 +108,13 @@ func (t *Model) SetSize(w, h int) { t.SetHeight(h) } +func (m *Model) SetRelWidths(percentages ...int) { + m.RelWidths = make([]int, 0) + m.RelWidths = append(m.RelWidths, percentages...) + + m.SetWidth(m.GetWidth()) +} + func (m *Model) GetHeight() int { return lipgloss.Height(m.View()) } diff --git a/components/viewport/viewport.go b/components/viewport/viewport.go index 721b7fd..93ffb6c 100644 --- a/components/viewport/viewport.go +++ b/components/viewport/viewport.go @@ -64,6 +64,12 @@ func (m *Model) Init() tea.Cmd { // Update updates the viewport model based on the received message. func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { + switch msg.(type) { + case tea.KeyMsg: + if !m.focused { + return m, nil + } + } t, cmd := m.Model.Update(msg) m.Model = &t diff --git a/layout/layout.go b/layout/layout.go index 92e364c..e8e162e 100644 --- a/layout/layout.go +++ b/layout/layout.go @@ -5,8 +5,6 @@ package layout // for styling and resizing. The package is designed to work with the Lipgloss library // for styling, providing a visually appealing interface. import ( - "log" - "github.com/charmbracelet/lipgloss" ) @@ -109,10 +107,7 @@ func (l *Layout) SetSize(width int, height int) { w := width - l.styles.Container.GetHorizontalFrameSize() h := height - l.styles.Container.GetVerticalFrameSize() - for i, item := range l.items { - if i == 3 { - log.Println("Status W", w) - } + for _, item := range l.items { item.SetWidth(w) }