feat(ui/chat): add messages list scroll keys (#690)

This commit is contained in:
Ayyan 2026-01-06 00:14:54 -05:00 • committed by GitHub
parent 3322bc2892
commit 28857a9fb7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 3 deletions

View file

@ -69,6 +69,11 @@ select_previous = "Rune[k]"
select_next = "Rune[j]"
select_first = "Rune[g]"
select_last = "Rune[G]"
# Scroll the messages list without changing the selection.
scroll_up = "Rune[K]"
scroll_down = "Rune[J]"
scroll_top = "Home"
scroll_bottom = "End"
# Select the message reference (reply) of the selected channel.
select_reply = "Rune[s]"
# Reply to the selected message.

View file

@ -1,7 +1,7 @@
package config
type (
NavigationKeys struct {
SelectionKeys struct {
SelectPrevious string `toml:"select_previous"`
SelectNext string `toml:"select_next"`
SelectFirst string `toml:"select_first"`
@ -26,7 +26,7 @@ type (
}
GuildsTreeKeys struct {
NavigationKeys
SelectionKeys
SelectCurrent string `toml:"select_current"`
YankID string `toml:"yank_id"`
@ -35,7 +35,12 @@ type (
}
MessagesListKeys struct {
NavigationKeys
SelectionKeys
ScrollUp string `toml:"scroll_up"`
ScrollDown string `toml:"scroll_down"`
ScrollTop string `toml:"scroll_top"`
ScrollBottom string `toml:"scroll_bottom"`
SelectReply string `toml:"select_reply"`
Reply string `toml:"reply"`
ReplyMention string `toml:"reply_mention"`

View file

@ -258,6 +258,15 @@ func (ml *messagesList) selectedMessage() (*discord.Message, error) {
func (ml *messagesList) onInputCapture(event *tcell.EventKey) *tcell.EventKey {
switch event.Name() {
case ml.cfg.Keys.MessagesList.ScrollUp:
return tcell.NewEventKey(tcell.KeyUp, "", tcell.ModNone)
case ml.cfg.Keys.MessagesList.ScrollDown:
return tcell.NewEventKey(tcell.KeyDown, "", tcell.ModNone)
case ml.cfg.Keys.MessagesList.ScrollTop:
return tcell.NewEventKey(tcell.KeyHome, "", tcell.ModNone)
case ml.cfg.Keys.MessagesList.ScrollBottom:
return tcell.NewEventKey(tcell.KeyEnd, "", tcell.ModNone)
case ml.cfg.Keys.MessagesList.Cancel:
ml.selectedMessageID = 0
ml.Highlight()