Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
f039fd59
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,发现更多精彩内容 >>
提交
f039fd59
编写于
6月 20, 2017
作者:
D
Daniel Imms
提交者:
GitHub
6月 20, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #29149 from Microsoft/tyriar/28770
Fix escape to close terminal find widget
上级
0c2e4670
8ffd4d78
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
19 addition
and
2 deletion
+19
-2
src/vs/workbench/parts/terminal/common/terminal.ts
src/vs/workbench/parts/terminal/common/terminal.ts
+5
-0
src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts
.../parts/terminal/electron-browser/terminal.contribution.ts
+3
-2
src/vs/workbench/parts/terminal/electron-browser/terminalFindWidget.ts
...nch/parts/terminal/electron-browser/terminalFindWidget.ts
+4
-0
src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts
...bench/parts/terminal/electron-browser/terminalInstance.ts
+7
-0
未找到文件。
src/vs/workbench/parts/terminal/common/terminal.ts
浏览文件 @
f039fd59
...
@@ -252,6 +252,11 @@ export interface ITerminalInstance {
...
@@ -252,6 +252,11 @@ export interface ITerminalInstance {
*/
*/
findPrevious
(
term
:
string
):
boolean
;
findPrevious
(
term
:
string
):
boolean
;
/**
* Notifies the terminal that the find widget's focus state has been changed.
*/
notifyFindWidgetFocusChanged
(
isFocused
:
boolean
):
void
;
/**
/**
* Focuses the terminal instance.
* Focuses the terminal instance.
*
*
...
...
src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts
浏览文件 @
f039fd59
...
@@ -288,6 +288,7 @@ actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(FocusTerminalFin
...
@@ -288,6 +288,7 @@ actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(FocusTerminalFin
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_F
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_F
},
KEYBINDING_CONTEXT_TERMINAL_FOCUS
),
'
Terminal: Focus Find Widget
'
,
category
);
},
KEYBINDING_CONTEXT_TERMINAL_FOCUS
),
'
Terminal: Focus Find Widget
'
,
category
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
HideTerminalFindWidgetAction
,
HideTerminalFindWidgetAction
.
ID
,
HideTerminalFindWidgetAction
.
LABEL
,
{
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
HideTerminalFindWidgetAction
,
HideTerminalFindWidgetAction
.
ID
,
HideTerminalFindWidgetAction
.
LABEL
,
{
primary
:
KeyCode
.
Escape
primary
:
KeyCode
.
Escape
,
},
KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE
),
'
Terminal: Focus Find Widget
'
,
category
);
secondary
:
[
KeyCode
.
Shift
|
KeyCode
.
Escape
]
},
ContextKeyExpr
.
and
(
KEYBINDING_CONTEXT_TERMINAL_FOCUS
,
KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE
)),
'
Terminal: Focus Find Widget
'
,
category
);
registerColors
();
registerColors
();
src/vs/workbench/parts/terminal/electron-browser/terminalFindWidget.ts
浏览文件 @
f039fd59
...
@@ -84,6 +84,7 @@ export class TerminalFindWidget extends Widget {
...
@@ -84,6 +84,7 @@ export class TerminalFindWidget extends Widget {
private
_findInput
:
FindInput
;
private
_findInput
:
FindInput
;
private
_domNode
:
HTMLElement
;
private
_domNode
:
HTMLElement
;
private
_isVisible
:
boolean
;
private
_isVisible
:
boolean
;
private
_focusTracker
:
dom
.
IFocusTracker
;
constructor
(
constructor
(
@
IContextViewService
private
_contextViewService
:
IContextViewService
,
@
IContextViewService
private
_contextViewService
:
IContextViewService
,
...
@@ -95,6 +96,9 @@ export class TerminalFindWidget extends Widget {
...
@@ -95,6 +96,9 @@ export class TerminalFindWidget extends Widget {
label
:
NLS_FIND_INPUT_LABEL
,
label
:
NLS_FIND_INPUT_LABEL
,
placeholder
:
NLS_FIND_INPUT_PLACEHOLDER
,
placeholder
:
NLS_FIND_INPUT_PLACEHOLDER
,
}));
}));
this
.
_focusTracker
=
this
.
_register
(
dom
.
trackFocus
(
this
.
_findInput
.
inputBox
.
inputElement
));
this
.
_register
(
this
.
_focusTracker
.
addFocusListener
(()
=>
this
.
_terminalService
.
getActiveInstance
().
notifyFindWidgetFocusChanged
(
true
)));
this
.
_register
(
this
.
_focusTracker
.
addBlurListener
(()
=>
this
.
_terminalService
.
getActiveInstance
().
notifyFindWidgetFocusChanged
(
false
)));
let
find
=
(
previous
)
=>
{
let
find
=
(
previous
)
=>
{
let
val
=
this
.
_findInput
.
getValue
();
let
val
=
this
.
_findInput
.
getValue
();
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts
浏览文件 @
f039fd59
...
@@ -357,6 +357,13 @@ export class TerminalInstance implements ITerminalInstance {
...
@@ -357,6 +357,13 @@ export class TerminalInstance implements ITerminalInstance {
return
this
.
_xterm
.
findPrevious
(
term
);
return
this
.
_xterm
.
findPrevious
(
term
);
}
}
public
notifyFindWidgetFocusChanged
(
isFocused
:
boolean
):
void
{
// In order to support escape to close the find widget when the terminal
// is focused terminalFocus needs to be true when either the terminal or
// the find widget are focused.
this
.
_terminalFocusContextKey
.
set
(
isFocused
||
document
.
activeElement
===
this
.
_xterm
.
textarea
);
}
public
dispose
():
void
{
public
dispose
():
void
{
if
(
this
.
_linkHandler
)
{
if
(
this
.
_linkHandler
)
{
this
.
_linkHandler
.
dispose
();
this
.
_linkHandler
.
dispose
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录