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,
|
fontWeight: undefined,
|
||||||
}
|
}
|
||||||
for (const [index, segment] of segments.entries()) {
|
for (const [index, segment] of segments.entries()) {
|
||||||
const ansi_segment = segment.match(/\033\[(\d+;)*(\d+)m/g)[0]
|
const ansi_segment = segment.substring(0, segment.indexOf('m') + 1);
|
||||||
console.log(ansi_segment);
|
|
||||||
const escape_codes = [
|
const escape_codes = [
|
||||||
...
|
...
|
||||||
ansi_segment.matchAll(/\d+/g)
|
ansi_segment.matchAll(/\d+/g)
|
||||||
].map(element => element[0]);
|
].map(element => element[0]);
|
||||||
|
if (escape_codes.length == 0) {
|
||||||
|
style.color = undefined;
|
||||||
|
style.backgroundColor = undefined;
|
||||||
|
style.fontWeight = undefined;
|
||||||
|
}
|
||||||
for (const code of escape_codes) {
|
for (const code of escape_codes) {
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
style.color = undefined;
|
style.color = undefined;
|
||||||
|
|
Loading…
Reference in a new issue