From 8c661d4e8c8a4b643155aa46481ac92f6ebf75b9 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sat, 19 Nov 2016 22:40:28 +0900 Subject: Revamp escape sequence processing for WSL Also add support for alt-[0-9] and f1[12] --- src/options.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/options.go') diff --git a/src/options.go b/src/options.go index 6e63d4e6..694084e2 100644 --- a/src/options.go +++ b/src/options.go @@ -330,6 +330,10 @@ func isAlphabet(char uint8) bool { return char >= 'a' && char <= 'z' } +func isNumeric(char uint8) bool { + return char >= '0' && char <= '9' +} + func parseAlgo(str string) algo.Algo { switch str { case "v1": @@ -406,11 +410,17 @@ func parseKeyChords(str string, message string) map[int]string { chord = tui.DoubleClick case "f10": chord = tui.F10 + case "f11": + chord = tui.F11 + case "f12": + chord = tui.F12 default: 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' + } else if len(key) == 5 && strings.HasPrefix(lkey, "alt-") && isNumeric(lkey[4]) { + chord = tui.Alt0 + int(lkey[4]) - '0' } else if len(key) == 2 && strings.HasPrefix(lkey, "f") && key[1] >= '1' && key[1] <= '9' { chord = tui.F1 + int(key[1]) - '1' } else if utf8.RuneCountInString(key) == 1 { -- cgit v1.2.3