From 3397a4426d0ce053e4ad65d000699eccbde991a1 Mon Sep 17 00:00:00 2001 From: ayn2op Date: Sun, 22 Mar 2026 16:00:42 -0400 Subject: [PATCH] refactor(ui/chat): migrate to command-based api for (*attachmentsPicker).close --- internal/ui/chat/attachments_picker.go | 10 ++++------ internal/ui/chat/keybinds.go | 4 ---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/internal/ui/chat/attachments_picker.go b/internal/ui/chat/attachments_picker.go index 0f0c088..6da2681 100644 --- a/internal/ui/chat/attachments_picker.go +++ b/internal/ui/chat/attachments_picker.go @@ -45,9 +45,9 @@ func (ap *attachmentsPicker) SetItems(items []attachmentItem) { ap.Model.SetItems(pickerItems) } -func (ap *attachmentsPicker) close() { +func (ap *attachmentsPicker) close() tview.Command { ap.chatView.RemoveLayer(attachmentsPickerLayerName) - ap.chatView.app.SetFocus(ap.chatView.messagesList) + return tview.SetFocus(ap.chatView.messagesList) } func (ap *attachmentsPicker) HandleEvent(event tview.Event) tview.Command { @@ -61,11 +61,9 @@ func (ap *attachmentsPicker) HandleEvent(event tview.Event) tview.Command { return nil } ap.items[index].open() - ap.close() - return nil + return ap.close() case *picker.CancelEvent: - ap.close() - return nil + return ap.close() } return ap.Model.HandleEvent(event) diff --git a/internal/ui/chat/keybinds.go b/internal/ui/chat/keybinds.go index 1bfa33b..5093a12 100644 --- a/internal/ui/chat/keybinds.go +++ b/internal/ui/chat/keybinds.go @@ -30,10 +30,6 @@ func (m *Model) activeKeyMap() help.KeyMap { return m.channelsPicker } - if m.app == nil { - return nil - } - switch m.app.Focused() { case m.guildsTree: return m.guildsTree