Explorar o código

Make charToTerminalKey return fast

xuty %!s(int64=3) %!d(string=hai) anos
pai
achega
6d78da8811
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      lib/src/ui/input_map.dart

+ 4 - 0
lib/src/ui/input_map.dart

@@ -280,5 +280,9 @@ TerminalKey? keyToTerminalKey(LogicalKeyboardKey key) {
 /// For example, `charToTerminalKey('a')` or `charToTerminalKey('A')` will both
 /// return [TerminalKey.a].
 TerminalKey? charToTerminalKey(String char) {
+  if (char.length != 1) {
+    return null;
+  }
+
   return _keyByChar[char];
 }