From 65356499c0652d1ff2616b86503cd4bd08079568 Mon Sep 17 00:00:00 2001 From: ayntgl <90600421+ayntgl@users.noreply.github.com> Date: Wed, 2 Mar 2022 23:44:29 +0400 Subject: [PATCH] fix(ui): login screen loses focus on focus keybindings (#131) --- ui/app.go | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/ui/app.go b/ui/app.go index 4911600..822e6ae 100644 --- a/ui/app.go +++ b/ui/app.go @@ -75,19 +75,21 @@ func (app *App) onInputCapture(e *tcell.EventKey) *tcell.EventKey { return e } - switch e.Name() { - case app.Config.Keybindings.ToggleGuildsList: - app.SetFocus(app.GuildsList) - return nil - case app.Config.Keybindings.ToggleChannelsTreeView: - app.SetFocus(app.ChannelsTreeView) - return nil - case app.Config.Keybindings.ToggleMessagesTextView: - app.SetFocus(app.MessagesTextView) - return nil - case app.Config.Keybindings.ToggleMessageInputField: - app.SetFocus(app.MessageInputField) - return nil + if app.MainFlex.GetItemCount() != 0 { + switch e.Name() { + case app.Config.Keybindings.ToggleGuildsList: + app.SetFocus(app.GuildsList) + return nil + case app.Config.Keybindings.ToggleChannelsTreeView: + app.SetFocus(app.ChannelsTreeView) + return nil + case app.Config.Keybindings.ToggleMessagesTextView: + app.SetFocus(app.MessagesTextView) + return nil + case app.Config.Keybindings.ToggleMessageInputField: + app.SetFocus(app.MessageInputField) + return nil + } } return e