Merge pull request #142 from Midek/burdel

hjkl keybinds for selection
This commit is contained in:
Tulir Asokan 2020-04-09 18:20:12 +03:00 committed by GitHub
commit ff20c2c44f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -322,14 +322,16 @@ func (view *RoomView) ClearAllContext() {
func (view *RoomView) OnKeyEvent(event mauview.KeyEvent) bool {
msgView := view.MessageView()
if view.selecting {
switch event.Key() {
case tcell.KeyEscape:
k := event.Key()
c := event.Rune()
switch {
case k == tcell.KeyEscape || c == 'h':
view.ClearAllContext()
case tcell.KeyUp:
case k == tcell.KeyUp || c == 'k':
view.SelectPrevious()
case tcell.KeyDown:
case k == tcell.KeyDown || c == 'j':
view.SelectNext()
case tcell.KeyEnter:
case k == tcell.KeyEnter || c == 'l':
view.OnSelect(msgView.selected)
default:
return false