Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
12396ea0
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,发现更多精彩内容 >>
提交
12396ea0
编写于
12月 19, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes #40271: Compute visible line widths when restoring the scroll position
上级
d7f82bdc
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
25 addition
and
5 deletion
+25
-5
src/vs/editor/browser/view/viewImpl.ts
src/vs/editor/browser/view/viewImpl.ts
+7
-0
src/vs/editor/browser/viewParts/lines/viewLines.ts
src/vs/editor/browser/viewParts/lines/viewLines.ts
+4
-0
src/vs/editor/browser/widget/codeEditorWidget.ts
src/vs/editor/browser/widget/codeEditorWidget.ts
+10
-0
src/vs/editor/common/commonCodeEditor.ts
src/vs/editor/common/commonCodeEditor.ts
+0
-1
src/vs/editor/common/viewLayout/viewLayout.ts
src/vs/editor/common/viewLayout/viewLayout.ts
+3
-3
src/vs/editor/common/viewModel/viewModel.ts
src/vs/editor/common/viewModel/viewModel.ts
+1
-1
未找到文件。
src/vs/editor/browser/view/viewImpl.ts
浏览文件 @
12396ea0
...
@@ -450,6 +450,13 @@ export class View extends ViewEventHandler {
...
@@ -450,6 +450,13 @@ export class View extends ViewEventHandler {
this
.
_scrollbar
.
delegateVerticalScrollbarMouseDown
(
browserEvent
);
this
.
_scrollbar
.
delegateVerticalScrollbarMouseDown
(
browserEvent
);
}
}
public
restoreState
(
scrollPosition
:
{
scrollLeft
:
number
;
scrollTop
:
number
;
}):
void
{
this
.
_context
.
viewLayout
.
setScrollPositionNow
({
scrollTop
:
scrollPosition
.
scrollTop
});
this
.
_renderNow
();
this
.
viewLines
.
updateLineWidths
();
this
.
_context
.
viewLayout
.
setScrollPositionNow
({
scrollLeft
:
scrollPosition
.
scrollLeft
});
}
public
getOffsetForColumn
(
modelLineNumber
:
number
,
modelColumn
:
number
):
number
{
public
getOffsetForColumn
(
modelLineNumber
:
number
,
modelColumn
:
number
):
number
{
let
modelPosition
=
this
.
_context
.
model
.
validateModelPosition
({
let
modelPosition
=
this
.
_context
.
model
.
validateModelPosition
({
lineNumber
:
modelLineNumber
,
lineNumber
:
modelLineNumber
,
...
...
src/vs/editor/browser/viewParts/lines/viewLines.ts
浏览文件 @
12396ea0
...
@@ -455,6 +455,10 @@ export class ViewLines extends ViewPart implements IVisibleLinesHost<ViewLine>,
...
@@ -455,6 +455,10 @@ export class ViewLines extends ViewPart implements IVisibleLinesHost<ViewLine>,
// --- implementation
// --- implementation
public
updateLineWidths
():
void
{
this
.
_updateLineWidths
(
false
);
}
/**
/**
* Updates the max line width if it is fast to compute.
* Updates the max line width if it is fast to compute.
* Returns true if all lines were taken into account.
* Returns true if all lines were taken into account.
...
...
src/vs/editor/browser/widget/codeEditorWidget.ts
浏览文件 @
12396ea0
...
@@ -392,6 +392,16 @@ export abstract class CodeEditorWidget extends CommonCodeEditor implements edito
...
@@ -392,6 +392,16 @@ export abstract class CodeEditorWidget extends CommonCodeEditor implements edito
viewEventBus
.
onKeyDown
=
(
e
)
=>
this
.
_onKeyDown
.
fire
(
e
);
viewEventBus
.
onKeyDown
=
(
e
)
=>
this
.
_onKeyDown
.
fire
(
e
);
}
}
public
restoreViewState
(
s
:
editorCommon
.
ICodeEditorViewState
):
void
{
super
.
restoreViewState
(
s
);
if
(
!
this
.
cursor
||
!
this
.
hasView
)
{
return
;
}
if
(
s
&&
s
.
cursorState
&&
s
.
viewState
)
{
this
.
_view
.
restoreState
(
this
.
viewModel
.
viewLayout
.
reduceRestoreState
(
s
.
viewState
));
}
}
protected
_detachModel
():
editorCommon
.
IModel
{
protected
_detachModel
():
editorCommon
.
IModel
{
let
removeDomNode
:
HTMLElement
=
null
;
let
removeDomNode
:
HTMLElement
=
null
;
...
...
src/vs/editor/common/commonCodeEditor.ts
浏览文件 @
12396ea0
...
@@ -651,7 +651,6 @@ export abstract class CommonCodeEditor extends Disposable {
...
@@ -651,7 +651,6 @@ export abstract class CommonCodeEditor extends Disposable {
// Backwards compatibility
// Backwards compatibility
this
.
cursor
.
restoreState
([
<
editorCommon
.
ICursorState
>
cursorState
]);
this
.
cursor
.
restoreState
([
<
editorCommon
.
ICursorState
>
cursorState
]);
}
}
this
.
viewModel
.
viewLayout
.
restoreState
(
codeEditorState
.
viewState
);
let
contributionsState
=
s
.
contributionsState
||
{};
let
contributionsState
=
s
.
contributionsState
||
{};
let
keys
=
Object
.
keys
(
this
.
_contributions
);
let
keys
=
Object
.
keys
(
this
.
_contributions
);
...
...
src/vs/editor/common/viewLayout/viewLayout.ts
浏览文件 @
12396ea0
...
@@ -175,15 +175,15 @@ export class ViewLayout extends Disposable implements IViewLayout {
...
@@ -175,15 +175,15 @@ export class ViewLayout extends Disposable implements IViewLayout {
};
};
}
}
public
re
storeState
(
state
:
editorCommon
.
IViewState
):
void
{
public
re
duceRestoreState
(
state
:
editorCommon
.
IViewState
):
{
scrollLeft
:
number
;
scrollTop
:
number
;
}
{
let
restoreScrollTop
=
state
.
scrollTop
;
let
restoreScrollTop
=
state
.
scrollTop
;
if
(
typeof
state
.
scrollTopWithoutViewZones
===
'
number
'
&&
!
this
.
_linesLayout
.
hasWhitespace
())
{
if
(
typeof
state
.
scrollTopWithoutViewZones
===
'
number
'
&&
!
this
.
_linesLayout
.
hasWhitespace
())
{
restoreScrollTop
=
state
.
scrollTopWithoutViewZones
;
restoreScrollTop
=
state
.
scrollTopWithoutViewZones
;
}
}
this
.
scrollable
.
setScrollPositionNow
(
{
return
{
scrollLeft
:
state
.
scrollLeft
,
scrollLeft
:
state
.
scrollLeft
,
scrollTop
:
restoreScrollTop
scrollTop
:
restoreScrollTop
}
)
;
};
}
}
// ---- IVerticalLayoutProvider
// ---- IVerticalLayoutProvider
...
...
src/vs/editor/common/viewModel/viewModel.ts
浏览文件 @
12396ea0
...
@@ -63,7 +63,7 @@ export interface IViewLayout {
...
@@ -63,7 +63,7 @@ export interface IViewLayout {
getWhitespaces
():
IEditorWhitespace
[];
getWhitespaces
():
IEditorWhitespace
[];
saveState
():
IViewState
;
saveState
():
IViewState
;
re
storeState
(
state
:
IViewState
):
void
;
re
duceRestoreState
(
state
:
IViewState
):
{
scrollLeft
:
number
;
scrollTop
:
number
;
}
;
isAfterLines
(
verticalOffset
:
number
):
boolean
;
isAfterLines
(
verticalOffset
:
number
):
boolean
;
getLineNumberAtVerticalOffset
(
verticalOffset
:
number
):
number
;
getLineNumberAtVerticalOffset
(
verticalOffset
:
number
):
number
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录