Function
isNonSpacePrintable
(input: string, key: Key)
Source from the content-addressed store, hash-verified
| 37 | * Used to gate the lazy space inserted after an image pill. |
| 38 | */ |
| 39 | export function isNonSpacePrintable(input: string, key: Key): boolean { |
| 40 | if ( |
| 41 | key.ctrl || |
| 42 | key.meta || |
| 43 | key.escape || |
| 44 | key.return || |
| 45 | key.tab || |
| 46 | key.backspace || |
| 47 | key.delete || |
| 48 | key.upArrow || |
| 49 | key.downArrow || |
| 50 | key.leftArrow || |
| 51 | key.rightArrow || |
| 52 | key.pageUp || |
| 53 | key.pageDown || |
| 54 | key.home || |
| 55 | key.end |
| 56 | ) { |
| 57 | return false |
| 58 | } |
| 59 | return input.length > 0 && !/^\s/.test(input) && !input.startsWith('\x1b') |
| 60 | } |
Tested by
no test coverage detected