fix regular expression for ANSI escapes

wouldn't catch `\x1b[01;`, only `\x1b[0;` or `\x1b[1;`.

closes #3614
This commit is contained in:
MinRK 2013-07-11 12:19:03 -07:00
parent 641a5e153b
commit 55192ef881

View File

@ -178,11 +178,11 @@ IPython.utils = (function (IPython) {
// `\033[Xm` == `\033[0;Xm` sets foreground color to `X`.
//
str = str.replace(
new RegExp('\033\\[([01];)?' + ansi + 'm', 'g'), span
new RegExp('\033\\[(0?[01];)?' + ansi + 'm', 'g'), span
);
});
str = str.replace(/\033\[([01]|39|22)?m/g, '</span>');
str = str.replace(/\033\[(0?[01]|39|22)?m/g, '</span>');
return str;
};