From 8d8e855777cbd39b9c587c264c1a05e94214562a Mon Sep 17 00:00:00 2001 From: ayn2op Date: Wed, 8 Jul 2026 20:23:51 -0400 Subject: [PATCH] fix(chat): hide redundant help actions --- internal/ui/chat/composer.go | 6 +++--- internal/ui/chat/keybinds.go | 29 ++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/internal/ui/chat/composer.go b/internal/ui/chat/composer.go index 20be16e..b4a8291 100644 --- a/internal/ui/chat/composer.go +++ b/internal/ui/chat/composer.go @@ -79,7 +79,7 @@ func newComposer(cfg *config.Config, chat *Model) *composer { SetPlaceholder(tview.NewLine(tview.NewSegment("Select a channel to start chatting", tcell.StyleDefault.Dim(true)))). SetClipboard( func(s string) { - _ = clipboard.Write(clipboard.FmtText, []byte(s)) + _ = clipboard.Write(clipboard.FmtText, []byte(s)) }, func() string { return string(clipboard.Read(clipboard.FmtText)) @@ -839,7 +839,7 @@ func (c *composer) ShortHelp() []keybind.Keybind { if c.chat.GetVisible(mentionsListLayerName) { cfg := c.cfg.Keybinds.MentionsList ccfg := c.cfg.Keybinds.Composer - short := []keybind.Keybind{cfg.SelectUp.Keybind, cfg.SelectDown.Keybind, ccfg.Cancel.Keybind} + short := []keybind.Keybind{cfg.SelectUp.Keybind, cfg.SelectDown.Keybind, ccfg.TabComplete.Keybind, ccfg.Cancel.Keybind} if c.canAttachFiles() { short = append(short, ccfg.OpenFilePicker.Keybind) } @@ -872,7 +872,7 @@ func (c *composer) FullHelp() [][]keybind.Keybind { } return [][]keybind.Keybind{ - {cfg.Send.Keybind, cfg.Newline.Keybind, cfg.Cancel.Keybind, cfg.TabComplete.Keybind, cfg.Undo.Keybind}, + {cfg.Send.Keybind, cfg.Newline.Keybind, cfg.Cancel.Keybind, cfg.Undo.Keybind}, openEditor, } } diff --git a/internal/ui/chat/keybinds.go b/internal/ui/chat/keybinds.go index 7d0de9b..0899adc 100644 --- a/internal/ui/chat/keybinds.go +++ b/internal/ui/chat/keybinds.go @@ -44,24 +44,35 @@ func (m *Model) activeKeyMap() help.KeyMap { func (m *Model) baseShortHelp() []keybind.Keybind { cfg := m.cfg.Keybinds - short := []keybind.Keybind{cfg.FocusGuildsTree.Keybind, cfg.FocusMessagesList.Keybind} - if !m.composer.Disabled() { - short = append(short, cfg.FocusComposer.Keybind) - } + short := m.focusHelp() short = append(short, cfg.ToggleGuildsTree.Keybind, cfg.ToggleChannelsPicker.Keybind) return short } func (m *Model) baseFullHelp() [][]keybind.Keybind { cfg := m.cfg.Keybinds - focus := []keybind.Keybind{cfg.FocusGuildsTree.Keybind, cfg.FocusMessagesList.Keybind} - if !m.composer.Disabled() { - focus = append(focus, cfg.FocusComposer.Keybind) - } return [][]keybind.Keybind{ - focus, + m.focusHelp(), {cfg.FocusPrevious.Keybind, cfg.FocusNext.Keybind}, {cfg.ToggleGuildsTree.Keybind, cfg.ToggleChannelsPicker.Keybind}, {cfg.Logout.Keybind}, } } + +func (m *Model) focusHelp() []keybind.Keybind { + kbs := m.cfg.Keybinds + focused := m.app.Focused() + focusKbs := make([]keybind.Keybind, 0, 3) + + if focused != m.guildsTree { + focusKbs = append(focusKbs, kbs.FocusGuildsTree.Keybind) + } + if focused != m.messagesList { + focusKbs = append(focusKbs, kbs.FocusMessagesList.Keybind) + } + if !m.composer.Disabled() && focused != m.composer { + focusKbs = append(focusKbs, kbs.FocusComposer.Keybind) + } + + return focusKbs +}