omit k: and x: in error messages

This commit is contained in:
John Gebbie 2023-02-06 11:20:49 +00:00
parent 9682b408ab
commit 5230969381

View file

@ -108,7 +108,7 @@ func parseChord(chord string) (Chord, error) {
if strings.HasPrefix(k, "k:") { if strings.HasPrefix(k, "k:") {
code, err := strconv.Atoi(k[2:]) code, err := strconv.Atoi(k[2:])
if err != nil { if err != nil {
return c, errors.New("invalid keycode: " + k) return c, errors.New("invalid keycode: " + k[2:])
} }
c.Key = code c.Key = code
} else if strings.HasPrefix(k, "x:") { } else if strings.HasPrefix(k, "x:") {
@ -120,7 +120,7 @@ func parseChord(chord string) (Chord, error) {
} else if code, ok := xKeysNormal[strings.ToLower(k[2:])]; ok { } else if code, ok := xKeysNormal[strings.ToLower(k[2:])]; ok {
c.Key = code c.Key = code
} else { } else {
return c, errors.New("unknown X11 key: " + k) return c, errors.New("unknown X11 key: " + k[2:])
} }
} else { } else {
code, ok := linuxKeys[strings.ToLower(k)] code, ok := linuxKeys[strings.ToLower(k)]