Only allow focus on guilds tree if it exists (#350)

This commit is contained in:
cyberme0w 2024-03-01 08:10:44 +00:00 • committed by GitHub
parent 6e683a6526
commit c07731a98d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -57,7 +57,9 @@ func (mf *MainFlex) onInputCapture(event *tcell.EventKey) *tcell.EventKey {
return nil
case cfg.Keys.GuildsTree.Focus:
app.SetFocus(mf.guildsTree)
if mf.GetItemCount() == 2 {
app.SetFocus(mf.guildsTree)
}
return nil
case cfg.Keys.MessagesText.Focus:
app.SetFocus(mf.messagesText)