File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ export default function ansiRegex({onlyFirst = false} = {}) {
3
3
const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)' ;
4
4
const pattern = [
5
5
`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ ST } )` ,
6
- '(?:(?:\\d{1,4}(?:; \\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))' ,
6
+ '(?:(?:\\d{1,4}(?:[;:] \\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))' ,
7
7
] . join ( '|' ) ;
8
8
9
9
return new RegExp ( pattern , onlyFirst ? undefined : 'g' ) ;
Original file line number Diff line number Diff line change @@ -61,6 +61,11 @@ test('match "change icon name and window title" in string', t => {
61
61
t . is ( '\u001B]0;sg@tota:~/git/\u0007\u001B[01;32m[sg@tota\u001B[01;37m misc-tests\u001B[01;32m]$' . match ( ansiRegex ( ) ) [ 0 ] , '\u001B]0;sg@tota:~/git/\u0007' ) ;
62
62
} ) ;
63
63
64
+ test ( 'match colon separated sequence arguments' , t => {
65
+ t . regex ( '\u001B[38:2:68:68:68:48:2:0:0:0m' , ansiRegex ( ) ) ;
66
+ t . is ( '\u001B[38:2:68:68:68:48:2:0:0:0m' . match ( ansiRegex ( ) ) [ 0 ] , '\u001B[38:2:68:68:68:48:2:0:0:0m' ) ;
67
+ } ) ;
68
+
64
69
// Testing against extended codes (excluding codes ending in 0-9)
65
70
for ( const [ codeSetKey , codeSetValue ] of Object . entries ( ansiCodes ) ) {
66
71
for ( const [ code , codeInfo ] of codeSetValue ) {
You can’t perform that action at this time.
0 commit comments