diff --git a/internal/config/config.toml b/internal/config/config.toml index 4279876..c92582b 100644 --- a/internal/config/config.toml +++ b/internal/config/config.toml @@ -113,8 +113,10 @@ open_editor = "Ctrl+E" open_file_picker = "Ctrl+Rune[\\]" [keys.mentions_list] -up = "Ctrl+P" -down = "Ctrl+N" +select_previous = "Ctrl+P" +select_next = "Ctrl+N" +select_first = "Home" +select_last = "End" # style = { foreground = "", background = "", attributes = "" or [""] } [theme.title] diff --git a/internal/config/keys.go b/internal/config/keys.go index a7c59e1..1031a17 100644 --- a/internal/config/keys.go +++ b/internal/config/keys.go @@ -8,23 +8,6 @@ type ( SelectLast string `toml:"select_last"` } - Keys struct { - FocusGuildsTree string `toml:"focus_guilds_tree"` - FocusMessagesList string `toml:"focus_messages_list"` - FocusMessageInput string `toml:"focus_message_input"` - FocusPrevious string `toml:"focus_previous"` - FocusNext string `toml:"focus_next"` - ToggleGuildsTree string `toml:"toggle_guilds_tree"` - - GuildsTree GuildsTreeKeys `toml:"guilds_tree"` - MessagesList MessagesListKeys `toml:"messages_list"` - MessageInput MessageInputKeys `toml:"message_input"` - MentionsList MentionsListKeys `toml:"mentions_list"` - - Logout string `toml:"logout"` - Quit string `toml:"quit"` - } - GuildsTreeKeys struct { SelectionKeys SelectCurrent string `toml:"select_current"` @@ -67,7 +50,23 @@ type ( } MentionsListKeys struct { - Up string `toml:"up"` - Down string `toml:"down"` + SelectionKeys + } + + Keys struct { + FocusGuildsTree string `toml:"focus_guilds_tree"` + FocusMessagesList string `toml:"focus_messages_list"` + FocusMessageInput string `toml:"focus_message_input"` + FocusPrevious string `toml:"focus_previous"` + FocusNext string `toml:"focus_next"` + ToggleGuildsTree string `toml:"toggle_guilds_tree"` + + GuildsTree GuildsTreeKeys `toml:"guilds_tree"` + MessagesList MessagesListKeys `toml:"messages_list"` + MessageInput MessageInputKeys `toml:"message_input"` + MentionsList MentionsListKeys `toml:"mentions_list"` + + Logout string `toml:"logout"` + Quit string `toml:"quit"` } ) diff --git a/internal/ui/chat/message_input.go b/internal/ui/chat/message_input.go index 46fe92a..79625e6 100644 --- a/internal/ui/chat/message_input.go +++ b/internal/ui/chat/message_input.go @@ -149,12 +149,19 @@ func (mi *messageInput) onInputCapture(event *tcell.EventKey) *tcell.EventKey { if mi.cfg.AutocompleteLimit > 0 { if mi.chatView.GetVisibile(mentionsListPageName) { + handler := mi.mentionsList.InputHandler() switch event.Name() { - case mi.cfg.Keys.MentionsList.Up: - mi.mentionsList.InputHandler()(tcell.NewEventKey(tcell.KeyUp, "", tcell.ModNone), nil) + case mi.cfg.Keys.MentionsList.SelectPrevious: + handler(tcell.NewEventKey(tcell.KeyUp, "", tcell.ModNone), nil) return nil - case mi.cfg.Keys.MentionsList.Down: - mi.mentionsList.InputHandler()(tcell.NewEventKey(tcell.KeyDown, "", tcell.ModNone), nil) + case mi.cfg.Keys.MentionsList.SelectNext: + handler(tcell.NewEventKey(tcell.KeyDown, "", tcell.ModNone), nil) + return nil + case mi.cfg.Keys.MentionsList.SelectFirst: + handler(tcell.NewEventKey(tcell.KeyHome, "", tcell.ModNone), nil) + return nil + case mi.cfg.Keys.MentionsList.SelectLast: + handler(tcell.NewEventKey(tcell.KeyEnd, "", tcell.ModNone), nil) return nil } }