Remove ctrl+a from default keybindings and fix esc

This commit is contained in:
Tulir Asokan 2022-03-06 22:44:02 +02:00
parent 686f7025cb
commit daf0067d53
3 changed files with 8 additions and 4 deletions

View File

@ -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,

View File

@ -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

View File

@ -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
}