| 177 | |
| 178 | // Shift is held around a character that needs it, unless already held. |
| 179 | function typeCharacter(keyboard: Keyboard, ch: string): void { |
| 180 | const { key, shift } = fromChar(ch) |
| 181 | const addShift = shift && !keyboard.isPressed(Keys.SHIFT) |
| 182 | if (addShift) { |
| 183 | keyboard.pressKey(Keys.SHIFT) |
| 184 | } |
| 185 | tap(keyboard, key) |
| 186 | if (addShift) { |
| 187 | keyboard.releaseKey(Keys.SHIFT) |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | // Whether the input accepted `text` as its value. A value the control would |
| 192 | // sanitise away is rejected and left to the keyboard, as before. A colour |