internal/ui: stop panicking at Key.String

This commit is contained in:
Hajime Hoshi 2022-12-25 00:33:08 +09:00
parent 8e1bd4eaba
commit e6346c01d2
2 changed files with 2 additions and 2 deletions

View File

@ -493,7 +493,7 @@ func (k Key) String() string {
{{range $index, $name := .UIKeyNames}}case Key{{$name}}:
return {{$name | printf "Key%s" | printf "%q"}}
{{end}}}
panic(fmt.Sprintf("ui: invalid key: %d", k))
return fmt.Sprintf("Key(%d)", k)
}
`

View File

@ -348,5 +348,5 @@ func (k Key) String() string {
case KeyTab:
return "KeyTab"
}
panic(fmt.Sprintf("ui: invalid key: %d", k))
return fmt.Sprintf("Key(%d)", k)
}