feat(config)!: add additional selection keys to keys.mentions_list (#720)

This commit is contained in:
Ayyan 2026-01-19 22:03:38 -05:00 • committed by GitHub
parent 2e7cd26517
commit d700548d02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 33 additions and 25 deletions

View file

@ -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]

View file

@ -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"`
}
)

View file

@ -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
}
}