Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
39c4261b
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,发现更多精彩内容 >>
提交
39c4261b
编写于
5月 10, 2021
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clean up
上级
1d1b902c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
44 deletion
+16
-44
src/vs/workbench/contrib/terminal/browser/terminalGroup.ts
src/vs/workbench/contrib/terminal/browser/terminalGroup.ts
+0
-3
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
...vs/workbench/contrib/terminal/browser/terminalInstance.ts
+16
-41
未找到文件。
src/vs/workbench/contrib/terminal/browser/terminalGroup.ts
浏览文件 @
39c4261b
...
...
@@ -148,7 +148,6 @@ class SplitPaneContainer extends Disposable {
layout
(
width
:
number
,
height
:
number
):
void
{
this
.
_width
=
width
;
this
.
_height
=
height
;
console
.
log
(
'
SplitPaneContainer.layout
'
,
width
,
height
);
if
(
this
.
orientation
===
Orientation
.
HORIZONTAL
)
{
this
.
_children
.
forEach
(
c
=>
c
.
orthogonalLayout
(
height
));
this
.
_splitView
.
layout
(
width
);
...
...
@@ -211,7 +210,6 @@ class SplitPane implements IView {
}
layout
(
size
:
number
):
void
{
console
.
log
(
`SplitPane.layout (
${
this
.
instance
.
instanceId
}
)`
,
size
,
this
.
orthogonalSize
);
// Only layout when both sizes are known
if
(
!
size
||
!
this
.
orthogonalSize
)
{
return
;
...
...
@@ -436,7 +434,6 @@ export class TerminalGroup extends Disposable implements ITerminalGroup {
if
(
this
.
_groupElement
)
{
this
.
_groupElement
.
style
.
display
=
visible
?
''
:
'
none
'
;
}
console
.
log
(
'
TerminalGroup.setVisible
'
);
this
.
terminalInstances
.
forEach
(
i
=>
i
.
setVisible
(
visible
));
}
...
...
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
浏览文件 @
39c4261b
...
...
@@ -132,6 +132,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
private
_navigationModeAddon
:
INavigationMode
&
ITerminalAddon
|
undefined
;
private
_timeoutDimension
:
dom
.
Dimension
|
undefined
;
private
_lastLayoutDimensions
:
dom
.
Dimension
|
undefined
;
private
_hasHadInput
:
boolean
;
...
...
@@ -346,8 +347,6 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
}
private
_initDimensions
():
void
{
console
.
log
(
'
initDimensions, container?
'
,
this
.
_container
);
// The terminal panel needs to have been created
if
(
!
this
.
_container
)
{
return
;
...
...
@@ -369,21 +368,18 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
// Ignore if dimensions are undefined or 0
if
(
!
width
||
!
height
)
{
this
.
_setLastKnownColsAndRows
();
console
.
log
(
'
1
'
);
return
null
;
}
const
dimension
=
this
.
_getDimension
(
width
,
height
);
if
(
!
dimension
)
{
this
.
_setLastKnownColsAndRows
();
console
.
log
(
'
2
'
);
return
null
;
}
const
font
=
this
.
_configHelper
.
getFont
(
this
.
_xtermCore
);
if
(
!
font
.
charWidth
||
!
font
.
charHeight
)
{
this
.
_setLastKnownColsAndRows
();
console
.
log
(
'
3
'
);
return
null
;
}
...
...
@@ -402,7 +398,6 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
const
newRows
=
Math
.
max
(
Math
.
floor
(
scaledHeightAvailable
/
scaledLineHeight
),
1
);
if
(
this
.
_cols
!==
newCols
||
this
.
_rows
!==
newRows
)
{
console
.
log
(
'
newRows
'
,
newRows
);
this
.
_cols
=
newCols
;
this
.
_rows
=
newRows
;
this
.
_fireMaximumDimensionsChanged
();
...
...
@@ -427,18 +422,10 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
// The font needs to have been initialized
const
font
=
this
.
_configHelper
.
getFont
(
this
.
_xtermCore
);
if
(
!
font
||
!
font
.
charWidth
||
!
font
.
charHeight
)
{
console
.
log
(
'
a
'
);
return
undefined
;
}
// The panel is minimized
// if (!this._isVisible) {
// console.log('b');
// return TerminalInstance._lastKnownCanvasDimensions;
// }
if
(
!
this
.
_wrapperElement
)
{
console
.
log
(
'
c
'
);
return
undefined
;
}
...
...
@@ -488,8 +475,9 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
xtermRendererType
=
config
.
gpuAcceleration
===
'
on
'
?
'
canvas
'
:
'
dom
'
;
}
console
.
log
(
'
create 80x30 terminal
'
,
this
.
_cols
,
this
.
_rows
);
const
xterm
=
new
Terminal
({
cols
:
this
.
_cols
||
undefined
,
rows
:
this
.
_rows
||
undefined
,
altClickMovesCursor
:
config
.
altClickMovesCursor
&&
editorOptions
.
multiCursorModifier
===
'
alt
'
,
scrollback
:
config
.
scrollback
,
theme
:
this
.
_getXtermTheme
(),
...
...
@@ -593,7 +581,6 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
}
attachToElement
(
container
:
HTMLElement
):
Promise
<
void
>
|
void
{
console
.
log
(
'
external attachToElement
'
);
// The container did not change, do nothing
if
(
this
.
_container
===
container
)
{
return
;
...
...
@@ -611,8 +598,6 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
}
private
async
_attachToElement
(
container
:
HTMLElement
):
Promise
<
void
>
{
console
.
log
(
'
_attachToElement
'
,
container
);
if
(
this
.
_wrapperElement
)
{
throw
new
Error
(
'
The terminal instance has already been attached to a container
'
);
}
...
...
@@ -765,10 +750,12 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
this
.
_processManager
.
onProcessReady
(()
=>
this
.
_linkManager
?.
setWidgetManager
(
this
.
_widgetManager
));
// const computedStyle = window.getComputedStyle(this._container);
const
computedStyle
=
window
.
getComputedStyle
(
this
.
_container
.
parentElement
!
);
const
width
=
parseInt
(
computedStyle
.
getPropertyValue
(
'
width
'
).
replace
(
'
px
'
,
''
),
10
);
const
height
=
parseInt
(
computedStyle
.
getPropertyValue
(
'
height
'
).
replace
(
'
px
'
,
''
),
10
);
this
.
layout
(
new
dom
.
Dimension
(
width
,
height
));
// const computedStyle = window.getComputedStyle(this._container.parentElement!);
// const width = parseInt(computedStyle.getPropertyValue('width').replace('px', ''), 10);
// const height = parseInt(computedStyle.getPropertyValue('height').replace('px', ''), 10);
if
(
this
.
_lastLayoutDimensions
)
{
this
.
layout
(
this
.
_lastLayoutDimensions
);
}
this
.
setVisible
(
this
.
_isVisible
);
this
.
updateConfig
();
...
...
@@ -986,7 +973,6 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
}
setVisible
(
visible
:
boolean
):
void
{
console
.
log
(
'
setVisible
'
,
visible
);
this
.
_isVisible
=
visible
;
if
(
this
.
_wrapperElement
)
{
this
.
_wrapperElement
.
classList
.
toggle
(
'
active
'
,
visible
);
...
...
@@ -999,21 +985,6 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
// This can likely be removed after https://github.com/xtermjs/xterm.js/issues/291 is
// fixed upstream.
this
.
_xtermCore
.
_onScroll
.
fire
(
this
.
_xterm
.
buffer
.
active
.
viewportY
);
if
(
this
.
_container
&&
this
.
_container
.
parentElement
)
{
// Force a layout when the instance becomes visible. This is particularly important
// for ensuring that terminals that are created in the background by an extension will
// correctly get correct character measurements in order to render to the screen (see
// #34554).
// const computedStyle = window.getComputedStyle(this._container.parentElement);
// const width = parseInt(computedStyle.getPropertyValue('width').replace('px', ''), 10);
// const height = parseInt(computedStyle.getPropertyValue('height').replace('px', ''), 10);
// this.layout(new dom.Dimension(width, height));
// HACK: Trigger another async layout to ensure xterm's CharMeasure is ready to use,
// this hack can be removed when https://github.com/xtermjs/xterm.js/issues/702 is
// supported.
// this._timeoutDimension = new dom.Dimension(width, height);
// setTimeout(() => this.layout(this._timeoutDimension!), 0);
}
}
}
...
...
@@ -1504,12 +1475,17 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
}
layout
(
dimension
:
dom
.
Dimension
):
void
{
this
.
_lastLayoutDimensions
=
dimension
;
if
(
this
.
disableLayout
)
{
console
.
log
(
'
disableLayout
'
);
return
;
}
console
.
log
(
'
layout
'
,
dimension
);
// Don't layout if dimensions are invalid (eg. the container is not attached to the DOM or
// if display: none
if
(
dimension
.
width
<=
0
||
dimension
.
height
<=
0
)
{
return
;
}
const
terminalWidth
=
this
.
_evaluateColsAndRows
(
dimension
.
width
,
dimension
.
height
);
if
(
!
terminalWidth
)
{
return
;
...
...
@@ -1565,7 +1541,6 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
this
.
_onDimensionsChanged
.
fire
();
}
console
.
log
(
'
resize now
'
,
cols
,
rows
);
this
.
_xterm
.
resize
(
cols
,
rows
);
TerminalInstance
.
_lastKnownGridDimensions
=
{
cols
,
rows
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录