diff options
author | Robin Jarry <robin@jarry.cc> | 2022-08-07 22:04:25 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-08-10 09:51:29 +0200 |
commit | 1b91b68e7385239783bee818974c4ce2032b7039 (patch) | |
tree | 96dbb527168b3326d06854c753ffe2268f7e23cc | |
parent | d1838c80632eeb514d6ceb98e5e7761eafe891e3 (diff) | |
download | aerc-1b91b68e7385239783bee818974c4ce2032b7039.tar.gz aerc-1b91b68e7385239783bee818974c4ce2032b7039.zip |
bindings: fix FormatKeyStrokes for <tab> and <enter>
Sometimes, a <tab> or <enter> key in a binding will be formatted as
a <c-i> or <c-m> respectively. This is because these keys are
equivalent. Prefer their canonical name instead of the control modifier
variant.
Fixes: 5e600d7ab46b ("binds: fix ctrl-i and ctrl-m key definitions")
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Koni Marti <koni.marti@gmail.com>
-rw-r--r-- | config/bindings.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/config/bindings.go b/config/bindings.go index 94d7d727..15c2ce31 100644 --- a/config/bindings.go +++ b/config/bindings.go @@ -149,8 +149,11 @@ func FormatKeyStrokes(keystrokes []KeyStroke) string { s := "" for name, ks := range keyNames { if ks.Modifiers == stroke.Modifiers && ks.Key == stroke.Key && ks.Rune == stroke.Rune { - if name == "cr" { + switch name { + case "cr", "c-m": name = "enter" + case "c-i": + name = "tab" } s = fmt.Sprintf("<%s>", name) break |