Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
32ee0c31
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
32ee0c31
编写于
3月 23, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use string concatenation
上级
cf86c78b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
30 addition
and
30 deletion
+30
-30
src/vs/editor/browser/standalone/colorizer.ts
src/vs/editor/browser/standalone/colorizer.ts
+1
-1
src/vs/editor/browser/viewParts/lines/viewLine.ts
src/vs/editor/browser/viewParts/lines/viewLine.ts
+2
-2
src/vs/editor/common/viewLayout/viewLineRenderer.ts
src/vs/editor/common/viewLayout/viewLineRenderer.ts
+21
-21
src/vs/editor/test/common/viewLayout/viewLineRenderer.test.ts
...vs/editor/test/common/viewLayout/viewLineRenderer.test.ts
+6
-6
未找到文件。
src/vs/editor/browser/standalone/colorizer.ts
浏览文件 @
32ee0c31
...
...
@@ -100,7 +100,7 @@ export class Colorizer {
false
,
tokens
));
return
renderResult
.
output
.
join
(
''
)
;
return
renderResult
.
output
;
}
public
static
colorizeModelLine
(
model
:
IModel
,
lineNumber
:
number
,
tabSize
:
number
=
4
):
string
{
...
...
src/vs/editor/browser/viewParts/lines/viewLine.ts
浏览文件 @
32ee0c31
...
...
@@ -118,7 +118,7 @@ export class ViewLine implements IVisibleLineData {
public
getLineInnerHTML
(
lineNumber
:
number
):
string
{
this
.
_isInvalid
=
false
;
return
this
.
_render
(
lineNumber
,
this
.
_lineParts
)
.
join
(
''
)
;
return
this
.
_render
(
lineNumber
,
this
.
_lineParts
);
}
public
layoutLine
(
lineNumber
:
number
,
deltaTop
:
number
):
void
{
...
...
@@ -129,7 +129,7 @@ export class ViewLine implements IVisibleLineData {
// --- end IVisibleLineData
private
_render
(
lineNumber
:
number
,
lineParts
:
ILineParts
):
string
[]
{
private
_render
(
lineNumber
:
number
,
lineParts
:
ILineParts
):
string
{
this
.
_cachedWidth
=
-
1
;
...
...
src/vs/editor/common/viewLayout/viewLineRenderer.ts
浏览文件 @
32ee0c31
...
...
@@ -33,7 +33,7 @@ export class RenderLineInput {
export
interface
IRenderLineOutput
{
charOffsetInPart
:
number
[];
lastRenderedPartIndex
:
number
;
output
:
string
[]
;
output
:
string
;
}
const
_space
=
'
'
.
charCodeAt
(
0
);
...
...
@@ -58,7 +58,7 @@ export function renderLine(input:RenderLineInput): IRenderLineOutput {
charOffsetInPart
:
[],
lastRenderedPartIndex
:
0
,
// This is basically for IE's hit test to work
output
:
[
'
<span><span> </span></span>
'
]
output
:
'
<span><span> </span></span>
'
};
}
...
...
@@ -80,18 +80,18 @@ function renderLineActual(lineText:string, lineTextLength:number, tabSize:number
charBreakIndex
=
+
charBreakIndex
;
let
charIndex
=
0
;
let
out
:
string
[]
=
[]
;
let
out
=
''
;
let
charOffsetInPartArr
:
number
[]
=
[];
let
charOffsetInPart
=
0
;
let
tabsCharDelta
=
0
;
out
.
push
(
'
<span>
'
)
;
out
+=
'
<span>
'
;
for
(
let
partIndex
=
0
,
partIndexLen
=
actualLineParts
.
length
;
partIndex
<
partIndexLen
;
partIndex
++
)
{
let
part
=
actualLineParts
[
partIndex
];
out
.
push
(
'
<span class="token
'
)
;
out
.
push
(
part
.
type
)
;
out
.
push
(
'
">
'
)
;
out
+=
'
<span class="token
'
;
out
+=
part
.
type
;
out
+=
'
">
'
;
let
partRendersWhitespace
=
false
;
if
(
renderWhitespace
)
{
...
...
@@ -115,54 +115,54 @@ function renderLineActual(lineText:string, lineTextLength:number, tabSize:number
tabsCharDelta
+=
insertSpacesCount
-
1
;
charOffsetInPart
+=
insertSpacesCount
-
1
;
if
(
insertSpacesCount
>
0
)
{
out
.
push
(
partRendersWhitespace
?
'
→
'
:
'
'
)
;
out
+=
partRendersWhitespace
?
'
→
'
:
'
'
;
insertSpacesCount
--
;
}
while
(
insertSpacesCount
>
0
)
{
out
.
push
(
'
'
)
;
out
+=
'
'
;
insertSpacesCount
--
;
}
break
;
case
_space
:
out
.
push
(
partRendersWhitespace
?
'
·
'
:
'
'
)
;
out
+=
partRendersWhitespace
?
'
·
'
:
'
'
;
break
;
case
_lowerThan
:
out
.
push
(
'
<
'
)
;
out
+=
'
<
'
;
break
;
case
_greaterThan
:
out
.
push
(
'
>
'
)
;
out
+=
'
>
'
;
break
;
case
_ampersand
:
out
.
push
(
'
&
'
)
;
out
+=
'
&
'
;
break
;
case
0
:
out
.
push
(
'
�
'
)
;
out
+=
'
�
'
;
break
;
case
_bom
:
case
_lineSeparator
:
out
.
push
(
'
\
ufffd
'
)
;
out
+=
'
\
ufffd
'
;
break
;
case
_carriageReturn
:
// zero width space, because carriage return would introduce a line break
out
.
push
(
'
​
'
)
;
out
+=
'
​
'
;
break
;
default
:
out
.
push
(
lineText
.
charAt
(
charIndex
)
);
out
+=
lineText
.
charAt
(
charIndex
);
}
charOffsetInPart
++
;
if
(
charIndex
>=
charBreakIndex
)
{
out
.
push
(
'
…</span></span>
'
)
;
charOffsetInPartArr
[
char
OffsetInPartArr
.
length
-
1
]
++
;
out
+=
'
…</span></span>
'
;
charOffsetInPartArr
[
char
Index
]
=
charOffsetInPart
;
return
{
charOffsetInPart
:
charOffsetInPartArr
,
lastRenderedPartIndex
:
partIndex
,
...
...
@@ -170,9 +170,9 @@ function renderLineActual(lineText:string, lineTextLength:number, tabSize:number
};
}
}
out
.
push
(
'
</span>
'
)
;
out
+=
'
</span>
'
;
}
out
.
push
(
'
</span>
'
)
;
out
+=
'
</span>
'
;
// When getting client rects for the last character, we will position the
// text range at the end of the span, insteaf of at the beginning of next span
...
...
src/vs/editor/test/common/viewLayout/viewLineRenderer.test.ts
浏览文件 @
32ee0c31
...
...
@@ -23,7 +23,7 @@ suite('viewLineRenderer.renderLine', () => {
[
createPart
(
0
,
''
)]
));
assert
.
equal
(
_actual
.
output
.
join
(
''
)
,
'
<span><span class="token ">
'
+
expected
+
'
</span></span>
'
);
assert
.
equal
(
_actual
.
output
,
'
<span><span class="token ">
'
+
expected
+
'
</span></span>
'
);
assert
.
deepEqual
(
_actual
.
charOffsetInPart
,
expectedCharOffsetInPart
);
}
...
...
@@ -63,7 +63,7 @@ suite('viewLineRenderer.renderLine', () => {
parts
));
assert
.
equal
(
_actual
.
output
.
join
(
''
)
,
'
<span>
'
+
expected
+
'
</span>
'
);
assert
.
equal
(
_actual
.
output
,
'
<span>
'
+
expected
+
'
</span>
'
);
assert
.
deepEqual
(
_actual
.
charOffsetInPart
,
expectedCharOffsetInPart
);
}
...
...
@@ -114,7 +114,7 @@ suite('viewLineRenderer.renderLine', () => {
'
<span class="token 5"> …</span>
'
].
join
(
''
);
assert
.
equal
(
_actual
.
output
.
join
(
''
)
,
'
<span>
'
+
expectedOutput
+
'
</span>
'
);
assert
.
equal
(
_actual
.
output
,
'
<span>
'
+
expectedOutput
+
'
</span>
'
);
assert
.
deepEqual
(
_actual
.
charOffsetInPart
,
[
0
,
0
,
...
...
@@ -179,7 +179,7 @@ suite('viewLineRenderer.renderLine', () => {
lineParts
));
assert
.
equal
(
_actual
.
output
.
join
(
''
)
,
'
<span>
'
+
expectedOutput
+
'
</span>
'
);
assert
.
equal
(
_actual
.
output
,
'
<span>
'
+
expectedOutput
+
'
</span>
'
);
assert
.
deepEqual
(
_actual
.
charOffsetInPart
,
expectedOffsets
);
});
...
...
@@ -232,7 +232,7 @@ suite('viewLineRenderer.renderLine', () => {
lineParts
));
assert
.
equal
(
_actual
.
output
.
join
(
''
)
,
'
<span>
'
+
expectedOutput
+
'
</span>
'
);
assert
.
equal
(
_actual
.
output
,
'
<span>
'
+
expectedOutput
+
'
</span>
'
);
assert
.
deepEqual
(
_actual
.
charOffsetInPart
,
expectedOffsets
);
});
...
...
@@ -285,7 +285,7 @@ suite('viewLineRenderer.renderLine', () => {
lineParts
));
assert
.
equal
(
_actual
.
output
.
join
(
''
)
,
'
<span>
'
+
expectedOutput
+
'
</span>
'
);
assert
.
equal
(
_actual
.
output
,
'
<span>
'
+
expectedOutput
+
'
</span>
'
);
assert
.
deepEqual
(
_actual
.
charOffsetInPart
,
expectedOffsets
);
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录