Diff
1diff --git a/tui/bubble.go b/tui/bubble.go
2index 209428cf89e3c522d9f2987f1d4b2fd5026a3516..891d86096172285bf84d85f69c9c82e5f2264f3f 100644
3--- a/tui/bubble.go
4+++ b/tui/bubble.go
5@@ -41,10 +41,9 @@ type MenuEntry struct {
6 }
7
8 type SessionConfig struct {
9- Width int
10- Height int
11- WindowChanges <-chan ssh.Window
12- InitialRepo string
13+ Width int
14+ Height int
15+ InitialRepo string
16 }
17
18 type Bubble struct {
19@@ -67,22 +66,21 @@ type Bubble struct {
20
21 func NewBubble(cfg *Config, sCfg *SessionConfig) *Bubble {
22 b := &Bubble{
23- config: cfg,
24- styles: style.DefaultStyles(),
25- width: sCfg.Width,
26- height: sCfg.Height,
27- windowChanges: sCfg.WindowChanges,
28- repoSource: cfg.RepoSource,
29- repoMenu: make([]MenuEntry, 0),
30- boxes: make([]tea.Model, 2),
31- initialRepo: sCfg.InitialRepo,
32+ config: cfg,
33+ styles: style.DefaultStyles(),
34+ width: sCfg.Width,
35+ height: sCfg.Height,
36+ repoSource: cfg.RepoSource,
37+ repoMenu: make([]MenuEntry, 0),
38+ boxes: make([]tea.Model, 2),
39+ initialRepo: sCfg.InitialRepo,
40 }
41 b.state = startState
42 return b
43 }
44
45 func (b *Bubble) Init() tea.Cmd {
46- return tea.Batch(b.windowChangesCmd, b.setupCmd)
47+ return b.setupCmd
48 }
49
50 func (b *Bubble) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
51@@ -108,19 +106,18 @@ func (b *Bubble) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
52 b.error = msg.Error()
53 b.state = errorState
54 return b, nil
55- case windowMsg:
56- cmds = append(cmds, b.windowChangesCmd)
57 case tea.WindowSizeMsg:
58 b.width = msg.Width
59 b.height = msg.Height
60 if b.state == loadedState {
61- ab, cmd := b.boxes[b.activeBox].Update(msg)
62- b.boxes[b.activeBox] = ab
63- if cmd != nil {
64- cmds = append(cmds, cmd)
65+ for i, bx := range b.boxes {
66+ m, cmd := bx.Update(msg)
67+ b.boxes[i] = m
68+ if cmd != nil {
69+ cmds = append(cmds, cmd)
70+ }
71 }
72 }
73- // XXX: maybe propagate size changes to child bubbles (particularly height)
74 case selection.SelectedMsg:
75 b.activeBox = 1
76 rb := b.repoMenu[msg.Index].bubble
77diff --git a/tui/commands.go b/tui/commands.go
78index 623cbedbf4c3ef166be5b29df7a35a27ecd2a36a..e57b133797340bcd0b4d15bc045d7fb9ab7b2bd9 100644
79--- a/tui/commands.go
80+++ b/tui/commands.go
81@@ -17,13 +17,6 @@ func (e errMsg) Error() string {
82 return e.err.Error()
83 }
84
85-func (b *Bubble) windowChangesCmd() tea.Msg {
86- w := <-b.windowChanges
87- b.width = w.Width
88- b.height = w.Height
89- return windowMsg{}
90-}
91-
92 func (b *Bubble) setupCmd() tea.Msg {
93 lipgloss.SetColorProfile(termenv.ANSI256)
94 b.repos = b.repoSource.AllRepos()
95diff --git a/tui/session.go b/tui/session.go
96index dff5618b5308ba6469a406f39afd34a5d3498890..da41a8471e6d866f617794cbc59f1a48e1dcd73c 100644
97--- a/tui/session.go
98+++ b/tui/session.go
99@@ -55,14 +55,13 @@ func SessionHandler(reposPath string, repoPoll time.Duration) func(ssh.Session)
100 default:
101 return nil, nil
102 }
103- pty, changes, active := s.Pty()
104+ pty, _, active := s.Pty()
105 if !active {
106 fmt.Println("not active")
107 return nil, nil
108 }
109 cfg.Width = pty.Window.Width
110 cfg.Height = pty.Window.Height
111- cfg.WindowChanges = changes
112 return NewBubble(appCfg, cfg), []tea.ProgramOption{tea.WithAltScreen()}
113 }
114 }