File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -73,18 +73,17 @@ function readEscapeCodes(
7373 const escapeCodes : ( typeof ANSI ) [ keyof typeof ANSI ] [ ] = [ ] ;
7474 let localCursor = cursor ;
7575 while ( ! ps1 . startsWith ( 'm' , localCursor ) ) {
76- const escapeCode = parseInt ( ps1 . substring ( localCursor ) , 10 ) ;
77- if ( Number . isNaN ( escapeCode ) || escapeCode < 0 ) {
78- throw new PromptParserError ( 'Invalid escape code' , ps1 , localCursor ) ;
79- }
80-
81- escapeCodes . push ( escapeCode ) ;
82- localCursor += escapeCode . toString ( ) . length ;
83-
8476 // we consume the separator ';' if it is present
85- // otherwise the loop will terminate ('m\]') or throw an error in the next iteration
8677 if ( ps1 . startsWith ( ';' , localCursor ) ) {
8778 localCursor += 1 ;
79+ } else {
80+ const escapeCode = parseInt ( ps1 . substring ( localCursor ) , 10 ) ;
81+ if ( Number . isNaN ( escapeCode ) || escapeCode < 0 ) {
82+ throw new PromptParserError ( 'Invalid escape code' , ps1 , localCursor ) ;
83+ }
84+
85+ escapeCodes . push ( escapeCode ) ;
86+ localCursor += escapeCode . toString ( ) . length ;
8887 }
8988
9089 if ( localCursor >= ps1 . length ) {
You can’t perform that action at this time.
0 commit comments