Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f68737bd
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,发现更多精彩内容 >>
提交
f68737bd
编写于
10月 23, 2019
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use optional chaining in terminalInstance
上级
00cd1a88
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
19 addition
and
55 deletion
+19
-55
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
...vs/workbench/contrib/terminal/browser/terminalInstance.ts
+19
-55
未找到文件。
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
浏览文件 @
f68737bd
...
...
@@ -524,9 +524,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
throw
new
Error
(
'
The terminal instance has not been attached to a container yet
'
);
}
if
(
this
.
_wrapperElement
.
parentNode
)
{
this
.
_wrapperElement
.
parentNode
.
removeChild
(
this
.
_wrapperElement
);
}
this
.
_wrapperElement
.
parentNode
?.
removeChild
(
this
.
_wrapperElement
);
this
.
_container
=
container
;
this
.
_container
.
appendChild
(
this
.
_wrapperElement
);
}
...
...
@@ -544,9 +542,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
}
// The container changed, reattach
if
(
this
.
_container
)
{
this
.
_container
.
removeChild
(
this
.
_wrapperElement
);
}
this
.
_container
?.
removeChild
(
this
.
_wrapperElement
);
this
.
_container
=
container
;
this
.
_container
.
appendChild
(
this
.
_wrapperElement
);
}
...
...
@@ -652,11 +648,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
const
widgetManager
=
new
TerminalWidgetManager
(
this
.
_wrapperElement
);
this
.
_widgetManager
=
widgetManager
;
this
.
_processManager
.
onProcessReady
(()
=>
{
if
(
this
.
_linkHandler
)
{
this
.
_linkHandler
.
setWidgetManager
(
widgetManager
);
}
});
this
.
_processManager
.
onProcessReady
(()
=>
this
.
_linkHandler
?.
setWidgetManager
(
widgetManager
));
const
computedStyle
=
window
.
getComputedStyle
(
this
.
_container
);
const
width
=
parseInt
(
computedStyle
.
getPropertyValue
(
'
width
'
).
replace
(
'
px
'
,
''
),
10
);
...
...
@@ -751,19 +743,13 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
}
public
clearSelection
():
void
{
if
(
!
this
.
_xterm
)
{
return
;
}
this
.
_xterm
.
clearSelection
();
this
.
_xterm
?.
clearSelection
();
}
public
selectAll
():
void
{
if
(
!
this
.
_xterm
)
{
return
;
}
// Focus here to ensure the terminal context key is set
this
.
_xterm
.
focus
();
this
.
_xterm
.
selectAll
();
this
.
_xterm
?
.
focus
();
this
.
_xterm
?
.
selectAll
();
}
public
findNext
(
term
:
string
,
searchOptions
:
ISearchOptions
):
boolean
{
...
...
@@ -924,45 +910,31 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
}
public
scrollDownLine
():
void
{
if
(
this
.
_xterm
)
{
this
.
_xterm
.
scrollLines
(
1
);
}
this
.
_xterm
?.
scrollLines
(
1
);
}
public
scrollDownPage
():
void
{
if
(
this
.
_xterm
)
{
this
.
_xterm
.
scrollPages
(
1
);
}
this
.
_xterm
?.
scrollPages
(
1
);
}
public
scrollToBottom
():
void
{
if
(
this
.
_xterm
)
{
this
.
_xterm
.
scrollToBottom
();
}
this
.
_xterm
?.
scrollToBottom
();
}
public
scrollUpLine
():
void
{
if
(
this
.
_xterm
)
{
this
.
_xterm
.
scrollLines
(
-
1
);
}
this
.
_xterm
?.
scrollLines
(
-
1
);
}
public
scrollUpPage
():
void
{
if
(
this
.
_xterm
)
{
this
.
_xterm
.
scrollPages
(
-
1
);
}
this
.
_xterm
?.
scrollPages
(
-
1
);
}
public
scrollToTop
():
void
{
if
(
this
.
_xterm
)
{
this
.
_xterm
.
scrollToTop
();
}
this
.
_xterm
?.
scrollToTop
();
}
public
clear
():
void
{
if
(
this
.
_xterm
)
{
this
.
_xterm
.
clear
();
}
this
.
_xterm
?.
clear
();
}
private
_refreshSelectionContextKey
()
{
...
...
@@ -1019,12 +991,8 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
}
private
_onProcessData
(
data
:
string
):
void
{
if
(
this
.
_widgetManager
)
{
this
.
_widgetManager
.
closeMessage
();
}
if
(
this
.
_xterm
)
{
this
.
_xterm
.
write
(
data
);
}
this
.
_widgetManager
?.
closeMessage
();
this
.
_xterm
?.
write
(
data
);
}
/**
...
...
@@ -1130,10 +1098,8 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
public
reuseTerminal
(
shell
:
IShellLaunchConfig
):
void
{
// Unsubscribe any key listener we may have.
if
(
this
.
_pressAnyKeyToCloseListener
)
{
this
.
_pressAnyKeyToCloseListener
.
dispose
();
this
.
_pressAnyKeyToCloseListener
=
undefined
;
}
this
.
_pressAnyKeyToCloseListener
?.
dispose
();
this
.
_pressAnyKeyToCloseListener
=
undefined
;
// Kill and clear up the process, making the process manager ready for a new process
this
.
_processManager
.
dispose
();
...
...
@@ -1256,10 +1222,8 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
this
.
_navigationModeAddon
=
new
NavigationModeAddon
(
this
.
_terminalA11yTreeFocusContextKey
);
this
.
_xterm
!
.
loadAddon
(
this
.
_navigationModeAddon
);
}
else
{
if
(
this
.
_navigationModeAddon
)
{
this
.
_navigationModeAddon
.
dispose
();
this
.
_navigationModeAddon
=
undefined
;
}
this
.
_navigationModeAddon
?.
dispose
();
this
.
_navigationModeAddon
=
undefined
;
}
this
.
_xterm
!
.
setOption
(
'
screenReaderMode
'
,
isEnabled
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录