|
5 | 5 |
|
6 | 6 | // DO NOT EDIT -- DO NOT EDIT -- DO NOT EDIT
|
7 | 7 | //
|
8 |
| -// This file is auto generated by flutter/engine:flutter/tools/gen_web_keyboard_layouts based on |
9 |
| -// https://github.com/microsoft/vscode/tree/ab7ccc9e872dfcdfc429f8f2815109ec0ca926e3/src/vs/workbench/services/keybinding/browser/keyboardLayouts |
| 8 | +// This file is auto generated by flutter/engine:flutter/tools/gen_web_keyboard_keymap based on |
| 9 | +// https://github.com/microsoft/vscode/tree/422b581e3802e30cfb780c21d9cc1a2cd0c9f0aa/src/vs/workbench/services/keybinding/browser/keyboardLayouts |
10 | 10 | //
|
11 | 11 | // Edit the following files instead:
|
12 | 12 | //
|
13 | 13 | // - Script: lib/main.dart
|
14 | 14 | // - Templates: data/*.tmpl
|
15 | 15 | //
|
16 |
| -// See flutter/engine:flutter/tools/gen_web_keyboard_layouts/README.md for more information. |
| 16 | +// See flutter/engine:flutter/tools/gen_web_locale_keymap/README.md for more information. |
17 | 17 |
|
18 | 18 | /// Used in the final mapping indicating the logical key should be derived from
|
19 | 19 | /// KeyboardEvent.keyCode.
|
@@ -100,16 +100,17 @@ bool isLetter(int charCode) {
|
100 | 100 | ///
|
101 | 101 | /// This greatly reduces the entries needed in the final mapping.
|
102 | 102 | int? heuristicMapper(String code, String key) {
|
103 |
| - // Digit code: return the digit. |
| 103 | + // Digit code: return the digit by event code. |
104 | 104 | if (code.startsWith('Digit')) {
|
105 | 105 | assert(code.length == 6);
|
106 | 106 | return code.codeUnitAt(5); // The character immediately after 'Digit'
|
107 | 107 | }
|
108 | 108 | final int charCode = key.codeUnitAt(0);
|
| 109 | + // Non-ascii: return the goal (i.e. US mapping by event code). |
109 | 110 | if (key.length > 1 || !_isAscii(charCode)) {
|
110 | 111 | return kLayoutGoals[code]?.codeUnitAt(0);
|
111 | 112 | }
|
112 |
| - // Letter key: return the letter. |
| 113 | + // Letter key: return the event key letter. |
113 | 114 | if (isLetter(charCode)) {
|
114 | 115 | return key.toLowerCase().codeUnitAt(0);
|
115 | 116 | }
|
@@ -167,22 +168,20 @@ class _StringStream {
|
167 | 168 |
|
168 | 169 | Map<String, int> _unmarshallCodeMap(_StringStream stream) {
|
169 | 170 | final int entryNum = stream.readIntAsVerbatim();
|
170 |
| - return Map<String, int>.fromEntries((() sync* { |
171 |
| - for (int entryIndex = 0; entryIndex < entryNum; entryIndex += 1) { |
172 |
| - yield MapEntry<String, int>(stream.readEventKey(), stream.readIntAsChar()); |
173 |
| - } |
174 |
| - })()); |
| 171 | + return <String, int>{ |
| 172 | + for (int i = 0; i < entryNum; i++) |
| 173 | + stream.readEventKey(): stream.readIntAsChar(), |
| 174 | + }; |
175 | 175 | }
|
176 | 176 |
|
177 | 177 | /// Decode a key mapping data out of the string.
|
178 | 178 | Map<String, Map<String, int>> unmarshallMappingData(String compressed) {
|
179 | 179 | final _StringStream stream = _StringStream(compressed);
|
180 | 180 | final int eventCodeNum = stream.readIntAsVerbatim();
|
181 |
| - return Map<String, Map<String, int>>.fromEntries((() sync* { |
182 |
| - for (int eventCodeIndex = 0; eventCodeIndex < eventCodeNum; eventCodeIndex += 1) { |
183 |
| - yield MapEntry<String, Map<String, int>>(stream.readEventCode(), _unmarshallCodeMap(stream)); |
184 |
| - } |
185 |
| - })()); |
| 181 | + return <String, Map<String, int>>{ |
| 182 | + for (int i = 0; i < eventCodeNum; i++) |
| 183 | + stream.readEventCode() : _unmarshallCodeMap(stream), |
| 184 | + }; |
186 | 185 | }
|
187 | 186 |
|
188 | 187 | /// Data for [LocaleKeymap] on Windows.
|
|
0 commit comments