feat(config)!: add additional selection keys to keys.mentions_list (#720)
This commit is contained in:
parent
2e7cd26517
commit
d700548d02
3 changed files with 33 additions and 25 deletions
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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"`
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue