Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
62037fb7
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,发现更多精彩内容 >>
提交
62037fb7
编写于
6月 20, 2019
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fire onDidChangeMaximumDimension when dimensions are set
Fixes #73496
上级
95fa2fe8
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
32 addition
and
6 deletion
+32
-6
src/vs/workbench/api/browser/mainThreadTerminalService.ts
src/vs/workbench/api/browser/mainThreadTerminalService.ts
+5
-0
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+1
-0
src/vs/workbench/api/node/extHostTerminalService.ts
src/vs/workbench/api/node/extHostTerminalService.ts
+5
-0
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
...vs/workbench/contrib/terminal/browser/terminalInstance.ts
+14
-3
src/vs/workbench/contrib/terminal/common/terminal.ts
src/vs/workbench/contrib/terminal/common/terminal.ts
+4
-3
src/vs/workbench/contrib/terminal/common/terminalService.ts
src/vs/workbench/contrib/terminal/common/terminalService.ts
+3
-0
未找到文件。
src/vs/workbench/api/browser/mainThreadTerminalService.ts
浏览文件 @
62037fb7
...
@@ -42,6 +42,7 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
...
@@ -42,6 +42,7 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
this
.
_toDispose
.
push
(
_terminalService
.
onInstanceDisposed
(
instance
=>
this
.
_onTerminalDisposed
(
instance
)));
this
.
_toDispose
.
push
(
_terminalService
.
onInstanceDisposed
(
instance
=>
this
.
_onTerminalDisposed
(
instance
)));
this
.
_toDispose
.
push
(
_terminalService
.
onInstanceProcessIdReady
(
instance
=>
this
.
_onTerminalProcessIdReady
(
instance
)));
this
.
_toDispose
.
push
(
_terminalService
.
onInstanceProcessIdReady
(
instance
=>
this
.
_onTerminalProcessIdReady
(
instance
)));
this
.
_toDispose
.
push
(
_terminalService
.
onInstanceDimensionsChanged
(
instance
=>
this
.
_onInstanceDimensionsChanged
(
instance
)));
this
.
_toDispose
.
push
(
_terminalService
.
onInstanceDimensionsChanged
(
instance
=>
this
.
_onInstanceDimensionsChanged
(
instance
)));
this
.
_toDispose
.
push
(
_terminalService
.
onInstanceMaximumDimensionsChanged
(
instance
=>
this
.
_onInstanceMaximumDimensionsChanged
(
instance
)));
this
.
_toDispose
.
push
(
_terminalService
.
onInstanceRequestExtHostProcess
(
request
=>
this
.
_onTerminalRequestExtHostProcess
(
request
)));
this
.
_toDispose
.
push
(
_terminalService
.
onInstanceRequestExtHostProcess
(
request
=>
this
.
_onTerminalRequestExtHostProcess
(
request
)));
this
.
_toDispose
.
push
(
_terminalService
.
onActiveInstanceChanged
(
instance
=>
this
.
_onActiveTerminalChanged
(
instance
?
instance
.
id
:
null
)));
this
.
_toDispose
.
push
(
_terminalService
.
onActiveInstanceChanged
(
instance
=>
this
.
_onActiveTerminalChanged
(
instance
?
instance
.
id
:
null
)));
this
.
_toDispose
.
push
(
_terminalService
.
onInstanceTitleChanged
(
instance
=>
this
.
_onTitleChanged
(
instance
.
id
,
instance
.
title
)));
this
.
_toDispose
.
push
(
_terminalService
.
onInstanceTitleChanged
(
instance
=>
this
.
_onTitleChanged
(
instance
.
id
,
instance
.
title
)));
...
@@ -226,6 +227,10 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
...
@@ -226,6 +227,10 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
this
.
_proxy
.
$acceptTerminalDimensions
(
instance
.
id
,
instance
.
cols
,
instance
.
rows
);
this
.
_proxy
.
$acceptTerminalDimensions
(
instance
.
id
,
instance
.
cols
,
instance
.
rows
);
}
}
private
_onInstanceMaximumDimensionsChanged
(
instance
:
ITerminalInstance
):
void
{
this
.
_proxy
.
$acceptTerminalMaximumDimensions
(
instance
.
id
,
instance
.
maxCols
,
instance
.
maxRows
);
}
private
_onTerminalRequestExtHostProcess
(
request
:
ITerminalProcessExtHostRequest
):
void
{
private
_onTerminalRequestExtHostProcess
(
request
:
ITerminalProcessExtHostRequest
):
void
{
// Only allow processes on remote ext hosts
// Only allow processes on remote ext hosts
if
(
!
this
.
_remoteAuthority
)
{
if
(
!
this
.
_remoteAuthority
)
{
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
62037fb7
...
@@ -1126,6 +1126,7 @@ export interface ExtHostTerminalServiceShape {
...
@@ -1126,6 +1126,7 @@ export interface ExtHostTerminalServiceShape {
$acceptTerminalRendererInput
(
id
:
number
,
data
:
string
):
void
;
$acceptTerminalRendererInput
(
id
:
number
,
data
:
string
):
void
;
$acceptTerminalTitleChange
(
id
:
number
,
name
:
string
):
void
;
$acceptTerminalTitleChange
(
id
:
number
,
name
:
string
):
void
;
$acceptTerminalDimensions
(
id
:
number
,
cols
:
number
,
rows
:
number
):
void
;
$acceptTerminalDimensions
(
id
:
number
,
cols
:
number
,
rows
:
number
):
void
;
$acceptTerminalMaximumDimensions
(
id
:
number
,
cols
:
number
,
rows
:
number
):
void
;
$createProcess
(
id
:
number
,
shellLaunchConfig
:
ShellLaunchConfigDto
,
activeWorkspaceRootUri
:
UriComponents
,
cols
:
number
,
rows
:
number
,
isWorkspaceShellAllowed
:
boolean
):
void
;
$createProcess
(
id
:
number
,
shellLaunchConfig
:
ShellLaunchConfigDto
,
activeWorkspaceRootUri
:
UriComponents
,
cols
:
number
,
rows
:
number
,
isWorkspaceShellAllowed
:
boolean
):
void
;
$acceptProcessInput
(
id
:
number
,
data
:
string
):
void
;
$acceptProcessInput
(
id
:
number
,
data
:
string
):
void
;
$acceptProcessResize
(
id
:
number
,
cols
:
number
,
rows
:
number
):
void
;
$acceptProcessResize
(
id
:
number
,
cols
:
number
,
rows
:
number
):
void
;
...
...
src/vs/workbench/api/node/extHostTerminalService.ts
浏览文件 @
62037fb7
...
@@ -409,6 +409,11 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
...
@@ -409,6 +409,11 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
});
});
}
}
}
}
});
}
public
$acceptTerminalMaximumDimensions
(
id
:
number
,
cols
:
number
,
rows
:
number
):
void
{
this
.
_getTerminalByIdEventually
(
id
).
then
(()
=>
{
// When a terminal's dimensions change, a renderer's _maximum_ dimensions change
// When a terminal's dimensions change, a renderer's _maximum_ dimensions change
const
renderer
=
this
.
_getTerminalRendererById
(
id
);
const
renderer
=
this
.
_getTerminalRendererById
(
id
);
if
(
renderer
)
{
if
(
renderer
)
{
...
...
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
浏览文件 @
62037fb7
...
@@ -201,6 +201,8 @@ export class TerminalInstance implements ITerminalInstance {
...
@@ -201,6 +201,8 @@ export class TerminalInstance implements ITerminalInstance {
}
}
return
this
.
_rows
;
return
this
.
_rows
;
}
}
public
get
maxCols
():
number
{
return
this
.
_cols
;
}
public
get
maxRows
():
number
{
return
this
.
_rows
;
}
// TODO: Ideally processId would be merged into processReady
// TODO: Ideally processId would be merged into processReady
public
get
processId
():
number
|
undefined
{
return
this
.
_processManager
?
this
.
_processManager
.
shellProcessId
:
undefined
;
}
public
get
processId
():
number
|
undefined
{
return
this
.
_processManager
?
this
.
_processManager
.
shellProcessId
:
undefined
;
}
// TODO: How does this work with detached processes?
// TODO: How does this work with detached processes?
...
@@ -232,6 +234,8 @@ export class TerminalInstance implements ITerminalInstance {
...
@@ -232,6 +234,8 @@ export class TerminalInstance implements ITerminalInstance {
public
get
onRequestExtHostProcess
():
Event
<
ITerminalInstance
>
{
return
this
.
_onRequestExtHostProcess
.
event
;
}
public
get
onRequestExtHostProcess
():
Event
<
ITerminalInstance
>
{
return
this
.
_onRequestExtHostProcess
.
event
;
}
private
readonly
_onDimensionsChanged
=
new
Emitter
<
void
>
();
private
readonly
_onDimensionsChanged
=
new
Emitter
<
void
>
();
public
get
onDimensionsChanged
():
Event
<
void
>
{
return
this
.
_onDimensionsChanged
.
event
;
}
public
get
onDimensionsChanged
():
Event
<
void
>
{
return
this
.
_onDimensionsChanged
.
event
;
}
private
readonly
_onMaximumDimensionsChanged
=
new
Emitter
<
void
>
();
public
get
onMaximumDimensionsChanged
():
Event
<
void
>
{
return
this
.
_onMaximumDimensionsChanged
.
event
;
}
private
readonly
_onFocus
=
new
Emitter
<
ITerminalInstance
>
();
private
readonly
_onFocus
=
new
Emitter
<
ITerminalInstance
>
();
public
get
onFocus
():
Event
<
ITerminalInstance
>
{
return
this
.
_onFocus
.
event
;
}
public
get
onFocus
():
Event
<
ITerminalInstance
>
{
return
this
.
_onFocus
.
event
;
}
...
@@ -349,12 +353,20 @@ export class TerminalInstance implements ITerminalInstance {
...
@@ -349,12 +353,20 @@ export class TerminalInstance implements ITerminalInstance {
}
else
{
}
else
{
scaledCharWidth
=
Math
.
floor
(
font
.
charWidth
*
window
.
devicePixelRatio
)
+
font
.
letterSpacing
;
scaledCharWidth
=
Math
.
floor
(
font
.
charWidth
*
window
.
devicePixelRatio
)
+
font
.
letterSpacing
;
}
}
this
.
_c
ols
=
Math
.
max
(
Math
.
floor
(
scaledWidthAvailable
/
scaledCharWidth
),
1
);
const
newC
ols
=
Math
.
max
(
Math
.
floor
(
scaledWidthAvailable
/
scaledCharWidth
),
1
);
const
scaledHeightAvailable
=
dimension
.
height
*
window
.
devicePixelRatio
;
const
scaledHeightAvailable
=
dimension
.
height
*
window
.
devicePixelRatio
;
const
scaledCharHeight
=
Math
.
ceil
(
font
.
charHeight
*
window
.
devicePixelRatio
);
const
scaledCharHeight
=
Math
.
ceil
(
font
.
charHeight
*
window
.
devicePixelRatio
);
const
scaledLineHeight
=
Math
.
floor
(
scaledCharHeight
*
font
.
lineHeight
);
const
scaledLineHeight
=
Math
.
floor
(
scaledCharHeight
*
font
.
lineHeight
);
this
.
_rows
=
Math
.
max
(
Math
.
floor
(
scaledHeightAvailable
/
scaledLineHeight
),
1
);
const
newRows
=
Math
.
max
(
Math
.
floor
(
scaledHeightAvailable
/
scaledLineHeight
),
1
);
if
(
this
.
_cols
!==
newCols
||
this
.
_rows
!==
newRows
)
{
this
.
_cols
=
newCols
;
this
.
_rows
=
newRows
;
if
(
this
.
shellLaunchConfig
.
isRendererOnly
)
{
this
.
_onMaximumDimensionsChanged
.
fire
();
}
}
return
dimension
.
width
;
return
dimension
.
width
;
}
}
...
@@ -1238,7 +1250,6 @@ export class TerminalInstance implements ITerminalInstance {
...
@@ -1238,7 +1250,6 @@ export class TerminalInstance implements ITerminalInstance {
return
;
return
;
}
}
const
terminalWidth
=
this
.
_evaluateColsAndRows
(
dimension
.
width
,
dimension
.
height
);
const
terminalWidth
=
this
.
_evaluateColsAndRows
(
dimension
.
width
,
dimension
.
height
);
if
(
!
terminalWidth
)
{
if
(
!
terminalWidth
)
{
return
;
return
;
...
...
src/vs/workbench/contrib/terminal/common/terminal.ts
浏览文件 @
62037fb7
...
@@ -221,6 +221,7 @@ export interface ITerminalService {
...
@@ -221,6 +221,7 @@ export interface ITerminalService {
onInstanceDisposed
:
Event
<
ITerminalInstance
>
;
onInstanceDisposed
:
Event
<
ITerminalInstance
>
;
onInstanceProcessIdReady
:
Event
<
ITerminalInstance
>
;
onInstanceProcessIdReady
:
Event
<
ITerminalInstance
>
;
onInstanceDimensionsChanged
:
Event
<
ITerminalInstance
>
;
onInstanceDimensionsChanged
:
Event
<
ITerminalInstance
>
;
onInstanceMaximumDimensionsChanged
:
Event
<
ITerminalInstance
>
;
onInstanceRequestExtHostProcess
:
Event
<
ITerminalProcessExtHostRequest
>
;
onInstanceRequestExtHostProcess
:
Event
<
ITerminalProcessExtHostRequest
>
;
onInstancesChanged
:
Event
<
void
>
;
onInstancesChanged
:
Event
<
void
>
;
onInstanceTitleChanged
:
Event
<
ITerminalInstance
>
;
onInstanceTitleChanged
:
Event
<
ITerminalInstance
>
;
...
@@ -377,6 +378,8 @@ export interface ITerminalInstance {
...
@@ -377,6 +378,8 @@ export interface ITerminalInstance {
readonly
cols
:
number
;
readonly
cols
:
number
;
readonly
rows
:
number
;
readonly
rows
:
number
;
readonly
maxCols
:
number
;
readonly
maxRows
:
number
;
/**
/**
* The process ID of the shell process, this is undefined when there is no process associated
* The process ID of the shell process, this is undefined when there is no process associated
...
@@ -395,12 +398,10 @@ export interface ITerminalInstance {
...
@@ -395,12 +398,10 @@ export interface ITerminalInstance {
onDisposed
:
Event
<
ITerminalInstance
>
;
onDisposed
:
Event
<
ITerminalInstance
>
;
onFocused
:
Event
<
ITerminalInstance
>
;
onFocused
:
Event
<
ITerminalInstance
>
;
onProcessIdReady
:
Event
<
ITerminalInstance
>
;
onProcessIdReady
:
Event
<
ITerminalInstance
>
;
onRequestExtHostProcess
:
Event
<
ITerminalInstance
>
;
onRequestExtHostProcess
:
Event
<
ITerminalInstance
>
;
onDimensionsChanged
:
Event
<
void
>
;
onDimensionsChanged
:
Event
<
void
>
;
onMaximumDimensionsChanged
:
Event
<
void
>
;
onFocus
:
Event
<
ITerminalInstance
>
;
onFocus
:
Event
<
ITerminalInstance
>
;
...
...
src/vs/workbench/contrib/terminal/common/terminalService.ts
浏览文件 @
62037fb7
...
@@ -57,6 +57,8 @@ export abstract class TerminalService implements ITerminalService {
...
@@ -57,6 +57,8 @@ export abstract class TerminalService implements ITerminalService {
public
get
onInstanceRequestExtHostProcess
():
Event
<
ITerminalProcessExtHostRequest
>
{
return
this
.
_onInstanceRequestExtHostProcess
.
event
;
}
public
get
onInstanceRequestExtHostProcess
():
Event
<
ITerminalProcessExtHostRequest
>
{
return
this
.
_onInstanceRequestExtHostProcess
.
event
;
}
protected
readonly
_onInstanceDimensionsChanged
=
new
Emitter
<
ITerminalInstance
>
();
protected
readonly
_onInstanceDimensionsChanged
=
new
Emitter
<
ITerminalInstance
>
();
public
get
onInstanceDimensionsChanged
():
Event
<
ITerminalInstance
>
{
return
this
.
_onInstanceDimensionsChanged
.
event
;
}
public
get
onInstanceDimensionsChanged
():
Event
<
ITerminalInstance
>
{
return
this
.
_onInstanceDimensionsChanged
.
event
;
}
protected
readonly
_onInstanceMaximumDimensionsChanged
=
new
Emitter
<
ITerminalInstance
>
();
public
get
onInstanceMaximumDimensionsChanged
():
Event
<
ITerminalInstance
>
{
return
this
.
_onInstanceMaximumDimensionsChanged
.
event
;
}
protected
readonly
_onInstancesChanged
=
new
Emitter
<
void
>
();
protected
readonly
_onInstancesChanged
=
new
Emitter
<
void
>
();
public
get
onInstancesChanged
():
Event
<
void
>
{
return
this
.
_onInstancesChanged
.
event
;
}
public
get
onInstancesChanged
():
Event
<
void
>
{
return
this
.
_onInstancesChanged
.
event
;
}
protected
readonly
_onInstanceTitleChanged
=
new
Emitter
<
ITerminalInstance
>
();
protected
readonly
_onInstanceTitleChanged
=
new
Emitter
<
ITerminalInstance
>
();
...
@@ -384,6 +386,7 @@ export abstract class TerminalService implements ITerminalService {
...
@@ -384,6 +386,7 @@ export abstract class TerminalService implements ITerminalService {
instance
.
addDisposable
(
instance
.
onTitleChanged
(
this
.
_onInstanceTitleChanged
.
fire
,
this
.
_onInstanceTitleChanged
));
instance
.
addDisposable
(
instance
.
onTitleChanged
(
this
.
_onInstanceTitleChanged
.
fire
,
this
.
_onInstanceTitleChanged
));
instance
.
addDisposable
(
instance
.
onProcessIdReady
(
this
.
_onInstanceProcessIdReady
.
fire
,
this
.
_onInstanceProcessIdReady
));
instance
.
addDisposable
(
instance
.
onProcessIdReady
(
this
.
_onInstanceProcessIdReady
.
fire
,
this
.
_onInstanceProcessIdReady
));
instance
.
addDisposable
(
instance
.
onDimensionsChanged
(()
=>
this
.
_onInstanceDimensionsChanged
.
fire
(
instance
)));
instance
.
addDisposable
(
instance
.
onDimensionsChanged
(()
=>
this
.
_onInstanceDimensionsChanged
.
fire
(
instance
)));
instance
.
addDisposable
(
instance
.
onMaximumDimensionsChanged
(()
=>
this
.
_onInstanceMaximumDimensionsChanged
.
fire
(
instance
)));
instance
.
addDisposable
(
instance
.
onFocus
(
this
.
_onActiveInstanceChanged
.
fire
,
this
.
_onActiveInstanceChanged
));
instance
.
addDisposable
(
instance
.
onFocus
(
this
.
_onActiveInstanceChanged
.
fire
,
this
.
_onActiveInstanceChanged
));
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录