Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
59c991e3
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,发现更多精彩内容 >>
提交
59c991e3
编写于
9月 30, 2020
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix #107675
上级
db674322
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
32 addition
and
19 deletion
+32
-19
src/vs/workbench/browser/parts/editor/tabsTitleControl.ts
src/vs/workbench/browser/parts/editor/tabsTitleControl.ts
+32
-19
未找到文件。
src/vs/workbench/browser/parts/editor/tabsTitleControl.ts
浏览文件 @
59c991e3
...
...
@@ -442,7 +442,7 @@ export class TabsTitleControl extends TitleControl {
}
pinEditor
(
editor
:
IEditorInput
):
void
{
this
.
withTab
(
editor
,
(
editor
,
index
,
tabContainer
,
tabLabelWidget
,
tabLabel
)
=>
this
.
redrawLabel
(
editor
,
index
,
tabContainer
,
tabLabelWidget
,
tabLabel
));
this
.
withTab
(
editor
,
(
editor
,
index
,
tabContainer
,
tabLabelWidget
,
tabLabel
)
=>
this
.
redraw
Tab
Label
(
editor
,
index
,
tabContainer
,
tabLabelWidget
,
tabLabel
));
}
stickEditor
(
editor
:
IEditorInput
):
void
{
...
...
@@ -458,15 +458,21 @@ export class TabsTitleControl extends TitleControl {
// Update tab
this
.
withTab
(
editor
,
(
editor
,
index
,
tabContainer
,
tabLabelWidget
,
tabLabel
,
tabActionBar
)
=>
this
.
redrawTab
(
editor
,
index
,
tabContainer
,
tabLabelWidget
,
tabLabel
,
tabActionBar
));
// Sticky change has an impact on each tab's border because
// it potentially moves the border to the last pinned tab
this
.
forEachTab
((
editor
,
index
,
tabContainer
,
tabLabelWidget
,
tabLabel
)
=>
{
this
.
redrawTabBorders
(
index
,
tabContainer
);
});
// A change to the sticky state requires a layout to keep the active editor visible
this
.
layout
(
this
.
dimension
);
}
setActive
(
isGroupActive
:
boolean
):
void
{
// Activity has an impact on each tab
// Activity has an impact on each tab
's active indication
this
.
forEachTab
((
editor
,
index
,
tabContainer
,
tabLabelWidget
,
tabLabel
)
=>
{
this
.
redraw
Editor
ActiveAndDirty
(
isGroupActive
,
editor
,
tabContainer
,
tabLabelWidget
);
this
.
redraw
Tab
ActiveAndDirty
(
isGroupActive
,
editor
,
tabContainer
,
tabLabelWidget
);
});
// Activity has an impact on the toolbar, so we need to update and layout
...
...
@@ -493,7 +499,7 @@ export class TabsTitleControl extends TitleControl {
// As such we need to redraw each label
this
.
forEachTab
((
editor
,
index
,
tabContainer
,
tabLabelWidget
,
tabLabel
)
=>
{
this
.
redrawLabel
(
editor
,
index
,
tabContainer
,
tabLabelWidget
,
tabLabel
);
this
.
redraw
Tab
Label
(
editor
,
index
,
tabContainer
,
tabLabelWidget
,
tabLabel
);
});
// A change to a label requires a layout to keep the active editor visible
...
...
@@ -501,7 +507,7 @@ export class TabsTitleControl extends TitleControl {
}
updateEditorDirty
(
editor
:
IEditorInput
):
void
{
this
.
withTab
(
editor
,
(
editor
,
index
,
tabContainer
,
tabLabelWidget
)
=>
this
.
redraw
Editor
ActiveAndDirty
(
this
.
accessor
.
activeGroup
===
this
.
group
,
editor
,
tabContainer
,
tabLabelWidget
));
this
.
withTab
(
editor
,
(
editor
,
index
,
tabContainer
,
tabLabelWidget
)
=>
this
.
redraw
Tab
ActiveAndDirty
(
this
.
accessor
.
activeGroup
===
this
.
group
,
editor
,
tabContainer
,
tabLabelWidget
));
}
updateOptions
(
oldOptions
:
IEditorPartOptions
,
newOptions
:
IEditorPartOptions
):
void
{
...
...
@@ -1020,11 +1026,10 @@ export class TabsTitleControl extends TitleControl {
private
redrawTab
(
editor
:
IEditorInput
,
index
:
number
,
tabContainer
:
HTMLElement
,
tabLabelWidget
:
IResourceLabel
,
tabLabel
:
IEditorInputLabel
,
tabActionBar
:
ActionBar
):
void
{
const
isTabSticky
=
this
.
group
.
isSticky
(
index
);
const
isTabLastSticky
=
isTabSticky
&&
this
.
group
.
stickyCount
===
index
+
1
;
const
options
=
this
.
accessor
.
partOptions
;
// Label
this
.
redrawLabel
(
editor
,
index
,
tabContainer
,
tabLabelWidget
,
tabLabel
);
this
.
redraw
Tab
Label
(
editor
,
index
,
tabContainer
,
tabLabelWidget
,
tabLabel
);
// Action
const
tabAction
=
isTabSticky
?
this
.
unpinEditorAction
:
this
.
closeEditorAction
;
...
...
@@ -1035,11 +1040,6 @@ export class TabsTitleControl extends TitleControl {
tabActionBar
.
push
(
tabAction
,
{
icon
:
true
,
label
:
false
,
keybinding
:
this
.
getKeybindingLabel
(
tabAction
)
});
}
// Borders / Outline
const
borderRightColor
=
((
isTabLastSticky
?
this
.
getColor
(
TAB_LAST_PINNED_BORDER
)
:
undefined
)
||
this
.
getColor
(
TAB_BORDER
)
||
this
.
getColor
(
contrastBorder
));
tabContainer
.
style
.
borderRight
=
borderRightColor
?
`1px solid
${
borderRightColor
}
`
:
''
;
tabContainer
.
style
.
outlineColor
=
this
.
getColor
(
activeContrastBorder
)
||
''
;
// Settings
const
tabActionsVisibility
=
isTabSticky
&&
options
.
pinnedTabSizing
===
'
compact
'
?
'
off
'
/* treat sticky compact tabs as tabCloseButton: 'off' */
:
options
.
tabCloseButton
;
[
'
off
'
,
'
left
'
,
'
right
'
].
forEach
(
option
=>
{
...
...
@@ -1079,11 +1079,14 @@ export class TabsTitleControl extends TitleControl {
tabContainer
.
style
.
left
=
'
auto
'
;
}
// Borders / outline
this
.
redrawTabBorders
(
index
,
tabContainer
);
// Active / dirty state
this
.
redraw
Editor
ActiveAndDirty
(
this
.
accessor
.
activeGroup
===
this
.
group
,
editor
,
tabContainer
,
tabLabelWidget
);
this
.
redraw
Tab
ActiveAndDirty
(
this
.
accessor
.
activeGroup
===
this
.
group
,
editor
,
tabContainer
,
tabLabelWidget
);
}
private
redrawLabel
(
editor
:
IEditorInput
,
index
:
number
,
tabContainer
:
HTMLElement
,
tabLabelWidget
:
IResourceLabel
,
tabLabel
:
IEditorInputLabel
):
void
{
private
redraw
Tab
Label
(
editor
:
IEditorInput
,
index
:
number
,
tabContainer
:
HTMLElement
,
tabLabelWidget
:
IResourceLabel
,
tabLabel
:
IEditorInputLabel
):
void
{
const
options
=
this
.
accessor
.
partOptions
;
// Unless tabs are sticky compact, show the full label and description
...
...
@@ -1127,15 +1130,15 @@ export class TabsTitleControl extends TitleControl {
}
}
private
redraw
Editor
ActiveAndDirty
(
isGroupActive
:
boolean
,
editor
:
IEditorInput
,
tabContainer
:
HTMLElement
,
tabLabelWidget
:
IResourceLabel
):
void
{
private
redraw
Tab
ActiveAndDirty
(
isGroupActive
:
boolean
,
editor
:
IEditorInput
,
tabContainer
:
HTMLElement
,
tabLabelWidget
:
IResourceLabel
):
void
{
const
isTabActive
=
this
.
group
.
isActive
(
editor
);
const
hasModifiedBorderTop
=
this
.
doRedraw
Editor
Dirty
(
isGroupActive
,
isTabActive
,
editor
,
tabContainer
);
const
hasModifiedBorderTop
=
this
.
doRedraw
Tab
Dirty
(
isGroupActive
,
isTabActive
,
editor
,
tabContainer
);
this
.
doRedraw
Editor
Active
(
isGroupActive
,
!
hasModifiedBorderTop
,
editor
,
tabContainer
,
tabLabelWidget
);
this
.
doRedraw
Tab
Active
(
isGroupActive
,
!
hasModifiedBorderTop
,
editor
,
tabContainer
,
tabLabelWidget
);
}
private
doRedraw
Editor
Active
(
isGroupActive
:
boolean
,
allowBorderTop
:
boolean
,
editor
:
IEditorInput
,
tabContainer
:
HTMLElement
,
tabLabelWidget
:
IResourceLabel
):
void
{
private
doRedraw
Tab
Active
(
isGroupActive
:
boolean
,
allowBorderTop
:
boolean
,
editor
:
IEditorInput
,
tabContainer
:
HTMLElement
,
tabLabelWidget
:
IResourceLabel
):
void
{
// Tab is active
if
(
this
.
group
.
isActive
(
editor
))
{
...
...
@@ -1181,7 +1184,7 @@ export class TabsTitleControl extends TitleControl {
}
}
private
doRedraw
Editor
Dirty
(
isGroupActive
:
boolean
,
isTabActive
:
boolean
,
editor
:
IEditorInput
,
tabContainer
:
HTMLElement
):
boolean
{
private
doRedraw
Tab
Dirty
(
isGroupActive
:
boolean
,
isTabActive
:
boolean
,
editor
:
IEditorInput
,
tabContainer
:
HTMLElement
):
boolean
{
let
hasModifiedBorderColor
=
false
;
// Tab: dirty (unless saving)
...
...
@@ -1222,6 +1225,16 @@ export class TabsTitleControl extends TitleControl {
return
hasModifiedBorderColor
;
}
private
redrawTabBorders
(
index
:
number
,
tabContainer
:
HTMLElement
):
void
{
const
isTabSticky
=
this
.
group
.
isSticky
(
index
);
const
isTabLastSticky
=
isTabSticky
&&
this
.
group
.
stickyCount
===
index
+
1
;
// Borders / Outline
const
borderRightColor
=
((
isTabLastSticky
?
this
.
getColor
(
TAB_LAST_PINNED_BORDER
)
:
undefined
)
||
this
.
getColor
(
TAB_BORDER
)
||
this
.
getColor
(
contrastBorder
));
tabContainer
.
style
.
borderRight
=
borderRightColor
?
`1px solid
${
borderRightColor
}
`
:
''
;
tabContainer
.
style
.
outlineColor
=
this
.
getColor
(
activeContrastBorder
)
||
''
;
}
getDimensions
():
IEditorGroupTitleDimensions
{
let
height
=
TabsTitleControl
.
TAB_HEIGHT
;
if
(
this
.
breadcrumbsControl
&&
!
this
.
breadcrumbsControl
.
isHidden
())
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录