Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
d49c5f3b
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,发现更多精彩内容 >>
未验证
提交
d49c5f3b
编写于
2月 07, 2020
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use mtkz for whitespace parts that define a width
上级
310c969f
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
52 addition
and
49 deletion
+52
-49
src/vs/editor/browser/viewParts/lines/viewLines.css
src/vs/editor/browser/viewParts/lines/viewLines.css
+4
-0
src/vs/editor/common/view/editorColorRegistry.ts
src/vs/editor/common/view/editorColorRegistry.ts
+1
-0
src/vs/editor/common/viewLayout/viewLineRenderer.ts
src/vs/editor/common/viewLayout/viewLineRenderer.ts
+6
-8
src/vs/editor/test/common/viewLayout/viewLineRenderer.test.ts
...vs/editor/test/common/viewLayout/viewLineRenderer.test.ts
+41
-41
未找到文件。
src/vs/editor/browser/viewParts/lines/viewLines.css
浏览文件 @
d49c5f3b
...
...
@@ -37,6 +37,10 @@
width
:
100%
;
}
.monaco-editor
.mtkz
{
display
:
inline-block
;
}
/* TODO@tokenization bootstrap fix */
/*.monaco-editor .view-line > span > span {
float: none;
...
...
src/vs/editor/common/view/editorColorRegistry.ts
浏览文件 @
d49c5f3b
...
...
@@ -88,5 +88,6 @@ registerThemingParticipant((theme, collector) => {
const
invisibles
=
theme
.
getColor
(
editorWhitespaces
);
if
(
invisibles
)
{
collector
.
addRule
(
`.monaco-editor .mtkw { color:
${
invisibles
}
!important; }`
);
collector
.
addRule
(
`.monaco-editor .mtkz { color:
${
invisibles
}
!important; }`
);
}
});
src/vs/editor/common/viewLayout/viewLineRenderer.ts
浏览文件 @
d49c5f3b
...
...
@@ -764,10 +764,11 @@ function _renderLine(input: ResolvedRenderLineInput, sb: IStringBuilder): Render
const
partEndIndex
=
part
.
endIndex
;
const
partType
=
part
.
type
;
const
partRendersWhitespace
=
(
renderWhitespace
!==
RenderWhitespace
.
None
&&
(
partType
.
indexOf
(
'
mtkw
'
)
>=
0
));
const
partRendersWhitespaceWithWidth
=
partRendersWhitespace
&&
!
fontIsMonospace
&&
(
partType
===
'
mtkw
'
/*only whitespace*/
||
!
containsForeignElements
);
charOffsetInPart
=
0
;
sb
.
appendASCIIString
(
'
<span class="
'
);
sb
.
appendASCIIString
(
partType
);
sb
.
appendASCIIString
(
part
RendersWhitespaceWithWidth
?
'
mtkz
'
:
part
Type
);
sb
.
appendASCII
(
CharCode
.
DoubleQuote
);
if
(
partRendersWhitespace
)
{
...
...
@@ -787,14 +788,11 @@ function _renderLine(input: ResolvedRenderLineInput, sb: IStringBuilder): Render
}
}
if
(
!
fontIsMonospace
)
{
const
partIsOnlyWhitespace
=
(
partType
===
'
mtkw
'
);
if
(
partIsOnlyWhitespace
||
!
containsForeignElements
)
{
sb
.
appendASCIIString
(
'
style="display:inline-block;width:
'
);
if
(
partRendersWhitespaceWithWidth
)
{
sb
.
appendASCIIString
(
'
style="width:
'
);
sb
.
appendASCIIString
(
String
(
spaceWidth
*
partContentCnt
));
sb
.
appendASCIIString
(
'
px"
'
);
}
}
sb
.
appendASCII
(
CharCode
.
GreaterThan
);
for
(;
charIndex
<
partEndIndex
;
charIndex
++
)
{
...
...
src/vs/editor/test/common/viewLayout/viewLineRenderer.test.ts
浏览文件 @
d49c5f3b
...
...
@@ -195,8 +195,8 @@ suite('viewLineRenderer.renderLine', () => {
createPart
(
48
,
12
),
]);
let
expectedOutput
=
[
'
<span class="mtk
w" style="display:inline-block;
width:40px">
\
u2192
\
u00a0
\
u00a0
\
u00a0</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:40px">
\
u00b7
\
u00b7
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:40px">
\
u2192
\
u00a0
\
u00a0
\
u00a0</span>
'
,
'
<span class="mtk
z" style="
width:40px">
\
u00b7
\
u00b7
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk2">export</span>
'
,
'
<span class="mtk3">
\
u00a0</span>
'
,
'
<span class="mtk4">class</span>
'
,
...
...
@@ -207,8 +207,8 @@ suite('viewLineRenderer.renderLine', () => {
'
<span class="mtk9">
\
u00a0</span>
'
,
'
<span class="mtk10">//
\
u00a0</span>
'
,
'
<span class="mtk11">http://test.com</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:20px">
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:30px">
\
u00b7
\
u00b7
\
u00b7</span>
'
'
<span class="mtk
z" style="
width:20px">
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:30px">
\
u00b7
\
u00b7
\
u00b7</span>
'
].
join
(
''
);
let
expectedOffsetsArr
=
[
[
0
],
...
...
@@ -897,10 +897,10 @@ suite('viewLineRenderer.renderLine 2', () => {
null
,
[
'
<span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:40px">
\
u00b7
\
u00b7
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:40px">
\
u00b7
\
u00b7
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk2">He</span>
'
,
'
<span class="mtk3">llo
\
u00a0world!</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:40px">
\
u00b7
\
u00b7
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:40px">
\
u00b7
\
u00b7
\
u00b7
\
u00b7</span>
'
,
'
</span>
'
,
].
join
(
''
)
);
...
...
@@ -919,12 +919,12 @@ suite('viewLineRenderer.renderLine 2', () => {
null
,
[
'
<span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:40px">
\
u00b7
\
u00b7
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:40px">
\
u00b7
\
u00b7
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:40px">
\
u00b7
\
u00b7
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:40px">
\
u00b7
\
u00b7
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk2">He</span>
'
,
'
<span class="mtk3">llo
\
u00a0world!</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:40px">
\
u00b7
\
u00b7
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:40px">
\
u00b7
\
u00b7
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:40px">
\
u00b7
\
u00b7
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:40px">
\
u00b7
\
u00b7
\
u00b7
\
u00b7</span>
'
,
'
</span>
'
,
].
join
(
''
)
);
...
...
@@ -943,11 +943,11 @@ suite('viewLineRenderer.renderLine 2', () => {
null
,
[
'
<span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:40px">
\
u2192
\
u00a0
\
u00a0
\
u00a0</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:40px">
\
u2192
\
u00a0
\
u00a0
\
u00a0</span>
'
,
'
<span class="mtk
z" style="
width:40px">
\
u2192
\
u00a0
\
u00a0
\
u00a0</span>
'
,
'
<span class="mtk
z" style="
width:40px">
\
u2192
\
u00a0
\
u00a0
\
u00a0</span>
'
,
'
<span class="mtk2">He</span>
'
,
'
<span class="mtk3">llo
\
u00a0world!</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:40px">
\
u2192
\
u00a0
\
u00a0
\
u00a0</span>
'
,
'
<span class="mtk
z" style="
width:40px">
\
u2192
\
u00a0
\
u00a0
\
u00a0</span>
'
,
'
</span>
'
,
].
join
(
''
)
);
...
...
@@ -966,15 +966,15 @@ suite('viewLineRenderer.renderLine 2', () => {
null
,
[
'
<span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:40px">
\
u00b7
\
u00b7
\
u2192
\
u00a0</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:40px">
\
u2192
\
u00a0
\
u00a0
\
u00a0</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:20px">
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:40px">
\
u00b7
\
u00b7
\
u2192
\
u00a0</span>
'
,
'
<span class="mtk
z" style="
width:40px">
\
u2192
\
u00a0
\
u00a0
\
u00a0</span>
'
,
'
<span class="mtk
z" style="
width:20px">
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk2">He</span>
'
,
'
<span class="mtk3">llo
\
u00a0world!</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:20px">
\
u00b7
\
uffeb</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:40px">
\
u00b7
\
u00b7
\
u2192
\
u00a0</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:40px">
\
u00b7
\
u00b7
\
u00b7
\
uffeb</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:40px">
\
u00b7
\
u00b7
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:20px">
\
u00b7
\
uffeb</span>
'
,
'
<span class="mtk
z" style="
width:40px">
\
u00b7
\
u00b7
\
u2192
\
u00a0</span>
'
,
'
<span class="mtk
z" style="
width:40px">
\
u00b7
\
u00b7
\
u00b7
\
uffeb</span>
'
,
'
<span class="mtk
z" style="
width:40px">
\
u00b7
\
u00b7
\
u00b7
\
u00b7</span>
'
,
'
</span>
'
,
].
join
(
''
)
);
...
...
@@ -995,13 +995,13 @@ suite('viewLineRenderer.renderLine 2', () => {
[
'
<span>
'
,
'
<span class="">
\
u00a0
\
u00a0
\
u00a0
\
u00a0
\
u00a0
\
u00a0
\
u00a0
\
u00a0</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:20px">
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:20px">
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk2">He</span>
'
,
'
<span class="mtk3">llo
\
u00a0world!</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:20px">
\
u00b7
\
uffeb</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:40px">
\
u00b7
\
u00b7
\
u2192
\
u00a0</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:40px">
\
u00b7
\
u00b7
\
u00b7
\
uffeb</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:40px">
\
u00b7
\
u00b7
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:20px">
\
u00b7
\
uffeb</span>
'
,
'
<span class="mtk
z" style="
width:40px">
\
u00b7
\
u00b7
\
u2192
\
u00a0</span>
'
,
'
<span class="mtk
z" style="
width:40px">
\
u00b7
\
u00b7
\
u00b7
\
uffeb</span>
'
,
'
<span class="mtk
z" style="
width:40px">
\
u00b7
\
u00b7
\
u00b7
\
u00b7</span>
'
,
'
</span>
'
,
].
join
(
''
)
);
...
...
@@ -1046,11 +1046,11 @@ suite('viewLineRenderer.renderLine 2', () => {
[
'
<span>
'
,
'
<span class="mtk1">it</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:20px">
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:20px">
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk1">it</span>
'
,
'
<span class="mtk2">
\
u00a0</span>
'
,
'
<span class="mtk3">it</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:20px">
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:20px">
\
u00b7
\
u00b7</span>
'
,
'
<span class="mtk3">it</span>
'
,
'
</span>
'
,
].
join
(
''
)
...
...
@@ -1071,12 +1071,12 @@ suite('viewLineRenderer.renderLine 2', () => {
null
,
[
'
<span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:10px">
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:10px">
\
u00b7</span>
'
,
'
<span class="mtk0">Hel</span>
'
,
'
<span class="mtk1">lo</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:10px">
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:10px">
\
u00b7</span>
'
,
'
<span class="mtk2">world!</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:30px">
\
u2192
\
u00a0
\
u00a0</span>
'
,
'
<span class="mtk
z" style="
width:30px">
\
u2192
\
u00a0
\
u00a0</span>
'
,
'
</span>
'
,
].
join
(
''
)
);
...
...
@@ -1118,12 +1118,12 @@ suite('viewLineRenderer.renderLine 2', () => {
[
new
LineRange
(
0
,
14
)],
[
'
<span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:10px">
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:10px">
\
u00b7</span>
'
,
'
<span class="mtk0">Hel</span>
'
,
'
<span class="mtk1">lo</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:10px">
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:10px">
\
u00b7</span>
'
,
'
<span class="mtk2">world!</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:30px">
\
u2192
\
u00a0
\
u00a0</span>
'
,
'
<span class="mtk
z" style="
width:30px">
\
u2192
\
u00a0
\
u00a0</span>
'
,
'
</span>
'
,
].
join
(
''
)
);
...
...
@@ -1143,7 +1143,7 @@ suite('viewLineRenderer.renderLine 2', () => {
[
new
LineRange
(
0
,
5
)],
[
'
<span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:10px">
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:10px">
\
u00b7</span>
'
,
'
<span class="mtk0">Hel</span>
'
,
'
<span class="mtk1">lo</span>
'
,
'
<span class="mtk2">
\
u00a0world!
\
u00a0
\
u00a0
\
u00a0</span>
'
,
...
...
@@ -1167,11 +1167,11 @@ suite('viewLineRenderer.renderLine 2', () => {
[
new
LineRange
(
0
,
5
),
new
LineRange
(
9
,
14
)],
[
'
<span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:10px">
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:10px">
\
u00b7</span>
'
,
'
<span class="mtk0">Hel</span>
'
,
'
<span class="mtk1">lo</span>
'
,
'
<span class="mtk2">
\
u00a0world!</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:30px">
\
u2192
\
u00a0
\
u00a0</span>
'
,
'
<span class="mtk
z" style="
width:30px">
\
u2192
\
u00a0
\
u00a0</span>
'
,
'
</span>
'
,
].
join
(
''
)
);
...
...
@@ -1192,11 +1192,11 @@ suite('viewLineRenderer.renderLine 2', () => {
[
new
LineRange
(
9
,
14
),
new
LineRange
(
0
,
5
)],
[
'
<span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:10px">
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:10px">
\
u00b7</span>
'
,
'
<span class="mtk0">Hel</span>
'
,
'
<span class="mtk1">lo</span>
'
,
'
<span class="mtk2">
\
u00a0world!</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:30px">
\
u2192
\
u00a0
\
u00a0</span>
'
,
'
<span class="mtk
z" style="
width:30px">
\
u2192
\
u00a0
\
u00a0</span>
'
,
'
</span>
'
,
].
join
(
''
)
);
...
...
@@ -1214,9 +1214,9 @@ suite('viewLineRenderer.renderLine 2', () => {
[
new
LineRange
(
0
,
1
),
new
LineRange
(
1
,
2
),
new
LineRange
(
2
,
3
)],
[
'
<span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:10px">
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:10px">
\
u00b7</span>
'
,
'
<span class="mtk0">*</span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:10px">
\
u00b7</span>
'
,
'
<span class="mtk
z" style="
width:10px">
\
u00b7</span>
'
,
'
<span class="mtk0">S</span>
'
,
'
</span>
'
,
].
join
(
''
)
...
...
@@ -1329,7 +1329,7 @@ suite('viewLineRenderer.renderLine 2', () => {
let
expected
=
[
'
<span>
'
,
'
<span class="mtk
w" style="display:inline-block;
width:40px">
\
u2192
\
u00a0
\
u00a0
\
u00a0</span>
'
,
'
<span class="mtk
z" style="
width:40px">
\
u2192
\
u00a0
\
u00a0
\
u00a0</span>
'
,
'
<span class="mtk3 before">b</span>
'
,
'
<span class="mtk3">la</span>
'
,
'
</span>
'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录