From daf0067d5335f93e22da6d932231548d0c7ffd7b Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 6 Mar 2022 22:44:02 +0200 Subject: [PATCH] Remove ctrl+a from default keybindings and fix esc --- config/config.go | 4 ++++ config/keybindings.yaml | 1 - ui/help-modal.go | 7 ++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/config/config.go b/config/config.go index 182d38f..ffc8e97 100644 --- a/config/config.go +++ b/config/config.go @@ -226,6 +226,10 @@ func parseKeybindings(input map[string]string) (output map[Keybind]string) { if err != nil { panic(fmt.Errorf("failed to parse keybinding %s -> %s: %w", shortcut, action, err)) } + // TODO find out if other keys are parsed incorrectly like this + if key == tcell.KeyEscape { + ch = 0 + } parsedShortcut := Keybind{ Mod: mod, Key: key, diff --git a/config/keybindings.yaml b/config/keybindings.yaml index a4fd11e..7ad708d 100644 --- a/config/keybindings.yaml +++ b/config/keybindings.yaml @@ -5,7 +5,6 @@ main: 'Ctrl+Home': scroll_up 'Ctrl+End': scroll_down 'Ctrl+Enter': add_newline - 'Ctrl+a': next_active_room 'Ctrl+l': show_bare 'Alt+Down': next_room 'Alt+Up': prev_room diff --git a/ui/help-modal.go b/ui/help-modal.go index b3bf657..6a71c67 100644 --- a/ui/help-modal.go +++ b/ui/help-modal.go @@ -1,10 +1,10 @@ package ui import ( - "maunium.net/go/gomuks/config" + "maunium.net/go/mauview" "maunium.net/go/tcell" - "maunium.net/go/mauview" + "maunium.net/go/gomuks/config" ) const helpText = `# General @@ -100,7 +100,8 @@ func (hm *HelpModal) OnKeyEvent(event mauview.KeyEvent) bool { Ch: event.Rune(), Mod: event.Modifiers(), } - if hm.parent.config.Keybindings.Room[kb] == "cancel" { + // TODO unhardcode q + if hm.parent.config.Keybindings.Modal[kb] == "cancel" || event.Rune() == 'q' { hm.parent.HideModal() return true }