From 25c062e2d706e5d6e80351dae23aec8c8a48fa11 Mon Sep 17 00:00:00 2001 From: xqrs <3bd3bdr@gmail.com> Date: Sun, 1 Feb 2026 22:35:07 +0300 Subject: [PATCH] fix(ui/chat): add fallbacks for cycle between widgets (#731) --- internal/ui/chat/view.go | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/internal/ui/chat/view.go b/internal/ui/chat/view.go index b91728b..552871b 100644 --- a/internal/ui/chat/view.go +++ b/internal/ui/chat/view.go @@ -155,12 +155,16 @@ func (v *View) focusMessageInput() bool { func (v *View) focusPrevious() { switch v.app.GetFocus() { - case v.guildsTree: - v.focusMessageInput() case v.messagesList: // Handle both a.messagesList and a.flex as well as other edge cases (if there is). - if ok := v.focusGuildsTree(); !ok { - v.app.SetFocus(v.messageInput) + if v.focusGuildsTree() { + return } + fallthrough + case v.guildsTree: + if v.focusMessageInput() { + return + } + fallthrough case v.messageInput: v.app.SetFocus(v.messagesList) } @@ -168,14 +172,18 @@ func (v *View) focusPrevious() { func (v *View) focusNext() { switch v.app.GetFocus() { + case v.messagesList: + if v.focusMessageInput() { + return + } + fallthrough + case v.messageInput: // Handle both a.messageInput and a.flex as well as other edge cases (if there is). + if v.focusGuildsTree() { + return + } + fallthrough case v.guildsTree: v.app.SetFocus(v.messagesList) - case v.messagesList: - v.focusMessageInput() - case v.messageInput: // Handle both a.messageInput and a.flex as well as other edge cases (if there is). - if ok := v.focusGuildsTree(); !ok { - v.app.SetFocus(v.messagesList) - } } }