Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
51daee5d
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,发现更多精彩内容 >>
未验证
提交
51daee5d
编写于
8月 06, 2019
作者:
P
Pine
提交者:
GitHub
8月 06, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into misolori/settings-editor-add
上级
18f5e26e
5bf573ab
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
58 addition
and
47 deletion
+58
-47
src/vs/workbench/contrib/terminal/browser/terminal.ts
src/vs/workbench/contrib/terminal/browser/terminal.ts
+1
-1
src/vs/workbench/contrib/terminal/browser/terminalActions.ts
src/vs/workbench/contrib/terminal/browser/terminalActions.ts
+6
-6
src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts
...orkbench/contrib/terminal/browser/terminalConfigHelper.ts
+24
-18
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
...vs/workbench/contrib/terminal/browser/terminalInstance.ts
+23
-16
src/vs/workbench/contrib/terminal/browser/terminalLinkHandler.ts
...workbench/contrib/terminal/browser/terminalLinkHandler.ts
+1
-3
src/vs/workbench/contrib/terminal/common/terminal.ts
src/vs/workbench/contrib/terminal/common/terminal.ts
+1
-1
src/vs/workbench/contrib/terminal/node/terminalProcess.ts
src/vs/workbench/contrib/terminal/node/terminalProcess.ts
+2
-2
未找到文件。
src/vs/workbench/contrib/terminal/browser/terminal.ts
浏览文件 @
51daee5d
...
...
@@ -35,5 +35,5 @@ export interface ITerminalInstanceService {
}
export
interface
IBrowserTerminalConfigHelper
extends
ITerminalConfigHelper
{
panelContainer
:
HTMLElement
;
panelContainer
:
HTMLElement
|
undefined
;
}
src/vs/workbench/contrib/terminal/browser/terminalActions.ts
浏览文件 @
51daee5d
...
...
@@ -1168,7 +1168,7 @@ export class ScrollToPreviousCommandAction extends Action {
public
run
():
Promise
<
any
>
{
const
instance
=
this
.
terminalService
.
getActiveInstance
();
if
(
instance
)
{
if
(
instance
&&
instance
.
commandTracker
)
{
instance
.
commandTracker
.
scrollToPreviousCommand
();
instance
.
focus
();
}
...
...
@@ -1189,7 +1189,7 @@ export class ScrollToNextCommandAction extends Action {
public
run
():
Promise
<
any
>
{
const
instance
=
this
.
terminalService
.
getActiveInstance
();
if
(
instance
)
{
if
(
instance
&&
instance
.
commandTracker
)
{
instance
.
commandTracker
.
scrollToNextCommand
();
instance
.
focus
();
}
...
...
@@ -1210,7 +1210,7 @@ export class SelectToPreviousCommandAction extends Action {
public
run
():
Promise
<
any
>
{
const
instance
=
this
.
terminalService
.
getActiveInstance
();
if
(
instance
)
{
if
(
instance
&&
instance
.
commandTracker
)
{
instance
.
commandTracker
.
selectToPreviousCommand
();
instance
.
focus
();
}
...
...
@@ -1231,7 +1231,7 @@ export class SelectToNextCommandAction extends Action {
public
run
():
Promise
<
any
>
{
const
instance
=
this
.
terminalService
.
getActiveInstance
();
if
(
instance
)
{
if
(
instance
&&
instance
.
commandTracker
)
{
instance
.
commandTracker
.
selectToNextCommand
();
instance
.
focus
();
}
...
...
@@ -1252,7 +1252,7 @@ export class SelectToPreviousLineAction extends Action {
public
run
():
Promise
<
any
>
{
const
instance
=
this
.
terminalService
.
getActiveInstance
();
if
(
instance
)
{
if
(
instance
&&
instance
.
commandTracker
)
{
instance
.
commandTracker
.
selectToPreviousLine
();
instance
.
focus
();
}
...
...
@@ -1273,7 +1273,7 @@ export class SelectToNextLineAction extends Action {
public
run
():
Promise
<
any
>
{
const
instance
=
this
.
terminalService
.
getActiveInstance
();
if
(
instance
)
{
if
(
instance
&&
instance
.
commandTracker
)
{
instance
.
commandTracker
.
selectToNextLine
();
instance
.
focus
();
}
...
...
src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.ts
浏览文件 @
51daee5d
...
...
@@ -26,11 +26,11 @@ const MAXIMUM_FONT_SIZE = 25;
* specific test cases can be written.
*/
export
class
TerminalConfigHelper
implements
IBrowserTerminalConfigHelper
{
public
panelContainer
:
HTMLElement
;
public
panelContainer
:
HTMLElement
|
undefined
;
private
_charMeasureElement
:
HTMLElement
;
private
_lastFontMeasurement
:
ITerminalFont
;
public
config
:
ITerminalConfiguration
;
private
_charMeasureElement
:
HTMLElement
|
undefined
;
private
_lastFontMeasurement
:
ITerminalFont
|
undefined
;
public
config
!
:
ITerminalConfiguration
;
private
readonly
_onWorkspacePermissionsChanged
=
new
Emitter
<
boolean
>
();
public
get
onWorkspacePermissionsChanged
():
Event
<
boolean
>
{
return
this
.
_onWorkspacePermissionsChanged
.
event
;
}
...
...
@@ -55,49 +55,55 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper {
}
public
configFontIsMonospace
():
boolean
{
this
.
_createCharMeasureElementIfNecessary
();
const
fontSize
=
15
;
const
fontFamily
=
this
.
config
.
fontFamily
||
this
.
_configurationService
.
getValue
<
IEditorOptions
>
(
'
editor
'
).
fontFamily
||
EDITOR_FONT_DEFAULTS
.
fontFamily
;
const
i_rect
=
this
.
_getBoundingRectFor
(
'
i
'
,
fontFamily
,
fontSize
);
const
w_rect
=
this
.
_getBoundingRectFor
(
'
w
'
,
fontFamily
,
fontSize
);
const
invalidBounds
=
!
i_rect
.
width
||
!
w_rect
.
width
;
if
(
invalidBounds
)
{
// There is no reason to believe the font is not Monospace.
// Check for invalid bounds, there is no reason to believe the font is not monospace
if
(
!
i_rect
||
!
w_rect
||
!
i_rect
.
width
||
!
w_rect
.
width
)
{
return
true
;
}
return
i_rect
.
width
===
w_rect
.
width
;
}
private
_createCharMeasureElementIfNecessary
()
{
private
_createCharMeasureElementIfNecessary
():
HTMLElement
{
if
(
!
this
.
panelContainer
)
{
throw
new
Error
(
'
Cannot measure element when terminal is not attached
'
);
}
// Create charMeasureElement if it hasn't been created or if it was orphaned by its parent
if
(
!
this
.
_charMeasureElement
||
!
this
.
_charMeasureElement
.
parentElement
)
{
this
.
_charMeasureElement
=
document
.
createElement
(
'
div
'
);
this
.
panelContainer
.
appendChild
(
this
.
_charMeasureElement
);
}
return
this
.
_charMeasureElement
;
}
private
_getBoundingRectFor
(
char
:
string
,
fontFamily
:
string
,
fontSize
:
number
):
ClientRect
|
DOMRect
{
const
style
=
this
.
_charMeasureElement
.
style
;
private
_getBoundingRectFor
(
char
:
string
,
fontFamily
:
string
,
fontSize
:
number
):
ClientRect
|
DOMRect
|
undefined
{
let
charMeasureElement
:
HTMLElement
;
try
{
charMeasureElement
=
this
.
_createCharMeasureElementIfNecessary
();
}
catch
{
return
undefined
;
}
const
style
=
charMeasureElement
.
style
;
style
.
display
=
'
inline-block
'
;
style
.
fontFamily
=
fontFamily
;
style
.
fontSize
=
fontSize
+
'
px
'
;
style
.
lineHeight
=
'
normal
'
;
this
.
_
charMeasureElement
.
innerText
=
char
;
const
rect
=
this
.
_
charMeasureElement
.
getBoundingClientRect
();
charMeasureElement
.
innerText
=
char
;
const
rect
=
charMeasureElement
.
getBoundingClientRect
();
style
.
display
=
'
none
'
;
return
rect
;
}
private
_measureFont
(
fontFamily
:
string
,
fontSize
:
number
,
letterSpacing
:
number
,
lineHeight
:
number
):
ITerminalFont
{
this
.
_createCharMeasureElementIfNecessary
();
const
rect
=
this
.
_getBoundingRectFor
(
'
X
'
,
fontFamily
,
fontSize
);
// Bounding client rect was invalid, use last font measurement if available.
if
(
this
.
_lastFontMeasurement
&&
!
rect
.
width
&&
!
rect
.
height
)
{
if
(
this
.
_lastFontMeasurement
&&
(
!
rect
||
!
rect
.
width
||
!
rect
.
height
)
)
{
return
this
.
_lastFontMeasurement
;
}
...
...
@@ -106,8 +112,8 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper {
fontSize
,
letterSpacing
,
lineHeight
,
charWidth
:
rect
.
width
,
charHeight
:
Math
.
ceil
(
rect
.
height
)
charWidth
:
rect
&&
rect
.
width
?
rect
.
width
:
0
,
charHeight
:
rect
&&
rect
.
height
?
Math
.
ceil
(
rect
.
height
)
:
0
};
return
this
.
_lastFontMeasurement
;
}
...
...
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
浏览文件 @
51daee5d
...
...
@@ -185,22 +185,22 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
private
_wrapperElement
:
(
HTMLElement
&
{
xterm
?:
XTermTerminal
})
|
undefined
;
private
_xterm
:
XTermTerminal
|
undefined
;
private
_xtermSearch
:
SearchAddon
|
undefined
;
private
_xtermElement
:
HTMLDivElement
;
private
_xtermElement
:
HTMLDivElement
|
undefined
;
private
_terminalHasTextContextKey
:
IContextKey
<
boolean
>
;
private
_terminalA11yTreeFocusContextKey
:
IContextKey
<
boolean
>
;
private
_cols
:
number
;
private
_rows
:
number
;
private
_cols
:
number
=
0
;
private
_rows
:
number
=
0
;
private
_dimensionsOverride
:
ITerminalDimensions
|
undefined
;
private
_windowsShellHelper
:
IWindowsShellHelper
|
undefined
;
private
_xtermReadyPromise
:
Promise
<
XTermTerminal
>
;
private
_titleReadyPromise
:
Promise
<
string
>
;
private
_titleReadyComplete
:
(
title
:
string
)
=>
any
;
private
_titleReadyComplete
:
(
(
title
:
string
)
=>
any
)
|
undefined
;
private
_messageTitleDisposable
:
IDisposable
|
undefined
;
private
_widgetManager
:
TerminalWidgetManager
;
private
_linkHandler
:
TerminalLinkHandler
;
private
_commandTrackerAddon
:
CommandTrackerAddon
;
private
_widgetManager
:
TerminalWidgetManager
|
undefined
;
private
_linkHandler
:
TerminalLinkHandler
|
undefined
;
private
_commandTrackerAddon
:
CommandTrackerAddon
|
undefined
;
private
_navigationModeAddon
:
INavigationMode
&
ITerminalAddon
|
undefined
;
public
disableLayout
:
boolean
;
...
...
@@ -228,7 +228,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
public
get
hadFocusOnExit
():
boolean
{
return
this
.
_hadFocusOnExit
;
}
public
get
isTitleSetByProcess
():
boolean
{
return
!!
this
.
_messageTitleDisposable
;
}
public
get
shellLaunchConfig
():
IShellLaunchConfig
{
return
this
.
_shellLaunchConfig
;
}
public
get
commandTracker
():
CommandTrackerAddon
{
return
this
.
_commandTrackerAddon
;
}
public
get
commandTracker
():
CommandTrackerAddon
|
undefined
{
return
this
.
_commandTrackerAddon
;
}
public
get
navigationMode
():
INavigationMode
|
undefined
{
return
this
.
_navigationModeAddon
;
}
private
readonly
_onExit
=
new
Emitter
<
number
>
();
...
...
@@ -494,7 +494,9 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
this
.
_xterm
.
onData
(
data
=>
this
.
_processManager
!
.
write
(
data
));
// TODO: How does the cwd work on detached processes?
this
.
processReady
.
then
(
async
()
=>
{
if
(
this
.
_linkHandler
)
{
this
.
_linkHandler
.
processCwd
=
await
this
.
_processManager
!
.
getInitialCwd
();
}
});
// Init winpty compat and link handler after process creation as they rely on the
// underlying process OS
...
...
@@ -661,11 +663,16 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
this
.
_container
.
appendChild
(
this
.
_wrapperElement
);
if
(
this
.
_processManager
)
{
this
.
_widgetManager
=
new
TerminalWidgetManager
(
this
.
_wrapperElement
);
this
.
_processManager
.
onProcessReady
(()
=>
this
.
_linkHandler
.
setWidgetManager
(
this
.
_widgetManager
));
const
widgetManager
=
new
TerminalWidgetManager
(
this
.
_wrapperElement
);
this
.
_widgetManager
=
widgetManager
;
this
.
_processManager
.
onProcessReady
(()
=>
{
if
(
this
.
_linkHandler
)
{
this
.
_linkHandler
.
setWidgetManager
(
widgetManager
);
}
});
}
else
if
(
this
.
_shellLaunchConfig
.
isRendererOnly
)
{
this
.
_widgetManager
=
new
TerminalWidgetManager
(
this
.
_wrapperElement
);
this
.
_linkHandler
.
setWidgetManager
(
this
.
_widgetManager
);
this
.
_linkHandler
!
.
setWidgetManager
(
this
.
_widgetManager
);
}
const
computedStyle
=
window
.
getComputedStyle
(
this
.
_container
);
...
...
@@ -736,7 +743,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
}
public
registerLinkMatcher
(
regex
:
RegExp
,
handler
:
(
url
:
string
)
=>
void
,
matchIndex
?:
number
,
validationCallback
?:
(
uri
:
string
,
callback
:
(
isValid
:
boolean
)
=>
void
)
=>
void
):
number
{
return
this
.
_linkHandler
.
registerCustomLinkHandler
(
regex
,
handler
,
matchIndex
,
validationCallback
);
return
this
.
_linkHandler
!
.
registerCustomLinkHandler
(
regex
,
handler
,
matchIndex
,
validationCallback
);
}
public
deregisterLinkMatcher
(
linkMatcherId
:
number
):
void
{
...
...
@@ -1252,7 +1259,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
private
async
_updateProcessCwd
():
Promise
<
string
>
{
// reset cwd if it has changed, so file based url paths can be resolved
const
cwd
=
await
this
.
getCwd
();
if
(
cwd
)
{
if
(
cwd
&&
this
.
_linkHandler
)
{
this
.
_linkHandler
.
processCwd
=
cwd
;
}
return
cwd
;
...
...
@@ -1417,11 +1424,11 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
this
.
_windowsShellHelper
=
undefined
;
}
const
didTitleChange
=
title
!==
this
.
_title
;
const
oldTitle
=
this
.
_title
;
this
.
_title
=
title
;
if
(
didTitleChange
)
{
if
(
!
oldTitl
e
)
{
if
(
this
.
_titleReadyComplet
e
)
{
this
.
_titleReadyComplete
(
title
);
this
.
_titleReadyComplete
=
undefined
;
}
this
.
_onTitleChanged
.
fire
(
this
);
}
...
...
src/vs/workbench/contrib/terminal/browser/terminalLinkHandler.ts
浏览文件 @
51daee5d
...
...
@@ -5,7 +5,7 @@
import
*
as
nls
from
'
vs/nls
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
dispose
,
IDisposable
,
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
import
{
TerminalWidgetManager
}
from
'
vs/workbench/contrib/terminal/browser/terminalWidgetManager
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
...
...
@@ -67,7 +67,6 @@ interface IPath {
export
class
TerminalLinkHandler
{
private
readonly
_hoverDisposables
=
new
DisposableStore
();
private
_mouseMoveDisposable
:
IDisposable
;
private
_widgetManager
:
TerminalWidgetManager
|
undefined
;
private
_processCwd
:
string
|
undefined
;
private
_gitDiffPreImagePattern
:
RegExp
;
...
...
@@ -184,7 +183,6 @@ export class TerminalLinkHandler {
public
dispose
():
void
{
this
.
_hoverDisposables
.
dispose
();
this
.
_mouseMoveDisposable
=
dispose
(
this
.
_mouseMoveDisposable
);
}
private
_wrapLinkHandler
(
handler
:
(
uri
:
string
)
=>
boolean
|
void
):
XtermLinkMatcherHandler
{
...
...
src/vs/workbench/contrib/terminal/common/terminal.ts
浏览文件 @
51daee5d
...
...
@@ -483,7 +483,7 @@ export interface ITerminalInstance {
* An object that tracks when commands are run and enables navigating and selecting between
* them.
*/
readonly
commandTracker
:
ICommandTracker
;
readonly
commandTracker
:
ICommandTracker
|
undefined
;
readonly
navigationMode
:
INavigationMode
|
undefined
;
...
...
src/vs/workbench/contrib/terminal/node/terminalProcess.ts
浏览文件 @
51daee5d
...
...
@@ -19,7 +19,7 @@ import { findExecutable } from 'vs/workbench/contrib/terminal/node/terminalEnvir
import
{
URI
}
from
'
vs/base/common/uri
'
;
export
class
TerminalProcess
extends
Disposable
implements
ITerminalChildProcess
{
private
_exitCode
:
number
;
private
_exitCode
:
number
|
undefined
;
private
_closeTimeout
:
any
;
private
_ptyProcess
:
pty
.
IPty
|
undefined
;
private
_currentTitle
:
string
=
''
;
...
...
@@ -188,7 +188,7 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
}
catch
(
ex
)
{
// Swallow, the pty has already been killed
}
this
.
_onProcessExit
.
fire
(
this
.
_exitCode
);
this
.
_onProcessExit
.
fire
(
this
.
_exitCode
||
0
);
this
.
dispose
();
});
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录