|
@@ -2,18 +2,23 @@ import 'package:xterm/terminal/terminal.dart';
|
|
|
|
|
|
|
|
typedef SbcHandler = void Function(int, Terminal);
|
|
typedef SbcHandler = void Function(int, Terminal);
|
|
|
|
|
|
|
|
-final sbcHandlers = <int, SbcHandler>{
|
|
|
|
|
- 0x05: _voidHandler,
|
|
|
|
|
- 0x07: _bellHandler,
|
|
|
|
|
- 0x08: _backspaceReturnHandler,
|
|
|
|
|
- 0x09: _tabHandler,
|
|
|
|
|
- 0x0a: _newLineHandler,
|
|
|
|
|
- 0x0b: _newLineHandler,
|
|
|
|
|
- 0x0c: _newLineHandler,
|
|
|
|
|
- 0x0d: _carriageReturnHandler,
|
|
|
|
|
- 0x0e: _shiftOutHandler,
|
|
|
|
|
- 0x0f: _shiftInHandler,
|
|
|
|
|
-};
|
|
|
|
|
|
|
+final sbcHandlers = _sbcHandlers();
|
|
|
|
|
+
|
|
|
|
|
+// build single byte character lookup table
|
|
|
|
|
+List<SbcHandler?> _sbcHandlers() {
|
|
|
|
|
+ final result = List<SbcHandler?>.filled(0x0f, null);
|
|
|
|
|
+ result[0x05] = _voidHandler;
|
|
|
|
|
+ result[0x07] = _bellHandler;
|
|
|
|
|
+ result[0x08] = _backspaceReturnHandler;
|
|
|
|
|
+ result[0x09] = _tabHandler;
|
|
|
|
|
+ result[0x0a] = _newLineHandler;
|
|
|
|
|
+ result[0x0b] = _newLineHandler;
|
|
|
|
|
+ result[0x0c] = _newLineHandler;
|
|
|
|
|
+ result[0x0d] = _carriageReturnHandler;
|
|
|
|
|
+ result[0x0e] = _shiftOutHandler;
|
|
|
|
|
+ result[0x0f] = _shiftInHandler;
|
|
|
|
|
+ return result;
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
void _bellHandler(int code, Terminal terminal) {
|
|
void _bellHandler(int code, Terminal terminal) {
|
|
|
terminal.onBell();
|
|
terminal.onBell();
|