1
0
Fork 0
forked from Mirrors/gomuks

Add vim-like top/bottom keybinds to roster view

This commit is contained in:
FIGBERT 2023-04-20 10:17:47 -07:00
parent 03f8db40a0
commit 50acd2474a
No known key found for this signature in database
GPG key ID: 67F1598D607A844B
2 changed files with 13 additions and 0 deletions

View file

@ -20,6 +20,8 @@ roster:
'k': prev_room
'Down': next_room
'Up': prev_room
'g': top
'G': bottom
'Escape': clear
'q': quit
'Enter': enter

View file

@ -281,6 +281,17 @@ func (rstr *RosterView) OnKeyEvent(event mauview.KeyEvent) bool {
rstr.ScrollNext()
case "prev_room":
rstr.ScrollPrev()
case "top":
rstr.selected = rstr.First()
rstr.scrollOffset = 0
case "bottom":
rstr.selected = rstr.Last()
if i := len(rstr.rooms) - rstr.RoomsOnScreen(); i < 0 {
rstr.scrollOffset = 0
} else {
rstr.scrollOffset = i
}
case "clear":
rstr.selected = nil
case "quit":