Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
542818bf
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,发现更多精彩内容 >>
提交
542818bf
编写于
3月 18, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix cursor movement not revealing cell into view
上级
8c81d9a8
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
24 addition
and
9 deletion
+24
-9
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
+2
-0
src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts
...rkbench/contrib/notebook/browser/view/notebookCellList.ts
+14
-6
src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts
...bench/contrib/notebook/browser/view/renderers/codeCell.ts
+2
-2
src/vs/workbench/contrib/notebook/browser/viewModel/notebookCellViewModel.ts
...ntrib/notebook/browser/viewModel/notebookCellViewModel.ts
+6
-1
未找到文件。
src/vs/workbench/contrib/notebook/browser/notebookEditor.ts
浏览文件 @
542818bf
...
...
@@ -622,6 +622,7 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
cell
.
state
=
CellState
.
Editing
;
cell
.
focusMode
=
CellFocusMode
.
Editor
;
this
.
revealInCenterIfOutsideViewport
(
cell
);
}
else
{
let
itemDOM
=
this
.
list
?.
domElementAtIndex
(
index
);
if
(
document
.
activeElement
&&
itemDOM
&&
itemDOM
.
contains
(
document
.
activeElement
))
{
...
...
@@ -633,6 +634,7 @@ export class NotebookEditor extends BaseEditor implements INotebookEditor {
this
.
list
?.
setFocus
([
index
]);
this
.
list
?.
setSelection
([
index
]);
this
.
revealInCenterIfOutsideViewport
(
cell
);
this
.
list
?.
focusView
();
}
}
...
...
src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts
浏览文件 @
542818bf
...
...
@@ -19,7 +19,6 @@ import { Range } from 'vs/editor/common/core/range';
import
{
CellRevealType
,
CellRevealPosition
,
CursorAtBoundary
}
from
'
vs/workbench/contrib/notebook/browser/notebookBrowser
'
;
import
{
IDisposable
,
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
CellViewModel
}
from
'
vs/workbench/contrib/notebook/browser/viewModel/notebookCellViewModel
'
;
import
{
EDITOR_TOP_PADDING
}
from
'
vs/workbench/contrib/notebook/browser/constants
'
;
export
class
NotebookCellList
extends
WorkbenchList
<
CellViewModel
>
implements
IDisposable
{
get
onWillScroll
():
Event
<
ScrollEvent
>
{
return
this
.
view
.
onWillScroll
;
}
...
...
@@ -58,7 +57,8 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
const
notebookEditorCursorAtBoundaryContext
=
NOTEBOOK_EDITOR_CURSOR_BOUNDARY
.
bindTo
(
contextKeyService
);
notebookEditorCursorAtBoundaryContext
.
set
(
'
none
'
);
let
cursorSelectionLisener
:
IDisposable
|
null
=
null
;
let
cursorSelectionListener
:
IDisposable
|
null
=
null
;
let
textEditorAttachListener
:
IDisposable
|
null
=
null
;
const
recomputeContext
=
(
element
:
CellViewModel
)
=>
{
switch
(
element
.
cursorAtBoundary
())
{
...
...
@@ -79,15 +79,23 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
};
// Cursor Boundary context
this
.
_localDisposableStore
.
add
(
this
.
onDidChangeFocus
((
e
)
=>
{
cursorSelectionLisener
?.
dispose
();
this
.
_localDisposableStore
.
add
(
this
.
onDidChangeSelection
((
e
)
=>
{
if
(
e
.
elements
.
length
)
{
cursorSelectionListener
?.
dispose
();
textEditorAttachListener
?.
dispose
();
// we only validate the first focused element
const
focusedElement
=
e
.
elements
[
0
];
cursorSelectionLisener
=
focusedElement
.
onDidChangeCursorSelection
(()
=>
{
cursorSelectionLis
t
ener
=
focusedElement
.
onDidChangeCursorSelection
(()
=>
{
recomputeContext
(
focusedElement
);
});
textEditorAttachListener
=
focusedElement
.
onDidChangeEditorAttachState
(()
=>
{
if
(
focusedElement
.
editorAttached
)
{
recomputeContext
(
focusedElement
);
}
});
recomputeContext
(
focusedElement
);
return
;
}
...
...
@@ -145,7 +153,7 @@ export class NotebookCellList extends WorkbenchList<CellViewModel> implements ID
const
startLineNumber
=
range
.
startLineNumber
;
const
lineOffset
=
element
.
getLineScrollTopOffset
(
startLineNumber
);
const
elementTop
=
this
.
view
.
elementTop
(
index
);
const
lineTop
=
elementTop
+
lineOffset
+
EDITOR_TOP_PADDING
;
const
lineTop
=
elementTop
+
lineOffset
;
// TODO@rebornix 30 ---> line height * 1.5
if
(
lineTop
<
scrollTop
)
{
...
...
src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts
浏览文件 @
542818bf
...
...
@@ -57,7 +57,7 @@ export class CodeCell extends Disposable {
if
(
model
&&
templateData
.
editor
)
{
templateData
.
editor
.
setModel
(
model
);
viewCell
.
attachTextEditor
(
templateData
.
editor
);
if
(
notebookEditor
.
getActiveCell
()
===
viewCell
)
{
if
(
notebookEditor
.
getActiveCell
()
===
viewCell
&&
viewCell
.
focusMode
===
CellFocusMode
.
Editor
)
{
templateData
.
editor
?.
focus
();
}
...
...
@@ -81,7 +81,7 @@ export class CodeCell extends Disposable {
viewCell
.
editorHeight
=
realContentHeight
;
}
if
(
this
.
notebookEditor
.
getActiveCell
()
===
this
.
viewCell
)
{
if
(
this
.
notebookEditor
.
getActiveCell
()
===
this
.
viewCell
&&
viewCell
.
focusMode
===
CellFocusMode
.
Editor
)
{
templateData
.
editor
?.
focus
();
}
}
...
...
src/vs/workbench/contrib/notebook/browser/viewModel/notebookCellViewModel.ts
浏览文件 @
542818bf
...
...
@@ -291,6 +291,10 @@ export class CellViewModel extends Disposable implements ICellViewModel {
}
if
(
this
.
_textEditor
===
editor
)
{
if
(
this
.
_cursorChangeListener
===
null
)
{
this
.
_cursorChangeListener
=
this
.
_textEditor
.
onDidChangeCursorSelection
(()
=>
this
.
_onDidChangeCursorSelection
.
fire
());
this
.
_onDidChangeCursorSelection
.
fire
();
}
return
;
}
...
...
@@ -330,6 +334,7 @@ export class CellViewModel extends Disposable implements ICellViewModel {
});
this
.
_textEditor
=
undefined
;
this
.
_cursorChangeListener
?.
dispose
();
this
.
_cursorChangeListener
=
null
;
this
.
_onDidChangeEditorAttachState
.
fire
(
false
);
}
...
...
@@ -346,7 +351,7 @@ export class CellViewModel extends Disposable implements ICellViewModel {
return
0
;
}
return
this
.
_textEditor
.
getTopForLineNumber
(
line
);
return
this
.
_textEditor
.
getTopForLineNumber
(
line
)
+
EDITOR_TOP_PADDING
+
EDITOR_TOOLBAR_HEIGHT
;
}
addDecoration
(
decoration
:
model
.
IModelDeltaDecoration
):
string
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录