File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,12 @@ normalStateHandler[C0.BS] = (handler) => handler.backspace();
12
12
normalStateHandler [ C0 . HT ] = ( handler ) => handler . tab ( ) ;
13
13
normalStateHandler [ C0 . SO ] = ( handler ) => handler . shiftOut ( ) ;
14
14
normalStateHandler [ C0 . SI ] = ( handler ) => handler . shiftIn ( ) ;
15
+ // TODO: Add ESC and Default cases to normalStateHandler
16
+
17
+ const csiStateHandler : { [ key : string ] : ( handler : IInputHandler , parser : Parser ) => void } = { } ;
18
+ csiStateHandler [ '?' ] = ( _ , parser ) => parser . setPrefix ( '?' ) ;
19
+ csiStateHandler [ '>' ] = ( _ , parser ) => parser . setPrefix ( '>' ) ;
20
+ csiStateHandler [ '!' ] = ( _ , parser ) => parser . setPrefix ( '!' ) ;
15
21
16
22
enum ParserState {
17
23
NORMAL = 0 ,
@@ -487,6 +493,12 @@ export class Parser {
487
493
break ;
488
494
489
495
case ParserState . CSI :
496
+ if ( ch in normalStateHandler ) {
497
+ normalStateHandler [ ch ] ( this . _inputHandler ) ;
498
+ // Skip below switch as this has handled these codes (eventually everything will be handled here
499
+ break ;
500
+ }
501
+
490
502
// '?', '>', '!'
491
503
if ( ch === '?' || ch === '>' || ch === '!' ) {
492
504
this . _terminal . prefix = ch ;
@@ -1036,6 +1048,10 @@ export class Parser {
1036
1048
}
1037
1049
}
1038
1050
}
1051
+
1052
+ public setPrefix ( prefix : string ) {
1053
+ this . _terminal . prefix = prefix ;
1054
+ }
1039
1055
}
1040
1056
1041
1057
const wcwidth = ( function ( opts ) {
You can’t perform that action at this time.
0 commit comments