Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
69940c95
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,发现更多精彩内容 >>
提交
69940c95
编写于
6月 10, 2019
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update typings and fix private API access
上级
cc2392a8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
82 addition
and
131 deletion
+82
-131
src/typings/xterm.d.ts
src/typings/xterm.d.ts
+77
-126
src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts
...orkbench/contrib/terminal/browser/terminalConfigHelper.ts
+3
-3
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
...vs/workbench/contrib/terminal/browser/terminalInstance.ts
+2
-2
未找到文件。
src/typings/xterm.d.ts
浏览文件 @
69940c95
...
...
@@ -26,13 +26,14 @@ declare module 'xterm' {
export
interface
ITerminalOptions
{
/**
* Whether background should support non-opaque color. It must be set before
* executing open() method and can't be changed later without excuting it again.
* Warning: Enabling this option can reduce performances somewhat.
* executing the `Terminal.open()` method and can't be changed later without
* executing it again. Note that enabling this can negatively impact
* performance.
*/
allowTransparency
?:
boolean
;
/**
* A data uri of the sound to use for the bell
(needs bellStyle = 'sound')
.
* A data uri of the sound to use for the bell
when `bellStyle = 'sound'`
.
*/
bellSound
?:
string
;
...
...
@@ -114,9 +115,9 @@ declare module 'xterm' {
/**
* Whether holding a modifier key will force normal selection behavior,
* regardless of whether the terminal is in mouse events mode. This will
* also prevent mouse events from being emitted by the terminal. For
example,
*
this allows you to use xterm.js' regular selection inside tmux with
* mouse mode enabled.
* also prevent mouse events from being emitted by the terminal. For
*
example, this allows you to use xterm.js' regular selection inside tmux
*
with
mouse mode enabled.
*/
macOptionClickForcesSelection
?:
boolean
;
...
...
@@ -149,8 +150,9 @@ declare module 'xterm' {
screenReaderMode
?:
boolean
;
/**
* The amount of scrollback in the terminal. Scrollback is the amount of rows
* that are retained when lines are scrolled beyond the initial viewport.
* The amount of scrollback in the terminal. Scrollback is the amount of
* rows that are retained when lines are scrolled beyond the initial
* viewport.
*/
scrollback
?:
number
;
...
...
@@ -187,7 +189,7 @@ declare module 'xterm' {
background
?:
string
,
/** The cursor color */
cursor
?:
string
,
/** The accent color of the cursor (
used as the foreground
color for a block cursor) */
/** The accent color of the cursor (
fg
color for a block cursor) */
cursorAccent
?:
string
,
/** The selection color (can be transparent) */
selection
?:
string
,
...
...
@@ -253,8 +255,8 @@ declare module 'xterm' {
leaveCallback
?:
()
=>
void
;
/**
* The priority of the link matcher, this defines the order in which the
link
* matcher is evaluated relative to others, from highest to lowest. The
* The priority of the link matcher, this defines the order in which the
*
link
matcher is evaluated relative to others, from highest to lowest. The
* default value is 0.
*/
priority
?:
number
;
...
...
@@ -268,13 +270,6 @@ declare module 'xterm' {
willLinkActivate
?:
(
event
:
MouseEvent
,
uri
:
string
)
=>
boolean
;
}
export
interface
IEventEmitter
{
on
(
type
:
string
,
listener
:
(...
args
:
any
[])
=>
void
):
void
;
off
(
type
:
string
,
listener
:
(...
args
:
any
[])
=>
void
):
void
;
emit
(
type
:
string
,
data
?:
any
):
void
;
addDisposableListener
(
type
:
string
,
handler
:
(...
args
:
any
[])
=>
void
):
IDisposable
;
}
/**
* An object that can be disposed via a dispose function.
*/
...
...
@@ -290,22 +285,52 @@ declare module 'xterm' {
(
listener
:
(
e
:
T
)
=>
any
):
IDisposable
;
}
/**
* Represents a specific line in the terminal that is tracked when scrollback
* is trimmed and lines are added or removed.
*/
export
interface
IMarker
extends
IDisposable
{
/**
* A unique identifier for this marker.
*/
readonly
id
:
number
;
/**
* Whether this marker is disposed.
*/
readonly
isDisposed
:
boolean
;
/**
* The actual line index in the buffer at this point in time.
*/
readonly
line
:
number
;
}
/**
* The set of localizable strings.
*/
export
interface
ILocalizableStrings
{
/**
* Announcement for a blank line when `screenReaderMode` is enabled.
*/
blankLine
:
string
;
/**
* The aria label for the underlying input textarea for the terminal.
*/
promptLabel
:
string
;
/**
* Announcement for when line reading is suppressed due to too many lines
* being printed to the terminal when `screenReaderMode` is enabled.
*/
tooMuchOutput
:
string
;
}
/**
* The class that represents an xterm.js terminal.
*/
export
class
Terminal
implements
I
EventEmitter
,
I
Disposable
{
export
class
Terminal
implements
IDisposable
{
/**
* The element containing the terminal.
*/
...
...
@@ -429,96 +454,6 @@ declare module 'xterm' {
*/
focus
():
void
;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on
(
type
:
'
blur
'
|
'
focus
'
|
'
linefeed
'
|
'
selection
'
,
listener
:
()
=>
void
):
void
;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on
(
type
:
'
data
'
,
listener
:
(...
args
:
any
[])
=>
void
):
void
;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on
(
type
:
'
key
'
,
listener
:
(
key
:
string
,
event
:
KeyboardEvent
)
=>
void
):
void
;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on
(
type
:
'
keypress
'
|
'
keydown
'
,
listener
:
(
event
:
KeyboardEvent
)
=>
void
):
void
;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on
(
type
:
'
refresh
'
,
listener
:
(
data
:
{
start
:
number
,
end
:
number
})
=>
void
):
void
;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on
(
type
:
'
resize
'
,
listener
:
(
data
:
{
cols
:
number
,
rows
:
number
})
=>
void
):
void
;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on
(
type
:
'
scroll
'
,
listener
:
(
ydisp
:
number
)
=>
void
):
void
;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on
(
type
:
'
title
'
,
listener
:
(
title
:
string
)
=>
void
):
void
;
/**
* Registers an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
on
(
type
:
string
,
listener
:
(...
args
:
any
[])
=>
void
):
void
;
/**
* Deregisters an event listener.
* @param type The type of the event.
* @param listener The listener.
* @deprecated use `Terminal.onEvent(listener).dispose()` instead.
*/
off
(
type
:
'
blur
'
|
'
focus
'
|
'
linefeed
'
|
'
selection
'
|
'
data
'
|
'
key
'
|
'
keypress
'
|
'
keydown
'
|
'
refresh
'
|
'
resize
'
|
'
scroll
'
|
'
title
'
|
string
,
listener
:
(...
args
:
any
[])
=>
void
):
void
;
/**
* Emits an event on the terminal.
* @param type The type of event
* @param data data associated with the event.
* @deprecated This is being removed from the API with no replacement, see
* issue #1505.
*/
emit
(
type
:
string
,
data
?:
any
):
void
;
/**
* Adds an event listener to the Terminal, returning an IDisposable that can
* be used to conveniently remove the event listener.
* @param type The type of event.
* @param handler The event handler.
* @deprecated use `Terminal.onEvent(listener)` instead.
*/
addDisposableListener
(
type
:
string
,
handler
:
(...
args
:
any
[])
=>
void
):
IDisposable
;
/**
* Resizes the terminal. It's best practice to debounce calls to resize,
* this will help ensure that the pty can respond to the resize event
...
...
@@ -727,9 +662,9 @@ declare module 'xterm' {
writeln
(
data
:
string
):
void
;
/**
* Writes UTF8 data to the terminal.
*
This has a slight performance advantage over the string based write metho
d
*
due to lesser data conversions needed
on the way from the pty to xterm.js.
* Writes UTF8 data to the terminal.
This has a slight performance advantage
*
over the string based write method due to lesser data conversions neede
d
* on the way from the pty to xterm.js.
* @param data The data to write to the terminal.
*/
writeUtf8
(
data
:
Uint8Array
):
void
;
...
...
@@ -865,13 +800,13 @@ declare module 'xterm' {
*/
export
interface
ITerminalAddon
extends
IDisposable
{
/**
* (EXPERIMENTAL) This is called when the addon is activated
within xterm.js
.
* (EXPERIMENTAL) This is called when the addon is activated.
*/
activate
(
terminal
:
Terminal
):
void
;
}
/**
* An object representing a selec
r
tion within the terminal.
* An object representing a selection within the terminal.
*/
interface
ISelectionPosition
{
/**
...
...
@@ -895,6 +830,9 @@ declare module 'xterm' {
endRow
:
number
;
}
/**
* Represents a terminal buffer.
*/
interface
IBuffer
{
/**
* The y position of the cursor. This ranges between `0` (when the
...
...
@@ -926,16 +864,21 @@ declare module 'xterm' {
readonly
length
:
number
;
/**
* Gets a line from the buffer, or undefined if the line index does not exist.
* Gets a line from the buffer, or undefined if the line index does not
* exist.
*
* Note that the result of this function should be used immediately after calling as when the
* terminal updates it could lead to unexpected behavior.
* Note that the result of this function should be used immediately after
* calling as when the terminal updates it could lead to unexpected
* behavior.
*
* @param y The line index to get.
*/
getLine
(
y
:
number
):
IBufferLine
|
undefined
;
}
/**
* Represents a line in the terminal's buffer.
*/
interface
IBufferLine
{
/**
* Whether the line is wrapped from the previous line.
...
...
@@ -945,16 +888,17 @@ declare module 'xterm' {
/**
* Gets a cell from the line, or undefined if the line index does not exist.
*
* Note that the result of this function should be used immediately after calling as when the
* terminal updates it could lead to unexpected behavior.
* Note that the result of this function should be used immediately after
* calling as when the terminal updates it could lead to unexpected
* behavior.
*
* @param x The character index to get.
*/
getCell
(
x
:
number
):
IBufferCell
|
undefined
;
/**
* Gets the line as a string. Note that this is gets only the string for the
line, not taking
* isWrapped into account.
* Gets the line as a string. Note that this is gets only the string for the
*
line, not taking
isWrapped into account.
*
* @param trimRight Whether to trim any whitespace at the right of the line.
* @param startColumn The column to start from (inclusive).
...
...
@@ -963,6 +907,9 @@ declare module 'xterm' {
translateToString
(
trimRight
?:
boolean
,
startColumn
?:
number
,
endColumn
?:
number
):
string
;
}
/**
* Represents a single cell in the terminal's buffer.
*/
interface
IBufferCell
{
/**
* The character within the cell.
...
...
@@ -983,6 +930,7 @@ declare module 'xterm' {
// Modifications to official .d.ts below
declare
module
'
xterm
'
{
interface
TerminalCore
{
...
...
@@ -990,12 +938,15 @@ declare module 'xterm' {
handler
(
text
:
string
):
void
;
_onScroll
:
IEventEmitter
2
<
number
>
;
_onKey
:
IEventEmitter
2
<
{
key
:
string
}
>
;
_onScroll
:
IEventEmitter
<
number
>
;
_onKey
:
IEventEmitter
<
{
key
:
string
}
>
;
charMeasure
?:
{
height
:
number
,
width
:
number
};
_charSizeService
:
{
width
:
number
;
height
:
number
;
}
_render
Coordinator
:
{
_render
Service
:
{
_renderer
:
{
_renderLayers
:
any
[];
};
...
...
@@ -1003,7 +954,7 @@ declare module 'xterm' {
};
}
interface
IEventEmitter
2
<
T
>
{
interface
IEventEmitter
<
T
>
{
fire
(
e
:
T
):
void
;
}
...
...
src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts
浏览文件 @
69940c95
...
...
@@ -143,14 +143,14 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper {
// Get the character dimensions from xterm if it's available
if
(
xterm
)
{
if
(
xterm
.
_core
.
charMeasure
&&
xterm
.
_core
.
charMeasure
.
width
&&
xterm
.
_core
.
charMeasur
e
.
height
)
{
if
(
xterm
.
_core
.
_charSizeService
&&
xterm
.
_core
.
_charSizeService
.
width
&&
xterm
.
_core
.
_charSizeServic
e
.
height
)
{
return
{
fontFamily
,
fontSize
,
letterSpacing
,
lineHeight
,
charHeight
:
xterm
.
_core
.
charMeasur
e
.
height
,
charWidth
:
xterm
.
_core
.
charMeasur
e
.
width
charHeight
:
xterm
.
_core
.
_charSizeServic
e
.
height
,
charWidth
:
xterm
.
_core
.
_charSizeServic
e
.
width
};
}
}
...
...
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
浏览文件 @
69940c95
...
...
@@ -643,7 +643,7 @@ export class TerminalInstance implements ITerminalInstance {
private
_measureRenderTime
():
void
{
const
frameTimes
:
number
[]
=
[];
const
textRenderLayer
=
this
.
_xterm
.
_core
.
_render
Coordinator
.
_renderer
.
_renderLayers
[
0
];
const
textRenderLayer
=
this
.
_xterm
.
_core
.
_render
Service
.
_renderer
.
_renderLayers
[
0
];
const
originalOnGridChanged
=
textRenderLayer
.
onGridChanged
;
const
evaluateCanvasRenderer
=
()
=>
{
...
...
@@ -1282,7 +1282,7 @@ export class TerminalInstance implements ITerminalInstance {
// maximize on Windows/Linux would fire an event saying that the terminal was not
// visible.
if
(
this
.
_xterm
.
getOption
(
'
rendererType
'
)
===
'
canvas
'
)
{
this
.
_xterm
.
_core
.
_render
Coordinator
.
_onIntersectionChange
({
intersectionRatio
:
1
});
this
.
_xterm
.
_core
.
_render
Service
.
_onIntersectionChange
({
intersectionRatio
:
1
});
// HACK: Force a refresh of the screen to ensure links are refresh corrected.
// This can probably be removed when the above hack is fixed in Chromium.
this
.
_xterm
.
refresh
(
0
,
this
.
_xterm
.
rows
-
1
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录