Some ansi fixes
This commit is contained in:
parent
19cf7246e8
commit
2eac439ba1
1 changed files with 6 additions and 2 deletions
|
@ -31,12 +31,16 @@ function ansi(text: string) {
|
|||
fontWeight: undefined,
|
||||
}
|
||||
for (const [index, segment] of segments.entries()) {
|
||||
const ansi_segment = segment.match(/\033\[(\d+;)*(\d+)m/g)[0]
|
||||
console.log(ansi_segment);
|
||||
const ansi_segment = segment.substring(0, segment.indexOf('m') + 1);
|
||||
const escape_codes = [
|
||||
...
|
||||
ansi_segment.matchAll(/\d+/g)
|
||||
].map(element => element[0]);
|
||||
if (escape_codes.length == 0) {
|
||||
style.color = undefined;
|
||||
style.backgroundColor = undefined;
|
||||
style.fontWeight = undefined;
|
||||
}
|
||||
for (const code of escape_codes) {
|
||||
if (code == 0) {
|
||||
style.color = undefined;
|
||||
|
|
Loading…
Reference in a new issue