fix(chat): hide redundant help actions
This commit is contained in:
parent
235cecb3eb
commit
8d8e855777
2 changed files with 23 additions and 12 deletions
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue