From 88803aa20ca7fd5a414bab93e12970fb88701558 Mon Sep 17 00:00:00 2001 From: Carlos A Becker Date: Mon, 1 Nov 2021 14:52:51 -0300 Subject: [PATCH] fix: resize effect on unselected repos --- internal/tui/bubble.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/tui/bubble.go b/internal/tui/bubble.go index 5353824e1..de3699111 100644 --- a/internal/tui/bubble.go +++ b/internal/tui/bubble.go @@ -7,7 +7,6 @@ import ( tea "github.com/charmbracelet/bubbletea" "github.com/charmbracelet/lipgloss" "github.com/charmbracelet/soft/internal/config" - "github.com/charmbracelet/soft/internal/git" "github.com/charmbracelet/soft/internal/tui/bubbles/repo" "github.com/charmbracelet/soft/internal/tui/bubbles/selection" "github.com/charmbracelet/soft/internal/tui/style" @@ -47,11 +46,13 @@ type Bubble struct { height int initialRepo string repoMenu []MenuEntry - repos []*git.Repo boxes []tea.Model activeBox int repoSelect *selection.Bubble session ssh.Session + + // remember the last resize so we can re-send it when selecting a different repo. + lastResize tea.WindowSizeMsg } func NewBubble(cfg *config.Config, sCfg *SessionConfig) *Bubble { @@ -96,6 +97,7 @@ func (b *Bubble) Update(msg tea.Msg) (tea.Model, tea.Cmd) { b.state = errorState return b, nil case tea.WindowSizeMsg: + b.lastResize = msg b.width = msg.Width b.height = msg.Height if b.state == loadedState { @@ -116,6 +118,9 @@ func (b *Bubble) Update(msg tea.Msg) (tea.Model, tea.Cmd) { rb := b.repoMenu[msg.Index].bubble rb.GotoTop() b.boxes[1] = b.repoMenu[msg.Index].bubble + cmds = append(cmds, func() tea.Msg { + return b.lastResize + }) } if b.state == loadedState { ab, cmd := b.boxes[b.activeBox].Update(msg)