Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b6138b95
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,发现更多精彩内容 >>
未验证
提交
b6138b95
编写于
10月 10, 2019
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes #80825: Use only on Windows
上级
27039759
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
16 addition
and
15 deletion
+16
-15
src/vs/editor/common/modes/textToHtmlTokenizer.ts
src/vs/editor/common/modes/textToHtmlTokenizer.ts
+3
-3
src/vs/editor/common/viewModel/viewModelImpl.ts
src/vs/editor/common/viewModel/viewModelImpl.ts
+2
-1
src/vs/editor/test/common/modes/textToHtmlTokenizer.test.ts
src/vs/editor/test/common/modes/textToHtmlTokenizer.test.ts
+11
-11
未找到文件。
src/vs/editor/common/modes/textToHtmlTokenizer.ts
浏览文件 @
b6138b95
...
...
@@ -24,7 +24,7 @@ export function tokenizeToString(text: string, tokenizationSupport: IReducedToke
return
_tokenizeToString
(
text
,
tokenizationSupport
||
fallback
);
}
export
function
tokenizeLineToHTML
(
text
:
string
,
viewLineTokens
:
IViewLineTokens
,
colorMap
:
string
[],
startOffset
:
number
,
endOffset
:
number
,
tabSize
:
number
):
string
{
export
function
tokenizeLineToHTML
(
text
:
string
,
viewLineTokens
:
IViewLineTokens
,
colorMap
:
string
[],
startOffset
:
number
,
endOffset
:
number
,
tabSize
:
number
,
useNbsp
:
boolean
):
string
{
let
result
=
`<div>`
;
let
charIndex
=
startOffset
;
let
tabsCharDelta
=
0
;
...
...
@@ -46,7 +46,7 @@ export function tokenizeLineToHTML(text: string, viewLineTokens: IViewLineTokens
let
insertSpacesCount
=
tabSize
-
(
charIndex
+
tabsCharDelta
)
%
tabSize
;
tabsCharDelta
+=
insertSpacesCount
-
1
;
while
(
insertSpacesCount
>
0
)
{
partContent
+=
'
'
;
partContent
+=
useNbsp
?
'
'
:
'
'
;
insertSpacesCount
--
;
}
break
;
...
...
@@ -78,7 +78,7 @@ export function tokenizeLineToHTML(text: string, viewLineTokens: IViewLineTokens
break
;
case
CharCode
.
Space
:
partContent
+=
'
'
;
partContent
+=
useNbsp
?
'
'
:
'
'
;
break
;
default
:
...
...
src/vs/editor/common/viewModel/viewModelImpl.ts
浏览文件 @
b6138b95
...
...
@@ -24,6 +24,7 @@ import { ICoordinatesConverter, IOverviewRulerDecorations, IViewModel, MinimapLi
import
{
ViewModelDecorations
}
from
'
vs/editor/common/viewModel/viewModelDecorations
'
;
import
{
ITheme
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
const
USE_IDENTITY_LINES_COLLECTION
=
true
;
...
...
@@ -713,7 +714,7 @@ export class ViewModel extends viewEvents.ViewEventEmitter implements IViewModel
if
(
lineContent
===
''
)
{
result
+=
'
<br>
'
;
}
else
{
result
+=
tokenizeLineToHTML
(
lineContent
,
lineTokens
.
inflate
(),
colorMap
,
startOffset
,
endOffset
,
tabSize
);
result
+=
tokenizeLineToHTML
(
lineContent
,
lineTokens
.
inflate
(),
colorMap
,
startOffset
,
endOffset
,
tabSize
,
platform
.
isWindows
);
}
}
...
...
src/vs/editor/test/common/modes/textToHtmlTokenizer.test.ts
浏览文件 @
b6138b95
...
...
@@ -105,7 +105,7 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
const
colorMap
=
[
null
!
,
'
#000000
'
,
'
#ffffff
'
,
'
#ff0000
'
,
'
#00ff00
'
,
'
#0000ff
'
];
assert
.
equal
(
tokenizeLineToHTML
(
text
,
lineTokens
,
colorMap
,
0
,
17
,
4
),
tokenizeLineToHTML
(
text
,
lineTokens
,
colorMap
,
0
,
17
,
4
,
true
),
[
'
<div>
'
,
'
<span style="color: #ff0000;font-style: italic;font-weight: bold;">Ciao</span>
'
,
...
...
@@ -118,7 +118,7 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
);
assert
.
equal
(
tokenizeLineToHTML
(
text
,
lineTokens
,
colorMap
,
0
,
12
,
4
),
tokenizeLineToHTML
(
text
,
lineTokens
,
colorMap
,
0
,
12
,
4
,
true
),
[
'
<div>
'
,
'
<span style="color: #ff0000;font-style: italic;font-weight: bold;">Ciao</span>
'
,
...
...
@@ -131,7 +131,7 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
);
assert
.
equal
(
tokenizeLineToHTML
(
text
,
lineTokens
,
colorMap
,
0
,
11
,
4
),
tokenizeLineToHTML
(
text
,
lineTokens
,
colorMap
,
0
,
11
,
4
,
true
),
[
'
<div>
'
,
'
<span style="color: #ff0000;font-style: italic;font-weight: bold;">Ciao</span>
'
,
...
...
@@ -143,7 +143,7 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
);
assert
.
equal
(
tokenizeLineToHTML
(
text
,
lineTokens
,
colorMap
,
1
,
11
,
4
),
tokenizeLineToHTML
(
text
,
lineTokens
,
colorMap
,
1
,
11
,
4
,
true
),
[
'
<div>
'
,
'
<span style="color: #ff0000;font-style: italic;font-weight: bold;">iao</span>
'
,
...
...
@@ -155,7 +155,7 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
);
assert
.
equal
(
tokenizeLineToHTML
(
text
,
lineTokens
,
colorMap
,
4
,
11
,
4
),
tokenizeLineToHTML
(
text
,
lineTokens
,
colorMap
,
4
,
11
,
4
,
true
),
[
'
<div>
'
,
'
<span style="color: #000000;"> </span>
'
,
...
...
@@ -166,7 +166,7 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
);
assert
.
equal
(
tokenizeLineToHTML
(
text
,
lineTokens
,
colorMap
,
5
,
11
,
4
),
tokenizeLineToHTML
(
text
,
lineTokens
,
colorMap
,
5
,
11
,
4
,
true
),
[
'
<div>
'
,
'
<span style="color: #00ff00;">hello</span>
'
,
...
...
@@ -176,7 +176,7 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
);
assert
.
equal
(
tokenizeLineToHTML
(
text
,
lineTokens
,
colorMap
,
5
,
10
,
4
),
tokenizeLineToHTML
(
text
,
lineTokens
,
colorMap
,
5
,
10
,
4
,
true
),
[
'
<div>
'
,
'
<span style="color: #00ff00;">hello</span>
'
,
...
...
@@ -185,7 +185,7 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
);
assert
.
equal
(
tokenizeLineToHTML
(
text
,
lineTokens
,
colorMap
,
6
,
9
,
4
),
tokenizeLineToHTML
(
text
,
lineTokens
,
colorMap
,
6
,
9
,
4
,
true
),
[
'
<div>
'
,
'
<span style="color: #00ff00;">ell</span>
'
,
...
...
@@ -238,7 +238,7 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
const
colorMap
=
[
null
!
,
'
#000000
'
,
'
#ffffff
'
,
'
#ff0000
'
,
'
#00ff00
'
,
'
#0000ff
'
];
assert
.
equal
(
tokenizeLineToHTML
(
text
,
lineTokens
,
colorMap
,
0
,
21
,
4
),
tokenizeLineToHTML
(
text
,
lineTokens
,
colorMap
,
0
,
21
,
4
,
true
),
[
'
<div>
'
,
'
<span style="color: #000000;"> </span>
'
,
...
...
@@ -252,7 +252,7 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
);
assert
.
equal
(
tokenizeLineToHTML
(
text
,
lineTokens
,
colorMap
,
0
,
17
,
4
),
tokenizeLineToHTML
(
text
,
lineTokens
,
colorMap
,
0
,
17
,
4
,
true
),
[
'
<div>
'
,
'
<span style="color: #000000;"> </span>
'
,
...
...
@@ -266,7 +266,7 @@ suite('Editor Modes - textToHtmlTokenizer', () => {
);
assert
.
equal
(
tokenizeLineToHTML
(
text
,
lineTokens
,
colorMap
,
0
,
3
,
4
),
tokenizeLineToHTML
(
text
,
lineTokens
,
colorMap
,
0
,
3
,
4
,
true
),
[
'
<div>
'
,
'
<span style="color: #000000;"> </span>
'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录