Commit 54384ba
authored
feat: implement InputHandler for keyboard input (Task 5) (#8)
- Extend Key enum from 20 to 115 complete USB HID keyboard codes
- All letters A-Z, digits 0-9, punctuation, function keys F1-F24
- Navigation keys (Home, End, Page Up/Down, Insert, Delete)
- Arrow keys, keypad keys, international keys
- Add InputHandler class (lib/input-handler.ts - 325 lines)
- Smart encoding strategy: direct ASCII, Ghostty encoder, VT100 sequences
- Complete keyboard event handling with modifier extraction
- Proper resource cleanup with dispose()
- Add comprehensive test suite (lib/input-handler.test.ts - 610 lines)
- 34 tests covering all key types and edge cases
- Mock DOM implementation for testing without dependencies
- All tests passing
- Add interactive demo (examples/input-demo.html - 458 lines)
- Real-time terminal input display with hex dump
- Statistics tracking (keys pressed, bytes generated, ctrl combos)
- Beautiful modern UI for visual testing
- Fix ghostty.ts setOption to handle undefined return values
Test results: 97 total tests passing (63 buffer + 34 input handler)
Task 5 complete and ready for integration into Task 61 parent e924edb commit 54384ba
5 files changed
Lines changed: 1608 additions & 9 deletions
0 commit comments