Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
48612205
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
48612205
编写于
3月 15, 2019
作者:
I
Isidor Nikolic
提交者:
GitHub
3月 15, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #70502 from iansan5653/master
Correctly handle succeeding ANSI color codes (fix #70416)
上级
671f4f85
0250af05
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
39 addition
and
14 deletion
+39
-14
src/vs/workbench/contrib/debug/browser/debugANSIHandling.ts
src/vs/workbench/contrib/debug/browser/debugANSIHandling.ts
+12
-8
src/vs/workbench/contrib/debug/test/browser/debugANSIHandling.test.ts
...ench/contrib/debug/test/browser/debugANSIHandling.test.ts
+27
-6
未找到文件。
src/vs/workbench/contrib/debug/browser/debugANSIHandling.ts
浏览文件 @
48612205
...
...
@@ -72,16 +72,20 @@ export function handleANSIOutput(text: string, linkDetector: LinkDetector): HTML
styleNames
.
push
(
'
code-italic
'
);
}
else
if
(
code
===
4
)
{
styleNames
.
push
(
'
code-underline
'
);
}
else
if
((
code
>=
30
&&
code
<=
37
)
||
(
code
>=
90
&&
code
<=
97
))
{
styleNames
.
push
(
'
code-foreground-
'
+
code
);
}
else
if
(
code
===
39
)
{
// Remove all foreground colour codes
}
else
if
(
code
===
39
||
(
code
>=
30
&&
code
<=
37
)
||
(
code
>=
90
&&
code
<=
97
))
{
// Remove all previous foreground colour codes
styleNames
=
styleNames
.
filter
(
style
=>
!
style
.
match
(
/^code-foreground-
\d
+$/
));
}
else
if
((
code
>=
40
&&
code
<=
47
)
||
(
code
>=
100
&&
code
<=
107
))
{
styleNames
.
push
(
'
code-background-
'
+
code
);
}
else
if
(
code
===
49
)
{
// Remove all background colour codes
if
(
code
!==
39
)
{
styleNames
.
push
(
'
code-foreground-
'
+
code
);
}
}
else
if
(
code
===
49
||
(
code
>=
40
&&
code
<=
47
)
||
(
code
>=
100
&&
code
<=
107
))
{
// Remove all previous background colour codes
styleNames
=
styleNames
.
filter
(
style
=>
!
style
.
match
(
/^code-background-
\d
+$/
));
if
(
code
!==
49
)
{
styleNames
.
push
(
'
code-background-
'
+
code
);
}
}
}
...
...
src/vs/workbench/contrib/debug/test/browser/debugANSIHandling.test.ts
浏览文件 @
48612205
...
...
@@ -130,16 +130,37 @@ suite('Debug - ANSI Handling', () => {
});
}
//
C
odes do not interfere
assertSingleSequenceElement
(
'
\
x1b[1;3;4;30;
31;32;33;34;35;36;37
m
'
,
(
child
)
=>
{
assert
.
equal
(
11
,
child
.
classList
.
length
);
//
Different c
odes do not interfere
assertSingleSequenceElement
(
'
\
x1b[1;3;4;30;
41
m
'
,
(
child
)
=>
{
assert
.
equal
(
5
,
child
.
classList
.
length
);
assert
(
dom
.
hasClass
(
child
,
'
code-bold
'
));
assert
(
dom
.
hasClass
(
child
,
'
code-italic
'
));
assert
(
dom
.
hasClass
(
child
,
'
code-underline
'
));
for
(
let
i
=
30
;
i
<=
37
;
i
++
)
{
assert
(
dom
.
hasClass
(
child
,
'
code-foreground-
'
+
i
));
}
assert
(
dom
.
hasClass
(
child
,
'
code-foreground-30
'
));
assert
(
dom
.
hasClass
(
child
,
'
code-background-41
'
));
});
// New foreground color codes remove old codes
assertSingleSequenceElement
(
'
\
x1b[30;31;32;33;34;35;36;37m
'
,
(
child
)
=>
{
assert
.
equal
(
1
,
child
.
classList
.
length
);
assert
(
dom
.
hasClass
(
child
,
'
code-foreground-37
'
));
});
// New background color codes remove old codes
assertSingleSequenceElement
(
'
\
x1b[40;41;42;43;44;45;46;47m
'
,
(
child
)
=>
{
assert
.
equal
(
1
,
child
.
classList
.
length
);
assert
(
dom
.
hasClass
(
child
,
'
code-background-47
'
));
});
// New foreground codes don't remove old background codes and vice versa
assertSingleSequenceElement
(
'
\
x1b[40;31;42;33m
'
,
(
child
)
=>
{
assert
.
equal
(
2
,
child
.
classList
.
length
);
assert
(
dom
.
hasClass
(
child
,
'
code-background-42
'
));
assert
(
dom
.
hasClass
(
child
,
'
code-foreground-33
'
));
});
// Duplicate codes do not change output
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录