Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
791341b3
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,发现更多精彩内容 >>
提交
791341b3
编写于
3月 12, 2017
作者:
I
initialshl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prevent unnecessary switchings of active editor or group in JoinTwoGroupsAction
上级
cc3d7374
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
18 addition
and
12 deletion
+18
-12
src/vs/workbench/browser/parts/editor/editorActions.ts
src/vs/workbench/browser/parts/editor/editorActions.ts
+14
-10
src/vs/workbench/browser/parts/editor/editorPart.ts
src/vs/workbench/browser/parts/editor/editorPart.ts
+3
-2
src/vs/workbench/services/group/common/groupService.ts
src/vs/workbench/services/group/common/groupService.ts
+1
-0
未找到文件。
src/vs/workbench/browser/parts/editor/editorActions.ts
浏览文件 @
791341b3
...
...
@@ -125,7 +125,7 @@ export class JoinTwoGroupsAction extends Action {
const
editorStacksModel
=
this
.
editorGroupService
.
getStacksModel
();
// Return if has no other group to join to
if
(
editorStacksModel
.
groups
.
length
<
=
1
)
{
if
(
editorStacksModel
.
groups
.
length
<
2
)
{
return
TPromise
.
as
(
true
);
}
...
...
@@ -151,17 +151,21 @@ export class JoinTwoGroupsAction extends Action {
const
activeEditor
=
fromGroup
.
activeEditor
;
const
fromGroupEditors
=
fromGroup
.
getEditors
();
const
fromGroupTotalCount
=
fromGroupEditors
.
length
;
// If an editor exists in both groups, only the editor in the joining group is kept
if
(
toPosition
<
fromPosition
)
{
fromGroupEditors
.
forEach
(
e
=>
this
.
editorGroupService
.
moveEditor
(
e
,
fromPosition
,
toPosition
,
{
index
:
toGroup
.
count
,
inactive
:
true
}));
}
else
{
fromGroupEditors
.
forEach
(
e
=>
this
.
editorGroupService
.
moveEditor
(
e
,
fromPosition
,
toPosition
,
{
index
:
fromGroupTotalCount
-
fromGroup
.
count
,
inactive
:
true
}));
}
// Insert the editors to the start if moving to the next group, otherwise insert to the end
// If an editor exists in both groups, its index is respected as in the joining group
const
movingToNextGroup
=
fromPosition
<
toPosition
;
let
index
=
movingToNextGroup
?
0
:
toGroup
.
count
;
// Inactive and preserve focus options are used to prevent unnecessary switchings of active editor or group
fromGroupEditors
.
forEach
(
e
=>
{
const
inactive
=
e
!==
activeEditor
;
this
.
editorGroupService
.
moveEditor
(
e
,
fromPosition
,
toPosition
,
{
index
,
inactive
,
preserveFocus
:
inactive
});
index
=
movingToNextGroup
?
index
+
1
:
toGroup
.
count
;
});
//
Regain focus on the active editor
this
.
editor
Service
.
openEditor
(
activeEditor
);
//
Focus may be lost when the joining group is closed, regain focus on the target group
this
.
editor
GroupService
.
focusGroup
(
toGroup
);
return
TPromise
.
as
(
true
);
}
...
...
src/vs/workbench/browser/parts/editor/editorPart.ts
浏览文件 @
791341b3
...
...
@@ -856,14 +856,15 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
const
index
=
moveOptions
&&
moveOptions
.
index
;
const
inactive
=
moveOptions
&&
moveOptions
.
inactive
;
const
preserveFocus
=
moveOptions
&&
moveOptions
.
preserveFocus
;
// When moving an editor, try to preserve as much view state as possible by checking
// for the editor to be a text editor and creating the options accordingly if so
let
options
=
EditorOptions
.
create
({
pinned
:
true
,
index
,
inactive
});
let
options
=
EditorOptions
.
create
({
pinned
:
true
,
index
,
inactive
,
preserveFocus
});
const
activeEditor
=
this
.
getActiveEditor
();
const
codeEditor
=
getCodeEditor
(
activeEditor
);
if
(
codeEditor
&&
activeEditor
.
position
===
this
.
stacks
.
positionOfGroup
(
fromGroup
)
&&
input
.
matches
(
activeEditor
.
input
))
{
options
=
TextEditorOptions
.
create
({
pinned
:
true
,
index
,
inactive
});
options
=
TextEditorOptions
.
create
({
pinned
:
true
,
index
,
inactive
,
preserveFocus
});
(
<
TextEditorOptions
>
options
).
fromEditor
(
codeEditor
);
}
...
...
src/vs/workbench/services/group/common/groupService.ts
浏览文件 @
791341b3
...
...
@@ -29,6 +29,7 @@ export interface ITabOptions {
export
interface
IMoveOptions
{
index
?:
number
;
inactive
?:
boolean
;
preserveFocus
?:
boolean
;
}
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录