From 91899b14945d004e4e9fce65097d02b2cf1697cf Mon Sep 17 00:00:00 2001 From: ayntgl Date: Sun, 20 Feb 2022 19:09:58 +0400 Subject: [PATCH] feat(ui): do not display channel name in messages TextView title --- ui/handlers.go | 13 +++++++++---- ui/util.go | 10 ---------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/ui/handlers.go b/ui/handlers.go index 1f37d8e..a51b769 100644 --- a/ui/handlers.go +++ b/ui/handlers.go @@ -43,8 +43,7 @@ func onGuildsListSelected(app *App, guildIdx int) { app.SelectedMessage = -1 app.MessagesTextView. Highlight(). - Clear(). - SetTitle("") + Clear() app.MessageInputField.SetText("") // If the user is a bot account, the direct messages item does not exist in the guilds list. @@ -138,8 +137,6 @@ func onChannelsTreeViewSelected(app *App, n *tview.TreeNode) { } app.SelectedChannel = c - - app.MessagesTextView.SetTitle(channelToString(c)) app.SetFocus(app.MessageInputField) go func() { @@ -255,6 +252,14 @@ func onMessagesTextViewInputCapture(app *App, e *tcell.EventKey) *tcell.EventKey app.SetRoot(messageActionsList, true) + return nil + case "Esc": + app.SelectedMessage = -1 + app.SetFocus(app.MainFlex) + app.MessagesTextView. + Clear(). + Highlight() + return nil } diff --git a/ui/util.go b/ui/util.go index a713f0e..ff49b85 100644 --- a/ui/util.go +++ b/ui/util.go @@ -42,13 +42,3 @@ func channelToString(c *discordgo.Channel) string { return repr } - -func hasKeybinding(ks []string, k string) bool { - for _, repr := range ks { - if repr == k { - return true - } - } - - return false -}