From 0746f3de04c81e39f5602e6822e2dbb45e1fa89b Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Tue, 24 Dec 2024 17:41:07 +0200 Subject: Selected message resets when focus is lost --- internal/client/ui/core/chat/chat.go | 1 + internal/client/ui/core/core.go | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'internal') diff --git a/internal/client/ui/core/chat/chat.go b/internal/client/ui/core/chat/chat.go index f2b0362..90e8d0d 100644 --- a/internal/client/ui/core/chat/chat.go +++ b/internal/client/ui/core/chat/chat.go @@ -194,6 +194,7 @@ func (m *Model) Focus() { func (m *Model) Blur() { m.focus = false + m.index = -1 m.vi.Blur() } diff --git a/internal/client/ui/core/core.go b/internal/client/ui/core/core.go index b1ed7e3..46eaca5 100644 --- a/internal/client/ui/core/core.go +++ b/internal/client/ui/core/core.go @@ -339,15 +339,18 @@ func (m *Model) move(direction int) { focus := m.focus + direction m.focus = max(0, min(FocusMax-1, focus)) - m.networkList.Blur() - m.frequencyList.Blur() - m.chat.Blur() switch m.focus { case FocusNetworkList: + m.frequencyList.Blur() + m.chat.Blur() m.networkList.Focus() case FocusFrequencyList: + m.networkList.Blur() + m.chat.Blur() m.frequencyList.Focus() case FocusChat: + m.networkList.Blur() + m.frequencyList.Blur() m.chat.Focus() default: assert.Never("missing switch statement field in move", "focus", m.focus) -- cgit v1.3.1