From 8b02b30e587b42eb446d623e966dc05deefeb180 Mon Sep 17 00:00:00 2001 From: Midov Date: Thu, 9 Apr 2020 14:47:40 +0200 Subject: hjkl keybinds for selection --- ui/room-view.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'ui') diff --git a/ui/room-view.go b/ui/room-view.go index 29c455d..3a1d3cb 100644 --- a/ui/room-view.go +++ b/ui/room-view.go @@ -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 -- cgit v1.2.3