Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
476147ec
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,发现更多精彩内容 >>
提交
476147ec
编写于
1月 11, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove zombie nodes when dynamic height changes.
上级
3544573d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
44 addition
and
4 deletion
+44
-4
src/vs/base/browser/ui/list/listView.ts
src/vs/base/browser/ui/list/listView.ts
+39
-1
src/vs/workbench/contrib/notebook/browser/contentWidget.ts
src/vs/workbench/contrib/notebook/browser/contentWidget.ts
+3
-2
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
+2
-1
未找到文件。
src/vs/base/browser/ui/list/listView.ts
浏览文件 @
476147ec
...
...
@@ -286,6 +286,8 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
}
updateDynamicHeight
(
index
:
number
,
element
:
T
,
size
:
number
):
void
{
const
renderRange
=
this
.
getRenderRange
(
this
.
lastRenderTop
,
this
.
lastRenderHeight
);
this
.
rangeMap
.
splice
(
index
,
1
,
[
{
size
:
size
...
...
@@ -294,13 +296,23 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
this
.
items
[
index
].
size
=
size
;
const
renderRange
=
this
.
getRenderRange
(
this
.
lastRenderTop
,
this
.
lastRenderHeight
+
size
);
for
(
let
i
=
renderRange
.
start
;
i
<
renderRange
.
end
;
i
++
)
{
if
(
this
.
items
[
i
].
row
)
{
this
.
updateItemInDOM
(
this
.
items
[
i
],
i
);
}
}
const
newRenderRange
=
this
.
getRenderRange
(
this
.
lastRenderTop
,
this
.
lastRenderHeight
);
const
removeRanges
=
Range
.
relativeComplement
(
renderRange
,
newRenderRange
);
for
(
const
range
of
removeRanges
)
{
for
(
let
i
=
range
.
start
;
i
<
range
.
end
;
i
++
)
{
if
(
this
.
items
[
i
].
row
)
{
this
.
removeItemFromDOM
(
i
);
}
}
}
this
.
_onDidChangeContentHeight
.
fire
(
this
.
contentHeight
);
this
.
eventuallyUpdateScrollDimensions
();
}
...
...
@@ -1117,6 +1129,12 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
this
.
scrollTop
=
this
.
elementTop
(
anchorElementIndex
)
-
anchorElementTopDelta
!
;
}
if
(
this
.
rowsContainer
.
getElementsByClassName
(
'
monaco-list-row
'
).
length
>
(
renderRange
.
end
-
renderRange
.
start
))
{
// there are zombie list rows
// console.log('remove zombie rows');
this
.
removeZombieRows
(
renderRange
);
}
this
.
_onDidChangeContentHeight
.
fire
(
this
.
contentHeight
);
this
.
isRendering
=
false
;
return
;
...
...
@@ -1124,6 +1142,26 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
}
}
private
removeZombieRows
(
renderRange
:
IRange
)
{
let
elements
=
this
.
rowsContainer
.
getElementsByClassName
(
'
monaco-list-row
'
);
let
rowsToRemove
=
[];
for
(
let
i
=
0
;
i
<
elements
.
length
;
i
++
)
{
let
index
=
Number
(
elements
[
i
].
getAttribute
(
'
data-index
'
));
if
(
index
>=
renderRange
.
start
&&
index
<
renderRange
.
end
)
{
continue
;
}
else
{
rowsToRemove
.
push
(
index
);
}
}
for
(
let
i
=
0
;
i
<
rowsToRemove
.
length
;
i
++
)
{
let
index
=
rowsToRemove
[
i
];
if
(
this
.
items
[
index
].
row
)
{
this
.
removeItemFromDOM
(
index
);
}
}
}
private
probeDynamicHeight
(
index
:
number
):
number
{
const
item
=
this
.
items
[
index
];
...
...
src/vs/workbench/contrib/notebook/browser/contentWidget.ts
浏览文件 @
476147ec
...
...
@@ -213,10 +213,11 @@ export class BackLayerWebView extends Disposable {
if
(
data
.
type
===
'
dimension
'
)
{
let
cell
=
this
.
mapping
.
get
(
data
.
id
)?.
cell
;
let
height
=
data
.
data
.
height
;
let
outputHeight
=
height
===
0
?
0
:
height
+
32
;
let
outputHeight
=
height
===
0
?
0
:
height
+
16
;
if
(
cell
)
{
const
lineNum
=
cell
.
lineCount
;
const
totalHeight
=
Math
.
max
(
lineNum
+
1
,
5
)
*
21
;
const
lineHeight
=
this
.
notebookHandler
.
getFontInfo
()?.
lineHeight
??
18
;
const
totalHeight
=
Math
.
max
(
lineNum
+
1
,
5
)
*
lineHeight
;
cell
.
setDynamicHeight
(
totalHeight
+
8
/* code cell padding */
+
outputHeight
);
this
.
notebookHandler
.
layoutElement
(
cell
,
totalHeight
+
8
/* code cell padding */
+
outputHeight
);
}
...
...
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
浏览文件 @
476147ec
...
...
@@ -279,7 +279,8 @@ export class NotebookEditor extends BaseEditor implements NotebookHandler {
this
.
localStore
.
add
(
this
.
list
!
.
onDidScroll
(()
=>
updateScrollPosition
()));
this
.
localStore
.
add
(
this
.
list
!
.
onDidChangeContentHeight
(()
=>
updateScrollPosition
()));
this
.
list
?.
splice
(
0
,
this
.
list
?.
length
,
this
.
viewCells
);
this
.
list
?.
splice
(
0
,
this
.
list
?.
length
);
this
.
list
?.
splice
(
0
,
0
,
this
.
viewCells
);
this
.
list
?.
layout
();
});
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录