Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
2a49e821
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,发现更多精彩内容 >>
未验证
提交
2a49e821
编写于
11月 15, 2019
作者:
A
Alexandru Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Switch to objects in LinesLayout
上级
3e092938
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
340 addition
and
314 deletion
+340
-314
src/vs/editor/browser/viewParts/viewZones/viewZones.ts
src/vs/editor/browser/viewParts/viewZones/viewZones.ts
+15
-9
src/vs/editor/common/viewLayout/linesLayout.ts
src/vs/editor/common/viewLayout/linesLayout.ts
+205
-170
src/vs/editor/test/common/viewLayout/linesLayout.test.ts
src/vs/editor/test/common/viewLayout/linesLayout.test.ts
+120
-135
未找到文件。
src/vs/editor/browser/viewParts/viewZones/viewZones.ts
浏览文件 @
2a49e821
...
...
@@ -13,7 +13,7 @@ import { ViewContext } from 'vs/editor/common/view/viewContext';
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
IViewWhitespaceViewportData
}
from
'
vs/editor/common/viewModel/viewModel
'
;
import
{
EditorOption
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
IWhitespaceChangeAccessor
}
from
'
vs/editor/common/viewLayout/linesLayout
'
;
import
{
IWhitespaceChangeAccessor
,
EditorWhitespace
}
from
'
vs/editor/common/viewLayout/linesLayout
'
;
export
interface
IMyViewZone
{
whitespaceId
:
string
;
...
...
@@ -74,6 +74,11 @@ export class ViewZones extends ViewPart {
// ---- begin view event handlers
private
_recomputeWhitespacesProps
():
boolean
{
const
whitespaces
=
this
.
_context
.
viewLayout
.
getWhitespaces
();
const
oldWhitespaces
=
new
Map
<
string
,
EditorWhitespace
>
();
for
(
const
whitespace
of
whitespaces
)
{
oldWhitespaces
.
set
(
whitespace
.
id
,
whitespace
);
}
return
this
.
_context
.
viewLayout
.
changeWhitespace
((
whitespaceAccessor
:
IWhitespaceChangeAccessor
)
=>
{
let
hadAChange
=
false
;
...
...
@@ -82,7 +87,9 @@ export class ViewZones extends ViewPart {
const
id
=
keys
[
i
];
const
zone
=
this
.
_zones
[
id
];
const
props
=
this
.
_computeWhitespaceProps
(
zone
.
delegate
);
if
(
whitespaceAccessor
.
changeOneWhitespace
(
id
,
props
.
afterViewLineNumber
,
props
.
heightInPx
))
{
const
oldWhitespace
=
oldWhitespaces
.
get
(
id
);
if
(
oldWhitespace
&&
(
oldWhitespace
.
afterLineNumber
!==
props
.
afterViewLineNumber
||
oldWhitespace
.
heightInPx
!==
props
.
heightInPx
))
{
whitespaceAccessor
.
changeOneWhitespace
(
id
,
props
.
afterViewLineNumber
,
props
.
heightInPx
);
this
.
_safeCallOnComputedHeight
(
zone
.
delegate
,
props
.
heightInPx
);
hadAChange
=
true
;
}
...
...
@@ -286,20 +293,19 @@ export class ViewZones extends ViewPart {
}
private
_layoutZone
(
whitespaceAccessor
:
IWhitespaceChangeAccessor
,
id
:
string
):
boolean
{
let
changed
=
false
;
if
(
this
.
_zones
.
hasOwnProperty
(
id
))
{
const
zone
=
this
.
_zones
[
id
];
const
props
=
this
.
_computeWhitespaceProps
(
zone
.
delegate
);
// const newOrdinal = this._getZoneOrdinal(zone.delegate);
changed
=
whitespaceAccessor
.
changeOneWhitespace
(
zone
.
whitespaceId
,
props
.
afterViewLineNumber
,
props
.
heightInPx
)
||
changed
;
whitespaceAccessor
.
changeOneWhitespace
(
zone
.
whitespaceId
,
props
.
afterViewLineNumber
,
props
.
heightInPx
)
;
// TODO@Alex: change `newOrdinal` too
if
(
changed
)
{
this
.
_safeCallOnComputedHeight
(
zone
.
delegate
,
props
.
heightInPx
);
this
.
setShouldRender
();
}
this
.
_safeCallOnComputedHeight
(
zone
.
delegate
,
props
.
heightInPx
);
this
.
setShouldRender
(
);
return
true
;
}
return
changed
;
return
false
;
}
public
shouldSuppressMouseDownOnViewZone
(
id
:
string
):
boolean
{
...
...
src/vs/editor/common/viewLayout/linesLayout.ts
浏览文件 @
2a49e821
此差异已折叠。
点击以展开。
src/vs/editor/test/common/viewLayout/linesLayout.test.ts
浏览文件 @
2a49e821
...
...
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
assert
from
'
assert
'
;
import
{
LinesLayout
}
from
'
vs/editor/common/viewLayout/linesLayout
'
;
import
{
LinesLayout
,
InternalWhitespace
}
from
'
vs/editor/common/viewLayout/linesLayout
'
;
suite
(
'
Editor ViewLayout - LinesLayout
'
,
()
=>
{
...
...
@@ -13,15 +13,15 @@ suite('Editor ViewLayout - LinesLayout', () => {
});
}
function
changeOneWhitespace
(
linesLayout
:
LinesLayout
,
id
:
string
,
newAfterLineNumber
:
number
,
newHeight
:
number
):
boolean
{
return
linesLayout
.
changeWhitespace
((
accessor
)
=>
{
return
accessor
.
changeOneWhitespace
(
id
,
newAfterLineNumber
,
newHeight
);
function
changeOneWhitespace
(
linesLayout
:
LinesLayout
,
id
:
string
,
newAfterLineNumber
:
number
,
newHeight
:
number
):
void
{
linesLayout
.
changeWhitespace
((
accessor
)
=>
{
accessor
.
changeOneWhitespace
(
id
,
newAfterLineNumber
,
newHeight
);
});
}
function
removeWhitespace
(
linesLayout
:
LinesLayout
,
id
:
string
):
boolean
{
return
linesLayout
.
changeWhitespace
((
accessor
)
=>
{
return
accessor
.
removeWhitespace
(
id
);
function
removeWhitespace
(
linesLayout
:
LinesLayout
,
id
:
string
):
void
{
linesLayout
.
changeWhitespace
((
accessor
)
=>
{
accessor
.
removeWhitespace
(
id
);
});
}
...
...
@@ -845,136 +845,121 @@ suite('Editor ViewLayout - LinesLayout', () => {
test
(
'
LinesLayout findInsertionIndex
'
,
()
=>
{
const
makeArray
=
(
size
:
number
,
fillValue
:
number
)
=>
{
let
r
:
number
[]
=
[];
for
(
let
i
=
0
;
i
<
size
;
i
++
)
{
r
[
i
]
=
fillValue
;
}
return
r
;
const
makeInternalWhitespace
=
(
afterLineNumbers
:
number
[],
ordinal
:
number
=
0
)
=>
{
return
afterLineNumbers
.
map
((
afterLineNumber
)
=>
new
InternalWhitespace
(
''
,
afterLineNumber
,
ordinal
,
0
,
0
));
};
let
arr
:
number
[];
let
ordinals
:
number
[];
arr
=
[];
ordinals
=
makeArray
(
arr
.
length
,
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
0
,
ordinals
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
1
,
ordinals
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
2
,
ordinals
,
0
),
0
);
arr
=
[
1
];
ordinals
=
makeArray
(
arr
.
length
,
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
0
,
ordinals
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
1
,
ordinals
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
2
,
ordinals
,
0
),
1
);
arr
=
[
1
,
3
];
ordinals
=
makeArray
(
arr
.
length
,
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
0
,
ordinals
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
1
,
ordinals
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
2
,
ordinals
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
3
,
ordinals
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
4
,
ordinals
,
0
),
2
);
arr
=
[
1
,
3
,
5
];
ordinals
=
makeArray
(
arr
.
length
,
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
0
,
ordinals
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
1
,
ordinals
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
2
,
ordinals
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
3
,
ordinals
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
4
,
ordinals
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
5
,
ordinals
,
0
),
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
6
,
ordinals
,
0
),
3
);
arr
=
[
1
,
3
,
5
];
ordinals
=
makeArray
(
arr
.
length
,
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
0
,
ordinals
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
1
,
ordinals
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
2
,
ordinals
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
3
,
ordinals
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
4
,
ordinals
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
5
,
ordinals
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
6
,
ordinals
,
0
),
3
);
arr
=
[
1
,
3
,
5
,
7
];
ordinals
=
makeArray
(
arr
.
length
,
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
0
,
ordinals
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
1
,
ordinals
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
2
,
ordinals
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
3
,
ordinals
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
4
,
ordinals
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
5
,
ordinals
,
0
),
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
6
,
ordinals
,
0
),
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
7
,
ordinals
,
0
),
4
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
8
,
ordinals
,
0
),
4
);
arr
=
[
1
,
3
,
5
,
7
,
9
];
ordinals
=
makeArray
(
arr
.
length
,
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
0
,
ordinals
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
1
,
ordinals
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
2
,
ordinals
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
3
,
ordinals
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
4
,
ordinals
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
5
,
ordinals
,
0
),
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
6
,
ordinals
,
0
),
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
7
,
ordinals
,
0
),
4
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
8
,
ordinals
,
0
),
4
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
9
,
ordinals
,
0
),
5
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
10
,
ordinals
,
0
),
5
);
arr
=
[
1
,
3
,
5
,
7
,
9
,
11
];
ordinals
=
makeArray
(
arr
.
length
,
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
0
,
ordinals
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
1
,
ordinals
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
2
,
ordinals
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
3
,
ordinals
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
4
,
ordinals
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
5
,
ordinals
,
0
),
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
6
,
ordinals
,
0
),
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
7
,
ordinals
,
0
),
4
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
8
,
ordinals
,
0
),
4
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
9
,
ordinals
,
0
),
5
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
10
,
ordinals
,
0
),
5
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
11
,
ordinals
,
0
),
6
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
12
,
ordinals
,
0
),
6
);
arr
=
[
1
,
3
,
5
,
7
,
9
,
11
,
13
];
ordinals
=
makeArray
(
arr
.
length
,
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
0
,
ordinals
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
1
,
ordinals
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
2
,
ordinals
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
3
,
ordinals
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
4
,
ordinals
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
5
,
ordinals
,
0
),
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
6
,
ordinals
,
0
),
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
7
,
ordinals
,
0
),
4
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
8
,
ordinals
,
0
),
4
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
9
,
ordinals
,
0
),
5
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
10
,
ordinals
,
0
),
5
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
11
,
ordinals
,
0
),
6
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
12
,
ordinals
,
0
),
6
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
13
,
ordinals
,
0
),
7
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
14
,
ordinals
,
0
),
7
);
arr
=
[
1
,
3
,
5
,
7
,
9
,
11
,
13
,
15
];
ordinals
=
makeArray
(
arr
.
length
,
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
0
,
ordinals
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
1
,
ordinals
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
2
,
ordinals
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
3
,
ordinals
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
4
,
ordinals
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
5
,
ordinals
,
0
),
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
6
,
ordinals
,
0
),
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
7
,
ordinals
,
0
),
4
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
8
,
ordinals
,
0
),
4
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
9
,
ordinals
,
0
),
5
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
10
,
ordinals
,
0
),
5
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
11
,
ordinals
,
0
),
6
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
12
,
ordinals
,
0
),
6
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
13
,
ordinals
,
0
),
7
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
14
,
ordinals
,
0
),
7
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
15
,
ordinals
,
0
),
8
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
16
,
ordinals
,
0
),
8
);
let
arr
:
InternalWhitespace
[];
arr
=
makeInternalWhitespace
([]);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
0
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
1
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
2
,
0
),
0
);
arr
=
makeInternalWhitespace
([
1
]);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
0
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
1
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
2
,
0
),
1
);
arr
=
makeInternalWhitespace
([
1
,
3
]);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
0
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
1
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
2
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
3
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
4
,
0
),
2
);
arr
=
makeInternalWhitespace
([
1
,
3
,
5
]);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
0
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
1
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
2
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
3
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
4
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
5
,
0
),
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
6
,
0
),
3
);
arr
=
makeInternalWhitespace
([
1
,
3
,
5
],
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
0
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
1
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
2
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
3
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
4
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
5
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
6
,
0
),
3
);
arr
=
makeInternalWhitespace
([
1
,
3
,
5
,
7
]);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
0
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
1
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
2
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
3
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
4
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
5
,
0
),
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
6
,
0
),
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
7
,
0
),
4
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
8
,
0
),
4
);
arr
=
makeInternalWhitespace
([
1
,
3
,
5
,
7
,
9
]);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
0
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
1
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
2
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
3
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
4
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
5
,
0
),
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
6
,
0
),
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
7
,
0
),
4
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
8
,
0
),
4
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
9
,
0
),
5
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
10
,
0
),
5
);
arr
=
makeInternalWhitespace
([
1
,
3
,
5
,
7
,
9
,
11
]);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
0
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
1
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
2
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
3
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
4
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
5
,
0
),
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
6
,
0
),
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
7
,
0
),
4
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
8
,
0
),
4
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
9
,
0
),
5
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
10
,
0
),
5
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
11
,
0
),
6
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
12
,
0
),
6
);
arr
=
makeInternalWhitespace
([
1
,
3
,
5
,
7
,
9
,
11
,
13
]);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
0
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
1
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
2
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
3
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
4
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
5
,
0
),
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
6
,
0
),
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
7
,
0
),
4
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
8
,
0
),
4
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
9
,
0
),
5
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
10
,
0
),
5
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
11
,
0
),
6
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
12
,
0
),
6
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
13
,
0
),
7
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
14
,
0
),
7
);
arr
=
makeInternalWhitespace
([
1
,
3
,
5
,
7
,
9
,
11
,
13
,
15
]);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
0
,
0
),
0
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
1
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
2
,
0
),
1
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
3
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
4
,
0
),
2
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
5
,
0
),
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
6
,
0
),
3
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
7
,
0
),
4
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
8
,
0
),
4
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
9
,
0
),
5
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
10
,
0
),
5
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
11
,
0
),
6
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
12
,
0
),
6
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
13
,
0
),
7
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
14
,
0
),
7
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
15
,
0
),
8
);
assert
.
equal
(
LinesLayout
.
findInsertionIndex
(
arr
,
16
,
0
),
8
);
});
test
(
'
LinesLayout changeWhitespaceAfterLineNumber & getFirstWhitespaceIndexAfterLineNumber
'
,
()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录