Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
1de69415
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,发现更多精彩内容 >>
提交
1de69415
编写于
9月 03, 2019
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move xterm type customizations into contrib/terminal
Part of #80074
上级
730f47da
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
56 addition
and
20 deletion
+56
-20
src/tsconfig.json
src/tsconfig.json
+4
-1
src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts
...orkbench/contrib/terminal/browser/terminalConfigHelper.ts
+6
-6
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
...vs/workbench/contrib/terminal/browser/terminalInstance.ts
+14
-11
src/vs/workbench/contrib/terminal/browser/xterm-private.d.ts
src/vs/workbench/contrib/terminal/browser/xterm-private.d.ts
+29
-0
src/vs/workbench/contrib/terminal/test/electron-browser/terminalCommandTracker.test.ts
...inal/test/electron-browser/terminalCommandTracker.test.ts
+3
-2
未找到文件。
src/tsconfig.json
浏览文件 @
1de69415
...
...
@@ -24,6 +24,9 @@
"./vs"
],
"exclude"
:
[
"./typings/require-monaco.d.ts"
"./typings/require-monaco.d.ts"
,
"./typings/xterm.d.ts"
,
"./typings/xterm-addon-search.d.ts"
,
"./typings/xterm-addon-web-links.d.ts"
]
}
src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts
浏览文件 @
1de69415
...
...
@@ -10,7 +10,6 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
ITerminalConfiguration
,
ITerminalFont
,
IS_WORKSPACE_SHELL_ALLOWED_STORAGE_KEY
,
TERMINAL_CONFIG_SECTION
,
DEFAULT_LETTER_SPACING
,
DEFAULT_LINE_HEIGHT
,
MINIMUM_LETTER_SPACING
,
LinuxDistro
,
IShellLaunchConfig
}
from
'
vs/workbench/contrib/terminal/common/terminal
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
Terminal
as
XTermTerminal
}
from
'
xterm
'
;
import
{
INotificationService
,
NeverShowAgainScope
}
from
'
vs/platform/notification/common/notification
'
;
import
{
IBrowserTerminalConfigHelper
}
from
'
vs/workbench/contrib/terminal/browser/terminal
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
...
...
@@ -21,6 +20,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
InstallRecommendedExtensionAction
}
from
'
vs/workbench/contrib/extensions/browser/extensionsActions
'
;
import
{
IProductService
}
from
'
vs/platform/product/common/product
'
;
import
{
XTermCore
}
from
'
vs/workbench/contrib/terminal/browser/xterm-private
'
;
const
MINIMUM_FONT_SIZE
=
6
;
const
MAXIMUM_FONT_SIZE
=
25
;
...
...
@@ -129,7 +129,7 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper {
* Gets the font information based on the terminal.integrated.fontFamily
* terminal.integrated.fontSize, terminal.integrated.lineHeight configuration properties
*/
public
getFont
(
xterm
?:
XTermTerminal
,
excludeDimensions
?:
boolean
):
ITerminalFont
{
public
getFont
(
xterm
Core
?:
XTermCore
,
excludeDimensions
?:
boolean
):
ITerminalFont
{
const
editorConfig
=
this
.
_configurationService
.
getValue
<
IEditorOptions
>
(
'
editor
'
);
let
fontFamily
=
this
.
config
.
fontFamily
||
editorConfig
.
fontFamily
||
EDITOR_FONT_DEFAULTS
.
fontFamily
;
...
...
@@ -161,15 +161,15 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper {
}
// Get the character dimensions from xterm if it's available
if
(
xterm
)
{
if
(
xterm
.
_core
.
_charSizeService
&&
xterm
.
_core
.
_charSizeService
.
width
&&
xterm
.
_c
ore
.
_charSizeService
.
height
)
{
if
(
xterm
Core
)
{
if
(
xterm
Core
.
_charSizeService
&&
xtermCore
.
_charSizeService
.
width
&&
xtermC
ore
.
_charSizeService
.
height
)
{
return
{
fontFamily
,
fontSize
,
letterSpacing
,
lineHeight
,
charHeight
:
xterm
.
_c
ore
.
_charSizeService
.
height
,
charWidth
:
xterm
.
_c
ore
.
_charSizeService
.
width
charHeight
:
xterm
C
ore
.
_charSizeService
.
height
,
charWidth
:
xterm
C
ore
.
_charSizeService
.
width
};
}
}
...
...
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
浏览文件 @
1de69415
...
...
@@ -38,6 +38,7 @@ import { Terminal as XTermTerminal, IBuffer, ITerminalAddon } from 'xterm';
import
{
SearchAddon
,
ISearchOptions
}
from
'
xterm-addon-search
'
;
import
{
CommandTrackerAddon
}
from
'
vs/workbench/contrib/terminal/browser/addons/commandTrackerAddon
'
;
import
{
NavigationModeAddon
}
from
'
vs/workbench/contrib/terminal/browser/addons/navigationModeAddon
'
;
import
{
XTermCore
}
from
'
vs/workbench/contrib/terminal/browser/xterm-private
'
;
// How long in milliseconds should an average frame take to render for a notification to appear
// which suggests the fallback DOM-based renderer
...
...
@@ -184,6 +185,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
private
_title
:
string
=
''
;
private
_wrapperElement
:
(
HTMLElement
&
{
xterm
?:
XTermTerminal
})
|
undefined
;
private
_xterm
:
XTermTerminal
|
undefined
;
private
_xtermCore
:
XTermCore
|
undefined
;
private
_xtermSearch
:
SearchAddon
|
undefined
;
private
_xtermElement
:
HTMLDivElement
|
undefined
;
private
_terminalHasTextContextKey
:
IContextKey
<
boolean
>
;
...
...
@@ -351,7 +353,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
return
null
;
}
const
font
=
this
.
_configHelper
.
getFont
(
this
.
_xterm
);
const
font
=
this
.
_configHelper
.
getFont
(
this
.
_xterm
Core
);
if
(
!
font
.
charWidth
||
!
font
.
charHeight
)
{
this
.
_setLastKnownColsAndRows
();
return
null
;
...
...
@@ -399,7 +401,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
private
_getDimension
(
width
:
number
,
height
:
number
):
ICanvasDimensions
|
undefined
{
// The font needs to have been initialized
const
font
=
this
.
_configHelper
.
getFont
(
this
.
_xterm
);
const
font
=
this
.
_configHelper
.
getFont
(
this
.
_xterm
Core
);
if
(
!
font
||
!
font
.
charWidth
||
!
font
.
charHeight
)
{
return
undefined
;
}
...
...
@@ -412,8 +414,8 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
// needs to happen otherwise its scrollTop value is invalid when the panel is toggled as
// 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
.
_c
ore
.
_onScroll
.
fire
(
this
.
_xterm
.
buffer
.
viewportY
);
if
(
this
.
_xterm
&&
this
.
_xtermCore
)
{
this
.
_xterm
C
ore
.
_onScroll
.
fire
(
this
.
_xterm
.
buffer
.
viewportY
);
}
}
...
...
@@ -472,6 +474,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
rendererType
:
config
.
rendererType
===
'
auto
'
?
'
canvas
'
:
config
.
rendererType
});
this
.
_xterm
=
xterm
;
this
.
_xtermCore
=
(
xterm
as
any
).
_core
as
XTermCore
;
this
.
updateAccessibilitySupport
();
this
.
_terminalInstanceService
.
getXtermSearchConstructor
().
then
(
Addon
=>
{
this
.
_xtermSearch
=
new
Addon
();
...
...
@@ -674,9 +677,9 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
}
private
async
_measureRenderTime
():
Promise
<
void
>
{
const
xterm
=
await
this
.
_xtermReadyPromise
;
await
this
.
_xtermReadyPromise
;
const
frameTimes
:
number
[]
=
[];
const
textRenderLayer
=
xterm
.
_core
.
_renderService
.
_renderer
.
_renderLayers
[
0
];
const
textRenderLayer
=
this
.
_xtermCore
!
.
_renderService
.
_renderer
.
_renderLayers
[
0
];
const
originalOnGridChanged
=
textRenderLayer
.
onGridChanged
;
const
evaluateCanvasRenderer
=
()
=>
{
...
...
@@ -893,12 +896,12 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
if
(
this
.
_wrapperElement
)
{
dom
.
toggleClass
(
this
.
_wrapperElement
,
'
active
'
,
visible
);
}
if
(
visible
&&
this
.
_xterm
)
{
if
(
visible
&&
this
.
_xterm
&&
this
.
_xtermCore
)
{
// Trigger a manual scroll event which will sync the viewport and scroll bar. This is
// 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
.
_c
ore
.
_onScroll
.
fire
(
this
.
_xterm
.
buffer
.
viewportY
);
this
.
_xterm
C
ore
.
_onScroll
.
fire
(
this
.
_xterm
.
buffer
.
viewportY
);
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
...
...
@@ -1322,11 +1325,11 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
let
cols
=
this
.
cols
;
let
rows
=
this
.
rows
;
if
(
this
.
_xterm
)
{
if
(
this
.
_xterm
&&
this
.
_xtermCore
)
{
// Only apply these settings when the terminal is visible so that
// the characters are measured correctly.
if
(
this
.
_isVisible
)
{
const
font
=
this
.
_configHelper
.
getFont
(
this
.
_xterm
);
const
font
=
this
.
_configHelper
.
getFont
(
this
.
_xterm
Core
);
const
config
=
this
.
_configHelper
.
config
;
this
.
_safeSetOption
(
'
letterSpacing
'
,
font
.
letterSpacing
);
this
.
_safeSetOption
(
'
lineHeight
'
,
font
.
lineHeight
);
...
...
@@ -1354,7 +1357,7 @@ export class TerminalInstance extends Disposable 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
.
_c
ore
.
_renderService
.
_onIntersectionChange
({
intersectionRatio
:
1
});
this
.
_xterm
C
ore
.
_renderService
.
_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
);
...
...
src/vs/workbench/contrib/terminal/browser/xterm-private.d.ts
0 → 100644
浏览文件 @
1de69415
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export
interface
XTermCore
{
_onScroll
:
IEventEmitter
<
number
>
;
_onKey
:
IEventEmitter
<
{
key
:
string
}
>
;
_charSizeService
:
{
width
:
number
;
height
:
number
;
};
_coreService
:
{
triggerDataEvent
(
data
:
string
,
wasUserInput
?:
boolean
):
void
;
}
_renderService
:
{
_renderer
:
{
_renderLayers
:
any
[];
};
_onIntersectionChange
:
any
;
};
}
export
interface
IEventEmitter
<
T
>
{
fire
(
e
:
T
):
void
;
}
src/vs/workbench/contrib/terminal/test/electron-browser/terminalCommandTracker.test.ts
浏览文件 @
1de69415
...
...
@@ -4,11 +4,12 @@
*--------------------------------------------------------------------------------------------*/
import
*
as
assert
from
'
assert
'
;
import
{
Terminal
,
TerminalCore
}
from
'
xterm
'
;
import
{
Terminal
}
from
'
xterm
'
;
import
{
CommandTrackerAddon
}
from
'
vs/workbench/contrib/terminal/browser/addons/commandTrackerAddon
'
;
import
{
isWindows
}
from
'
vs/base/common/platform
'
;
import
{
XTermCore
}
from
'
vs/workbench/contrib/terminal/browser/xterm-private
'
;
interface
TestTerminalCore
extends
Terminal
Core
{
interface
TestTerminalCore
extends
XTerm
Core
{
writeBuffer
:
string
[];
_innerWrite
():
void
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录