Add support for ctrl-alt-[a-z] key chords

Close #906
This commit is contained in:
Junegunn Choi
2017-04-28 02:36:36 +09:00
parent d5e72bf55d
commit 6b592137b9
7 changed files with 52 additions and 39 deletions

View File

@@ -401,7 +401,7 @@ func parseKeyChords(str string, message string) map[int]string {
case "ctrl-space":
chord = tui.CtrlSpace
case "alt-enter", "alt-return":
chord = tui.AltEnter
chord = tui.CtrlAltM
case "alt-space":
chord = tui.AltSpace
case "alt-/":
@@ -437,7 +437,9 @@ func parseKeyChords(str string, message string) map[int]string {
case "f12":
chord = tui.F12
default:
if len(key) == 6 && strings.HasPrefix(lkey, "ctrl-") && isAlphabet(lkey[5]) {
if len(key) == 10 && strings.HasPrefix(lkey, "ctrl-alt-") && isAlphabet(lkey[9]) {
chord = tui.CtrlAltA + int(lkey[9]) - 'a'
} else if len(key) == 6 && strings.HasPrefix(lkey, "ctrl-") && isAlphabet(lkey[5]) {
chord = tui.CtrlA + int(lkey[5]) - 'a'
} else if len(key) == 5 && strings.HasPrefix(lkey, "alt-") && isAlphabet(lkey[4]) {
chord = tui.AltA + int(lkey[4]) - 'a'