Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
52e29e90
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,发现更多精彩内容 >>
提交
52e29e90
编写于
6月 20, 2018
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update reaching into xterm.js internals to work after layering merge
上级
519b82b5
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
45 addition
and
37 deletion
+45
-37
src/typings/vscode-xterm.d.ts
src/typings/vscode-xterm.d.ts
+22
-14
src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts
...h/parts/terminal/electron-browser/terminalConfigHelper.ts
+3
-3
src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts
...bench/parts/terminal/electron-browser/terminalInstance.ts
+6
-6
src/vs/workbench/parts/terminal/node/terminalCommandTracker.ts
...s/workbench/parts/terminal/node/terminalCommandTracker.ts
+4
-4
src/vs/workbench/parts/terminal/test/node/terminalCommandTracker.test.ts
...h/parts/terminal/test/node/terminalCommandTracker.test.ts
+10
-10
未找到文件。
src/typings/vscode-xterm.d.ts
浏览文件 @
52e29e90
...
...
@@ -671,17 +671,29 @@ declare module 'vscode-xterm' {
// Modifications to official .d.ts below
declare
module
'
vscode-xterm
'
{
interface
Terminal
{
buffer
:
{
y
:
number
;
ybase
:
number
;
ydisp
:
number
;
x
:
number
;
};
_core
:
{
buffer
:
{
y
:
number
;
ybase
:
number
;
ydisp
:
number
;
x
:
number
;
};
/**
* Emit an event on the terminal.
*/
emit
(
type
:
string
,
data
:
any
):
void
;
charMeasure
?:
{
height
:
number
,
width
:
number
};
renderer
:
{
_renderLayers
:
any
[];
onIntersectionChange
:
any
;
}
}
/**
* Emit an event on the terminal.
*/
emit
(
type
:
string
,
data
:
any
):
void
;
webLinksInit
(
handler
?:
(
event
:
MouseEvent
,
uri
:
string
)
=>
void
,
options
?:
ILinkMatcherOptions
):
void
;
winptyCompatInit
():
void
;
/**
* Find the next instance of the term, then scroll to and select it. If it
...
...
@@ -698,9 +710,5 @@ declare module 'vscode-xterm' {
* @return Whether a result was found.
*/
findPrevious
(
term
:
string
):
boolean
;
webLinksInit
(
handler
?:
(
event
:
MouseEvent
,
uri
:
string
)
=>
void
,
options
?:
ILinkMatcherOptions
):
void
;
winptyCompatInit
():
void
;
charMeasure
?:
{
height
:
number
,
width
:
number
};
}
}
src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts
浏览文件 @
52e29e90
...
...
@@ -137,14 +137,14 @@ export class TerminalConfigHelper implements ITerminalConfigHelper {
// Get the character dimensions from xterm if it's available
if
(
xterm
)
{
if
(
xterm
.
charMeasure
&&
xterm
.
charMeasure
.
width
&&
xterm
.
charMeasure
.
height
)
{
if
(
xterm
.
_core
.
charMeasure
&&
xterm
.
_core
.
charMeasure
.
width
&&
xterm
.
_core
.
charMeasure
.
height
)
{
return
{
fontFamily
,
fontSize
,
letterSpacing
,
lineHeight
,
charHeight
:
xterm
.
charMeasure
.
height
,
charWidth
:
xterm
.
charMeasure
.
width
charHeight
:
xterm
.
_core
.
charMeasure
.
height
,
charWidth
:
xterm
.
_core
.
charMeasure
.
width
};
}
}
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts
浏览文件 @
52e29e90
...
...
@@ -232,7 +232,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
.
buffer
.
ydisp
);
this
.
_xterm
.
emit
(
'
scroll
'
,
this
.
_xterm
.
_core
.
buffer
.
ydisp
);
}
}
...
...
@@ -460,7 +460,7 @@ export class TerminalInstance implements ITerminalInstance {
private
_measureRenderTime
():
void
{
const
frameTimes
:
number
[]
=
[];
const
textRenderLayer
=
(
<
any
>
this
.
_xterm
)
.
renderer
.
_renderLayers
[
0
];
const
textRenderLayer
=
this
.
_xterm
.
_core
.
renderer
.
_renderLayers
[
0
];
const
originalOnGridChanged
=
textRenderLayer
.
onGridChanged
;
const
evaluateCanvasRenderer
=
()
=>
{
...
...
@@ -575,7 +575,7 @@ export class TerminalInstance implements ITerminalInstance {
this
.
_xtermElement
=
null
;
}
if
(
this
.
_xterm
)
{
const
buffer
=
(
<
any
>
this
.
_xterm
.
buffer
);
const
buffer
=
(
<
any
>
this
.
_xterm
.
_core
.
buffer
);
this
.
_sendLineData
(
buffer
,
buffer
.
ybase
+
buffer
.
y
);
this
.
_xterm
.
dispose
();
this
.
_xterm
=
null
;
...
...
@@ -648,7 +648,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
.
buffer
.
ydisp
);
this
.
_xterm
.
emit
(
'
scroll
'
,
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
...
...
@@ -848,7 +848,7 @@ export class TerminalInstance implements ITerminalInstance {
}
private
_onLineFeed
():
void
{
const
buffer
=
(
<
any
>
this
.
_xterm
.
buffer
);
const
buffer
=
(
<
any
>
this
.
_xterm
.
_core
.
buffer
);
const
newLine
=
buffer
.
lines
.
get
(
buffer
.
ybase
+
buffer
.
y
);
if
(
!
newLine
.
isWrapped
)
{
this
.
_sendLineData
(
buffer
,
buffer
.
ybase
+
buffer
.
y
-
1
);
...
...
@@ -974,7 +974,7 @@ export class TerminalInstance implements ITerminalInstance {
// on Winodws/Linux would fire an event saying that the terminal was not visible.
// This should only force a refresh if one is needed.
if
(
this
.
_xterm
.
getOption
(
'
rendererType
'
)
===
'
canvas
'
)
{
(
<
any
>
this
.
_xterm
)
.
renderer
.
onIntersectionChange
({
intersectionRatio
:
1
});
this
.
_xterm
.
_core
.
renderer
.
onIntersectionChange
({
intersectionRatio
:
1
});
}
}
}
...
...
src/vs/workbench/parts/terminal/node/terminalCommandTracker.ts
浏览文件 @
52e29e90
...
...
@@ -49,7 +49,7 @@ export class TerminalCommandTracker implements ITerminalCommandTracker, IDisposa
}
private
_onEnter
():
void
{
if
(
this
.
_xterm
.
buffer
.
x
>=
MINIMUM_PROMPT_LENGTH
)
{
if
(
this
.
_xterm
.
_core
.
buffer
.
x
>=
MINIMUM_PROMPT_LENGTH
)
{
this
.
_xterm
.
addMarker
(
0
);
}
}
...
...
@@ -176,7 +176,7 @@ export class TerminalCommandTracker implements ITerminalCommandTracker, IDisposa
private
_getLine
(
marker
:
IMarker
|
Boundary
):
number
{
// Use the _second last_ row as the last row is likely the prompt
if
(
marker
===
Boundary
.
Bottom
)
{
return
this
.
_xterm
.
buffer
.
ybase
+
this
.
_xterm
.
rows
-
1
;
return
this
.
_xterm
.
_core
.
buffer
.
ybase
+
this
.
_xterm
.
rows
-
1
;
}
if
(
marker
===
Boundary
.
Top
)
{
...
...
@@ -236,10 +236,10 @@ export class TerminalCommandTracker implements ITerminalCommandTracker, IDisposa
if
(
this
.
_currentMarker
===
Boundary
.
Bottom
)
{
return
0
;
}
else
if
(
this
.
_currentMarker
===
Boundary
.
Top
)
{
return
0
-
(
this
.
_xterm
.
buffer
.
ybase
+
this
.
_xterm
.
buffer
.
y
);
return
0
-
(
this
.
_xterm
.
_core
.
buffer
.
ybase
+
this
.
_xterm
.
_core
.
buffer
.
y
);
}
else
{
let
offset
=
this
.
_getLine
(
this
.
_currentMarker
);
offset
-=
this
.
_xterm
.
buffer
.
ybase
+
this
.
_xterm
.
buffer
.
y
;
offset
-=
this
.
_xterm
.
_core
.
buffer
.
ybase
+
this
.
_xterm
.
_core
.
buffer
.
y
;
return
offset
;
}
}
...
...
src/vs/workbench/parts/terminal/test/node/terminalCommandTracker.test.ts
浏览文件 @
52e29e90
...
...
@@ -62,24 +62,24 @@ suite('Workbench - TerminalCommandTracker', () => {
for
(
let
i
=
0
;
i
<
20
;
i
++
)
{
syncWrite
(
xterm
,
`\r\n`
);
}
assert
.
equal
(
xterm
.
buffer
.
ybase
,
20
);
assert
.
equal
(
xterm
.
buffer
.
ydisp
,
20
);
assert
.
equal
(
xterm
.
_core
.
buffer
.
ybase
,
20
);
assert
.
equal
(
xterm
.
_core
.
buffer
.
ydisp
,
20
);
// Scroll to marker
commandTracker
.
scrollToPreviousCommand
();
assert
.
equal
(
xterm
.
buffer
.
ydisp
,
9
);
assert
.
equal
(
xterm
.
_core
.
buffer
.
ydisp
,
9
);
// Scroll to top boundary
commandTracker
.
scrollToPreviousCommand
();
assert
.
equal
(
xterm
.
buffer
.
ydisp
,
0
);
assert
.
equal
(
xterm
.
_core
.
buffer
.
ydisp
,
0
);
// Scroll to marker
commandTracker
.
scrollToNextCommand
();
assert
.
equal
(
xterm
.
buffer
.
ydisp
,
9
);
assert
.
equal
(
xterm
.
_core
.
buffer
.
ydisp
,
9
);
// Scroll to bottom boundary
commandTracker
.
scrollToNextCommand
();
assert
.
equal
(
xterm
.
buffer
.
ydisp
,
20
);
assert
.
equal
(
xterm
.
_core
.
buffer
.
ydisp
,
20
);
});
test
(
'
should select to the next and previous commands
'
,
()
=>
{
(
<
any
>
window
).
matchMedia
=
()
=>
{
...
...
@@ -98,8 +98,8 @@ suite('Workbench - TerminalCommandTracker', () => {
assert
.
equal
(
xterm
.
markers
[
1
].
line
,
11
);
syncWrite
(
xterm
,
'
\n\r
3
'
);
assert
.
equal
(
xterm
.
buffer
.
ybase
,
3
);
assert
.
equal
(
xterm
.
buffer
.
ydisp
,
3
);
assert
.
equal
(
xterm
.
_core
.
buffer
.
ybase
,
3
);
assert
.
equal
(
xterm
.
_core
.
buffer
.
ydisp
,
3
);
assert
.
equal
(
xterm
.
getSelection
(),
''
);
commandTracker
.
selectToPreviousCommand
();
...
...
@@ -128,8 +128,8 @@ suite('Workbench - TerminalCommandTracker', () => {
assert
.
equal
(
xterm
.
markers
[
1
].
line
,
11
);
syncWrite
(
xterm
,
'
\n\r
3
'
);
assert
.
equal
(
xterm
.
buffer
.
ybase
,
3
);
assert
.
equal
(
xterm
.
buffer
.
ydisp
,
3
);
assert
.
equal
(
xterm
.
_core
.
buffer
.
ybase
,
3
);
assert
.
equal
(
xterm
.
_core
.
buffer
.
ydisp
,
3
);
assert
.
equal
(
xterm
.
getSelection
(),
''
);
commandTracker
.
selectToPreviousLine
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录