@@ -121,6 +121,9 @@ type appModel struct {
121121 // (shift+enter, ctrl+i vs tab, etc.).
122122 keyboardEnhancements * tea.KeyboardEnhancementsMsg
123123
124+ // keyboardEnhancementsSupported tracks whether the terminal supports keyboard enhancements
125+ keyboardEnhancementsSupported bool
126+
124127 // program holds a reference to the tea.Program so that we can
125128 // perform a full terminal release/restore cycle on focus events.
126129 program * tea.Program
@@ -246,20 +249,15 @@ func (m *appModel) SetProgram(p *tea.Program) {
246249 m .supervisor .SetProgram (p )
247250}
248251
249- // hasKeyboardEnhancements reports whether the terminal supports keyboard
250- // enhancements (Kitty keyboard protocol). When true, keybindings like
251- // shift+enter become available.
252- func (m * appModel ) hasKeyboardEnhancements () bool {
253- return m .keyboardEnhancements != nil && m .keyboardEnhancements .Flags != 0
254- }
255-
256252// reapplyKeyboardEnhancements forwards the cached keyboard enhancements message
257- // to the active editor so new/replaced instances pick up the terminal's key
258- // disambiguation support.
253+ // to the active chat page and editor so new/replaced instances pick up the
254+ // terminal's key disambiguation support.
259255func (m * appModel ) reapplyKeyboardEnhancements () {
260256 if m .keyboardEnhancements == nil {
261257 return
262258 }
259+ updated , _ := m .chatPage .Update (* m .keyboardEnhancements )
260+ m .chatPage = updated .(chat.Page )
263261 editorModel , _ := m .editor .Update (* m .keyboardEnhancements )
264262 m .editor = editorModel .(editor.Editor )
265263}
@@ -589,10 +587,14 @@ func (m *appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
589587
590588 case tea.KeyboardEnhancementsMsg :
591589 m .keyboardEnhancements = & msg
592- // Forward to editor (only component that uses it for keybinding config)
593- editorModel , cmd := m .editor .Update (msg )
590+ m .keyboardEnhancementsSupported = msg .Flags != 0
591+ // Forward to content view
592+ updated , cmd := m .chatPage .Update (msg )
593+ m .chatPage = updated .(chat.Page )
594+ // Forward to editor
595+ editorModel , editorCmd := m .editor .Update (msg )
594596 m .editor = editorModel .(editor.Editor )
595- return m , cmd
597+ return m , tea . Batch ( cmd , editorCmd )
596598
597599 // --- Keyboard input ---
598600
@@ -1494,7 +1496,7 @@ func (m *appModel) Bindings() []key.Binding {
14941496 ))
14951497
14961498 // Show newline help based on keyboard enhancement support
1497- if m .hasKeyboardEnhancements () {
1499+ if m .keyboardEnhancementsSupported {
14981500 bindings = append (bindings , key .NewBinding (
14991501 key .WithKeys ("shift+enter" ),
15001502 key .WithHelp ("Shift+Enter" , "newline" ),
@@ -2229,8 +2231,6 @@ func toFullscreenView(content, windowTitle string, working bool) tea.View {
22292231 view .MouseMode = tea .MouseModeCellMotion
22302232 view .BackgroundColor = styles .Background
22312233 view .WindowTitle = windowTitle
2232- view .ReportFocus = true
2233- view .KeyboardEnhancements .ReportEventTypes = true
22342234 if working {
22352235 view .ProgressBar = tea .NewProgressBar (tea .ProgressBarIndeterminate , 0 )
22362236 }
0 commit comments