Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
cc88aa58
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,体验更适合开发者的 AI 搜索 >>
提交
cc88aa58
编写于
3月 17, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes #3661: wrapped inline decorations respect view model's min column
上级
42f6a503
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
28 addition
and
16 deletion
+28
-16
src/vs/editor/browser/viewParts/lines/viewLine.ts
src/vs/editor/browser/viewParts/lines/viewLine.ts
+1
-0
src/vs/editor/browser/widget/diffEditorWidget.ts
src/vs/editor/browser/widget/diffEditorWidget.ts
+1
-1
src/vs/editor/common/viewLayout/viewLineParts.ts
src/vs/editor/common/viewLayout/viewLineParts.ts
+6
-6
src/vs/editor/test/common/viewLayout/viewLineParts.test.ts
src/vs/editor/test/common/viewLayout/viewLineParts.test.ts
+20
-9
未找到文件。
src/vs/editor/browser/viewParts/lines/viewLine.ts
浏览文件 @
cc88aa58
...
...
@@ -74,6 +74,7 @@ export class ViewLine implements IVisibleLineData {
// Compute new line parts only if there is some evidence that something might have changed
newLineParts
=
createLineParts
(
lineNumber
,
this
.
_context
.
model
.
getLineMinColumn
(
lineNumber
),
this
.
_context
.
model
.
getLineContent
(
lineNumber
),
this
.
_context
.
model
.
getLineTokens
(
lineNumber
),
inlineDecorations
,
...
...
src/vs/editor/browser/widget/diffEditorWidget.ts
浏览文件 @
cc88aa58
...
...
@@ -1782,7 +1782,7 @@ class InlineViewZonesComputer extends ViewZonesComputer {
}
};
parts
=
createLineParts
(
lineNumber
,
lineContent
,
lineTokens
,
decorations
,
config
.
renderWhitespace
);
parts
=
createLineParts
(
lineNumber
,
1
,
lineContent
,
lineTokens
,
decorations
,
config
.
renderWhitespace
);
var
r
=
renderLine
({
lineContent
:
lineContent
,
...
...
src/vs/editor/common/viewLayout/viewLineParts.ts
浏览文件 @
cc88aa58
...
...
@@ -22,7 +22,7 @@ function cmpLineDecorations(a:ILineDecoration, b:ILineDecoration): number {
return
Range
.
compareRangesUsingStarts
(
a
.
range
,
b
.
range
);
}
export
function
createLineParts
(
lineNumber
:
number
,
lineContent
:
string
,
lineTokens
:
IViewLineTokens
,
rawLineDecorations
:
ILineDecoration
[],
renderWhitespace
:
boolean
):
ILineParts
{
export
function
createLineParts
(
lineNumber
:
number
,
minLineColumn
:
number
,
lineContent
:
string
,
lineTokens
:
IViewLineTokens
,
rawLineDecorations
:
ILineDecoration
[],
renderWhitespace
:
boolean
):
ILineParts
{
if
(
renderWhitespace
)
{
let
oldLength
=
rawLineDecorations
.
length
;
rawLineDecorations
=
insertWhitespace
(
lineNumber
,
lineContent
,
lineTokens
.
getFauxIndentLength
(),
rawLineDecorations
);
...
...
@@ -32,7 +32,7 @@ export function createLineParts(lineNumber:number, lineContent:string, lineToken
}
if
(
rawLineDecorations
.
length
>
0
)
{
return
new
ViewLineParts
(
lineNumber
,
lineTokens
,
lineContent
,
rawLineDecorations
);
return
new
ViewLineParts
(
lineNumber
,
minLineColumn
,
lineTokens
,
lineContent
,
rawLineDecorations
);
}
else
{
return
new
FastViewLineParts
(
lineTokens
,
lineContent
);
}
...
...
@@ -165,10 +165,10 @@ export class ViewLineParts implements ILineParts {
private
lastPartIndex
:
number
;
private
lastEndOffset
:
number
;
constructor
(
lineNumber
:
number
,
lineTokens
:
IViewLineTokens
,
lineContent
:
string
,
rawLineDecorations
:
ILineDecoration
[])
{
constructor
(
lineNumber
:
number
,
minLineColumn
:
number
,
lineTokens
:
IViewLineTokens
,
lineContent
:
string
,
rawLineDecorations
:
ILineDecoration
[])
{
// lineDecorations might overlap on top of each other, so they need to be normalized
var
lineDecorations
=
LineDecorationsNormalizer
.
normalize
(
lineNumber
,
rawLineDecorations
),
var
lineDecorations
=
LineDecorationsNormalizer
.
normalize
(
lineNumber
,
minLineColumn
,
rawLineDecorations
),
lineDecorationsIndex
=
0
,
lineDecorationsLength
=
lineDecorations
.
length
;
...
...
@@ -342,7 +342,7 @@ export class LineDecorationsNormalizer {
/**
* Normalize line decorations. Overlapping decorations will generate multiple segments
*/
public
static
normalize
(
lineNumber
:
number
,
lineDecorations
:
ILineDecoration
[]):
DecorationSegment
[]
{
public
static
normalize
(
lineNumber
:
number
,
minLineColumn
:
number
,
lineDecorations
:
ILineDecoration
[]):
DecorationSegment
[]
{
var
result
:
DecorationSegment
[]
=
[];
...
...
@@ -371,7 +371,7 @@ export class LineDecorationsNormalizer {
continue
;
}
currentStartOffset
=
(
d
.
range
.
startLineNumber
===
lineNumber
?
d
.
range
.
startColumn
-
1
:
0
);
currentStartOffset
=
(
d
.
range
.
startLineNumber
===
lineNumber
?
d
.
range
.
startColumn
-
1
:
minLineColumn
-
1
);
currentEndOffset
=
(
d
.
range
.
endLineNumber
===
lineNumber
?
d
.
range
.
endColumn
-
2
:
LineDecorationsNormalizer
.
MAX_LINE_LENGTH
-
1
);
if
(
currentEndOffset
<
0
)
{
...
...
src/vs/editor/test/common/viewLayout/viewLineParts.test.ts
浏览文件 @
cc88aa58
...
...
@@ -25,7 +25,7 @@ suite('Editor ViewLayout - ViewLineParts', () => {
test
(
'
Bug 9827:Overlapping inline decorations can cause wrong inline class to be applied
'
,
()
=>
{
var
result
=
LineDecorationsNormalizer
.
normalize
(
1
,
[
var
result
=
LineDecorationsNormalizer
.
normalize
(
1
,
1
,
[
newDecoration
(
1
,
1
,
1
,
11
,
'
c1
'
),
newDecoration
(
1
,
3
,
1
,
4
,
'
c2
'
)
]);
...
...
@@ -39,7 +39,7 @@ suite('Editor ViewLayout - ViewLineParts', () => {
test
(
'
issue #3462: no whitespace shown at the end of a decorated line
'
,
()
=>
{
var
result
=
LineDecorationsNormalizer
.
normalize
(
3
,
[
var
result
=
LineDecorationsNormalizer
.
normalize
(
3
,
1
,
[
newDecoration
(
3
,
15
,
3
,
21
,
'
trailing whitespace
'
),
newDecoration
(
3
,
20
,
3
,
21
,
'
inline-folded
'
),
]);
...
...
@@ -50,9 +50,20 @@ suite('Editor ViewLayout - ViewLineParts', () => {
]);
});
test
(
'
issue #3661: Link decoration bleeds to next line when wrapping
'
,
()
=>
{
var
result
=
LineDecorationsNormalizer
.
normalize
(
3
,
12
,
[
newDecoration
(
2
,
12
,
3
,
30
,
'
detected-link
'
)
]);
assert
.
deepEqual
(
result
,
[
new
DecorationSegment
(
11
,
28
,
'
detected-link
'
),
]);
});
test
(
'
ViewLineParts
'
,
()
=>
{
assert
.
deepEqual
(
LineDecorationsNormalizer
.
normalize
(
1
,
[
assert
.
deepEqual
(
LineDecorationsNormalizer
.
normalize
(
1
,
1
,
[
newDecoration
(
1
,
1
,
1
,
2
,
'
c1
'
),
newDecoration
(
1
,
3
,
1
,
4
,
'
c2
'
)
]),
[
...
...
@@ -60,7 +71,7 @@ suite('Editor ViewLayout - ViewLineParts', () => {
new
DecorationSegment
(
2
,
2
,
'
c2
'
)
]);
assert
.
deepEqual
(
LineDecorationsNormalizer
.
normalize
(
1
,
[
assert
.
deepEqual
(
LineDecorationsNormalizer
.
normalize
(
1
,
1
,
[
newDecoration
(
1
,
1
,
1
,
3
,
'
c1
'
),
newDecoration
(
1
,
3
,
1
,
4
,
'
c2
'
)
]),
[
...
...
@@ -68,7 +79,7 @@ suite('Editor ViewLayout - ViewLineParts', () => {
new
DecorationSegment
(
2
,
2
,
'
c2
'
)
]);
assert
.
deepEqual
(
LineDecorationsNormalizer
.
normalize
(
1
,
[
assert
.
deepEqual
(
LineDecorationsNormalizer
.
normalize
(
1
,
1
,
[
newDecoration
(
1
,
1
,
1
,
4
,
'
c1
'
),
newDecoration
(
1
,
3
,
1
,
4
,
'
c2
'
)
]),
[
...
...
@@ -76,7 +87,7 @@ suite('Editor ViewLayout - ViewLineParts', () => {
new
DecorationSegment
(
2
,
2
,
'
c1 c2
'
)
]);
assert
.
deepEqual
(
LineDecorationsNormalizer
.
normalize
(
1
,
[
assert
.
deepEqual
(
LineDecorationsNormalizer
.
normalize
(
1
,
1
,
[
newDecoration
(
1
,
1
,
1
,
4
,
'
c1
'
),
newDecoration
(
1
,
1
,
1
,
4
,
'
c1*
'
),
newDecoration
(
1
,
3
,
1
,
4
,
'
c2
'
)
...
...
@@ -85,7 +96,7 @@ suite('Editor ViewLayout - ViewLineParts', () => {
new
DecorationSegment
(
2
,
2
,
'
c1 c1* c2
'
)
]);
assert
.
deepEqual
(
LineDecorationsNormalizer
.
normalize
(
1
,
[
assert
.
deepEqual
(
LineDecorationsNormalizer
.
normalize
(
1
,
1
,
[
newDecoration
(
1
,
1
,
1
,
4
,
'
c1
'
),
newDecoration
(
1
,
1
,
1
,
4
,
'
c1*
'
),
newDecoration
(
1
,
1
,
1
,
4
,
'
c1**
'
),
...
...
@@ -95,7 +106,7 @@ suite('Editor ViewLayout - ViewLineParts', () => {
new
DecorationSegment
(
2
,
2
,
'
c1 c1* c1** c2
'
)
]);
assert
.
deepEqual
(
LineDecorationsNormalizer
.
normalize
(
1
,
[
assert
.
deepEqual
(
LineDecorationsNormalizer
.
normalize
(
1
,
1
,
[
newDecoration
(
1
,
1
,
1
,
4
,
'
c1
'
),
newDecoration
(
1
,
1
,
1
,
4
,
'
c1*
'
),
newDecoration
(
1
,
1
,
1
,
4
,
'
c1**
'
),
...
...
@@ -106,7 +117,7 @@ suite('Editor ViewLayout - ViewLineParts', () => {
new
DecorationSegment
(
2
,
2
,
'
c1 c1* c1** c2 c2*
'
)
]);
assert
.
deepEqual
(
LineDecorationsNormalizer
.
normalize
(
1
,
[
assert
.
deepEqual
(
LineDecorationsNormalizer
.
normalize
(
1
,
1
,
[
newDecoration
(
1
,
1
,
1
,
4
,
'
c1
'
),
newDecoration
(
1
,
1
,
1
,
4
,
'
c1*
'
),
newDecoration
(
1
,
1
,
1
,
4
,
'
c1**
'
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录