Skip to content

Commit 6a8f41f

Browse files
committed
Keep footer unless something actually changes
Signed-off-by: krissetto <chrisjpetito@gmail.com>
1 parent 164c8d1 commit 6a8f41f

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

pkg/tui/handlers.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,21 @@ import (
2828

2929
// Session management handlers
3030

31+
func (a *appModel) applyKeyboardEnhancements() {
32+
if a.keyboardEnhancements != nil {
33+
updated, _ := a.chatPage.Update(*a.keyboardEnhancements)
34+
a.chatPage = updated.(chat.Page)
35+
}
36+
}
37+
3138
func (a *appModel) handleNewSession() (tea.Model, tea.Cmd) {
3239
// Theme is now global - no per-session theme reset needed
3340
a.application.NewSession()
3441
sess := a.application.Session()
3542
a.sessionState = service.NewSessionState(sess)
3643
a.chatPage = chat.New(a.application, a.sessionState)
3744
a.dialog = dialog.New()
38-
a.statusBar.SetHelp(a.chatPage)
45+
a.applyKeyboardEnhancements()
3946

4047
return a, tea.Batch(
4148
a.Init(),
@@ -82,7 +89,7 @@ func (a *appModel) handleLoadSession(sessionID string) (tea.Model, tea.Cmd) {
8289
a.sessionState = service.NewSessionState(sess)
8390
a.chatPage = chat.New(a.application, a.sessionState)
8491
a.dialog = dialog.New()
85-
a.statusBar.SetHelp(a.chatPage)
92+
a.applyKeyboardEnhancements()
8693

8794
return a, tea.Batch(
8895
a.Init(),

pkg/tui/tui.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ type appModel struct {
5252
themeWatcherEventCh chan string // Channel for theme file change events (carries themeRef)
5353
themeListenerStarted bool // Guard to prevent multiple listeners
5454

55+
// keyboardEnhancements stores the last keyboard enhancements message from the terminal.
56+
// This is reapplied to new chat/editor instances when sessions are switched.
57+
keyboardEnhancements *tea.KeyboardEnhancementsMsg
58+
5559
ready bool
5660
err error
5761
}
@@ -255,6 +259,8 @@ func (a *appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
255259
return a, cmd
256260

257261
case tea.KeyboardEnhancementsMsg:
262+
// Store the keyboard enhancements message so we can reapply it to new chat pages
263+
a.keyboardEnhancements = &msg
258264
updated, cmd := a.chatPage.Update(msg)
259265
a.chatPage = updated.(chat.Page)
260266
return a, cmd

0 commit comments

Comments
 (0)