Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c68ad4f5
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,发现更多精彩内容 >>
提交
c68ad4f5
编写于
5月 10, 2019
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use new event api
上级
488e986f
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
18 addition
and
18 deletion
+18
-18
src/vs/workbench/contrib/terminal/browser/terminalCommandTracker.ts
...kbench/contrib/terminal/browser/terminalCommandTracker.ts
+1
-1
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
...vs/workbench/contrib/terminal/browser/terminalInstance.ts
+7
-7
src/vs/workbench/contrib/terminal/node/windowsShellHelper.ts
src/vs/workbench/contrib/terminal/node/windowsShellHelper.ts
+3
-3
src/vs/workbench/contrib/terminal/test/electron-browser/terminalCommandTracker.test.ts
...inal/test/electron-browser/terminalCommandTracker.test.ts
+7
-7
未找到文件。
src/vs/workbench/contrib/terminal/browser/terminalCommandTracker.ts
浏览文件 @
c68ad4f5
...
...
@@ -30,7 +30,7 @@ export class TerminalCommandTracker implements ITerminalCommandTracker, IDisposa
constructor
(
private
_xterm
:
Terminal
)
{
this
.
_xterm
.
on
(
'
key
'
,
key
=>
this
.
_onKey
(
key
));
this
.
_xterm
.
on
Key
(
e
=>
this
.
_onKey
(
e
.
key
));
}
public
dispose
():
void
{
...
...
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
浏览文件 @
c68ad4f5
...
...
@@ -371,7 +371,7 @@ export class TerminalInstance implements ITerminalInstance {
// it gets removed and then added back to the DOM (resetting scrollTop to 0).
// Upstream issue: https://github.com/sourcelair/xterm.js/issues/291
if
(
this
.
_xterm
)
{
this
.
_xterm
.
emit
(
'
scroll
'
,
this
.
_xterm
.
_core
.
buffer
.
ydisp
);
this
.
_xterm
.
_core
.
_onScroll
.
fire
(
this
.
_xterm
.
_core
.
buffer
.
ydisp
);
}
}
...
...
@@ -421,12 +421,12 @@ export class TerminalInstance implements ITerminalInstance {
if
(
this
.
_shellLaunchConfig
.
initialText
)
{
this
.
_xterm
.
writeln
(
this
.
_shellLaunchConfig
.
initialText
);
}
this
.
_xterm
.
on
(
'
linefeed
'
,
()
=>
this
.
_onLineFeed
());
this
.
_xterm
.
on
(
'
key
'
,
(
key
,
ev
)
=>
this
.
_onKey
(
key
,
ev
));
this
.
_xterm
.
on
LineFeed
(
()
=>
this
.
_onLineFeed
());
this
.
_xterm
.
on
Key
(
e
=>
this
.
_onKey
(
e
.
key
,
e
.
domEvent
));
if
(
this
.
_processManager
)
{
this
.
_processManager
.
onProcessData
(
data
=>
this
.
_onProcessData
(
data
));
this
.
_xterm
.
on
(
'
data
'
,
data
=>
this
.
_processManager
!
.
write
(
data
));
this
.
_xterm
.
on
Data
(
data
=>
this
.
_processManager
!
.
write
(
data
));
// TODO: How does the cwd work on detached processes?
this
.
processReady
.
then
(
async
()
=>
{
this
.
_linkHandler
.
processCwd
=
await
this
.
_processManager
!
.
getInitialCwd
();
...
...
@@ -445,11 +445,11 @@ export class TerminalInstance implements ITerminalInstance {
}
else
if
(
this
.
shellLaunchConfig
.
isRendererOnly
)
{
this
.
_linkHandler
=
this
.
_instantiationService
.
createInstance
(
TerminalLinkHandler
,
this
.
_xterm
,
undefined
,
undefined
);
}
this
.
_xterm
.
on
(
'
focus
'
,
()
=>
this
.
_onFocus
.
fire
(
this
));
this
.
_xterm
.
textarea
.
addEventListener
(
'
focus
'
,
()
=>
this
.
_onFocus
.
fire
(
this
));
// Register listener to trigger the onInput ext API if the terminal is a renderer only
if
(
this
.
_shellLaunchConfig
.
isRendererOnly
)
{
this
.
_xterm
.
on
(
'
data
'
,
(
data
)
=>
this
.
_sendRendererInput
(
data
));
this
.
_xterm
.
on
Data
(
data
=>
this
.
_sendRendererInput
(
data
));
}
this
.
_commandTracker
=
new
TerminalCommandTracker
(
this
.
_xterm
);
...
...
@@ -858,7 +858,7 @@ export class TerminalInstance implements ITerminalInstance {
// necessary if the number of rows in the terminal has decreased while it was in the
// background since scrollTop changes take no effect but the terminal's position does
// change since the number of visible rows decreases.
this
.
_xterm
.
emit
(
'
scroll
'
,
this
.
_xterm
.
_core
.
buffer
.
ydisp
);
this
.
_xterm
.
_core
.
_onScroll
.
fire
(
this
.
_xterm
.
_core
.
buffer
.
ydisp
);
if
(
this
.
_container
&&
this
.
_container
.
parentElement
)
{
// Force a layout when the instance becomes invisible. This is particularly important
// for ensuring that terminals that are created in the background by an extension will
...
...
src/vs/workbench/contrib/terminal/node/windowsShellHelper.ts
浏览文件 @
c68ad4f5
...
...
@@ -61,15 +61,15 @@ export class WindowsShellHelper implements IWindowsShellHelper {
// If this is done on every linefeed, parsing ends up taking
// significantly longer due to resetting timers. Note that this is
// private API.
this
.
_xterm
.
on
(
'
linefeed
'
,
()
=>
this
.
_newLineFeed
=
true
);
this
.
_xterm
.
on
(
'
cursormove
'
,
()
=>
{
this
.
_xterm
.
on
LineFeed
(
()
=>
this
.
_newLineFeed
=
true
);
this
.
_xterm
.
on
CursorMove
(
()
=>
{
if
(
this
.
_newLineFeed
)
{
this
.
_onCheckShell
.
fire
(
undefined
);
}
});
// Fire a new check for the shell when any key is pressed.
this
.
_xterm
.
on
(
'
keypress
'
,
()
=>
this
.
_onCheckShell
.
fire
(
undefined
));
this
.
_xterm
.
on
Key
(
()
=>
this
.
_onCheckShell
.
fire
(
undefined
));
});
}
...
...
src/vs/workbench/contrib/terminal/test/electron-browser/terminalCommandTracker.test.ts
浏览文件 @
c68ad4f5
...
...
@@ -46,13 +46,13 @@ suite('Workbench - TerminalCommandTracker', () => {
test
(
'
should track commands when the prompt is of sufficient size
'
,
()
=>
{
assert
.
equal
(
xterm
.
markers
.
length
,
0
);
syncWrite
(
xterm
,
'
\
x1b[3G
'
);
// Move cursor to column 3
xterm
.
emit
(
'
key
'
,
'
\
x0d
'
);
xterm
.
_core
.
_onKey
.
fire
({
key
:
'
\
x0d
'
}
);
assert
.
equal
(
xterm
.
markers
.
length
,
1
);
});
test
(
'
should not track commands when the prompt is too small
'
,
()
=>
{
assert
.
equal
(
xterm
.
markers
.
length
,
0
);
syncWrite
(
xterm
,
'
\
x1b[2G
'
);
// Move cursor to column 2
xterm
.
emit
(
'
key
'
,
'
\
x0d
'
);
xterm
.
_core
.
_onKey
.
fire
({
key
:
'
\
x0d
'
}
);
assert
.
equal
(
xterm
.
markers
.
length
,
0
);
});
});
...
...
@@ -60,7 +60,7 @@ suite('Workbench - TerminalCommandTracker', () => {
suite
(
'
Commands
'
,
()
=>
{
test
(
'
should scroll to the next and previous commands
'
,
()
=>
{
syncWrite
(
xterm
,
'
\
x1b[3G
'
);
// Move cursor to column 3
xterm
.
emit
(
'
key
'
,
'
\
x0d
'
);
// Mark line #10
xterm
.
_core
.
_onKey
.
fire
({
key
:
'
\
x0d
'
}
);
// Mark line #10
assert
.
equal
(
xterm
.
markers
[
0
].
line
,
9
);
for
(
let
i
=
0
;
i
<
20
;
i
++
)
{
...
...
@@ -94,11 +94,11 @@ suite('Workbench - TerminalCommandTracker', () => {
syncWrite
(
xterm
,
'
\r
0
'
);
syncWrite
(
xterm
,
'
\n\r
1
'
);
syncWrite
(
xterm
,
'
\
x1b[3G
'
);
// Move cursor to column 3
xterm
.
emit
(
'
key
'
,
'
\
x0d
'
);
// Mark line
xterm
.
_core
.
_onKey
.
fire
({
key
:
'
\
x0d
'
}
);
// Mark line
assert
.
equal
(
xterm
.
markers
[
0
].
line
,
10
);
syncWrite
(
xterm
,
'
\n\r
2
'
);
syncWrite
(
xterm
,
'
\
x1b[3G
'
);
// Move cursor to column 3
xterm
.
emit
(
'
key
'
,
'
\
x0d
'
);
// Mark line
xterm
.
_core
.
_onKey
.
fire
({
key
:
'
\
x0d
'
}
);
// Mark line
assert
.
equal
(
xterm
.
markers
[
1
].
line
,
11
);
syncWrite
(
xterm
,
'
\n\r
3
'
);
...
...
@@ -124,11 +124,11 @@ suite('Workbench - TerminalCommandTracker', () => {
syncWrite
(
xterm
,
'
\r
0
'
);
syncWrite
(
xterm
,
'
\n\r
1
'
);
syncWrite
(
xterm
,
'
\
x1b[3G
'
);
// Move cursor to column 3
xterm
.
emit
(
'
key
'
,
'
\
x0d
'
);
// Mark line
xterm
.
_core
.
_onKey
.
fire
({
key
:
'
\
x0d
'
}
);
// Mark line
assert
.
equal
(
xterm
.
markers
[
0
].
line
,
10
);
syncWrite
(
xterm
,
'
\n\r
2
'
);
syncWrite
(
xterm
,
'
\
x1b[3G
'
);
// Move cursor to column 3
xterm
.
emit
(
'
key
'
,
'
\
x0d
'
);
// Mark line
xterm
.
_core
.
_onKey
.
fire
({
key
:
'
\
x0d
'
}
);
// Mark line
assert
.
equal
(
xterm
.
markers
[
1
].
line
,
11
);
syncWrite
(
xterm
,
'
\n\r
3
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录