Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c1aeb66a
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,发现更多精彩内容 >>
提交
c1aeb66a
编写于
2月 18, 2019
作者:
R
Rob Lourens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #68798 - F4 must put focus in the opened file
上级
c5a5b8b0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
14 addition
and
27 deletion
+14
-27
src/vs/platform/list/browser/listService.ts
src/vs/platform/list/browser/listService.ts
+1
-1
src/vs/workbench/contrib/search/browser/searchActions.ts
src/vs/workbench/contrib/search/browser/searchActions.ts
+8
-19
src/vs/workbench/contrib/search/browser/searchView.ts
src/vs/workbench/contrib/search/browser/searchView.ts
+5
-7
未找到文件。
src/vs/platform/list/browser/listService.ts
浏览文件 @
c1aeb66a
...
...
@@ -659,7 +659,7 @@ export interface SelectionKeyboardEvent extends KeyboardEvent {
preserveFocus
?:
boolean
;
}
export
function
getSelectionKeyboardEvent
(
typeArg
:
string
,
preserveFocus
?:
boolean
):
SelectionKeyboardEvent
{
export
function
getSelectionKeyboardEvent
(
typeArg
=
'
keydown
'
,
preserveFocus
?:
boolean
):
SelectionKeyboardEvent
{
const
e
=
new
KeyboardEvent
(
typeArg
);
(
<
SelectionKeyboardEvent
>
e
).
preserveFocus
=
preserveFocus
;
...
...
src/vs/workbench/contrib/search/browser/searchActions.ts
浏览文件 @
c1aeb66a
...
...
@@ -17,18 +17,17 @@ import * as nls from 'vs/nls';
import
{
IClipboardService
}
from
'
vs/platform/clipboard/common/clipboardService
'
;
import
{
ICommandHandler
}
from
'
vs/platform/commands/common/commands
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
WorkbenchObjectTree
}
from
'
vs/platform/list/browser/listService
'
;
import
{
ISearchConfiguration
,
ISearchHistoryService
,
VIEW_ID
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
getSelectionKeyboardEvent
,
WorkbenchObjectTree
}
from
'
vs/platform/list/browser/listService
'
;
import
{
SearchView
}
from
'
vs/workbench/contrib/search/browser/searchView
'
;
import
*
as
Constants
from
'
vs/workbench/contrib/search/common/constants
'
;
import
{
IReplaceService
}
from
'
vs/workbench/contrib/search/common/replace
'
;
import
{
FileMatch
,
FileMatchOrMatch
,
FolderMatch
,
Match
,
RenderableMatch
,
searchMatchComparer
,
SearchResult
,
BaseFolderMatch
}
from
'
vs/workbench/contrib/search/common/searchModel
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
BaseFolderMatch
,
FileMatch
,
FileMatchOrMatch
,
FolderMatch
,
Match
,
RenderableMatch
,
searchMatchComparer
,
SearchResult
}
from
'
vs/workbench/contrib/search/common/searchModel
'
;
import
{
IEditorGroupsService
}
from
'
vs/workbench/services/editor/common/editorGroupsService
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
import
{
ISearchConfiguration
,
ISearchHistoryService
,
VIEW_ID
}
from
'
vs/workbench/services/search/common/search
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
export
function
isSearchViewFocused
(
viewletService
:
IViewletService
,
panelService
:
IPanelService
):
boolean
{
...
...
@@ -470,7 +469,7 @@ export class RemoveAction extends AbstractSearchAndReplaceAction {
if
(
nextFocusElement
)
{
this
.
viewer
.
reveal
(
nextFocusElement
);
this
.
viewer
.
setFocus
([
nextFocusElement
],
get
KeyboardEventForEditorOpen
());
this
.
viewer
.
setFocus
([
nextFocusElement
],
get
SelectionKeyboardEvent
());
}
this
.
element
.
parent
().
remove
(
<
any
>
this
.
element
);
...
...
@@ -507,7 +506,7 @@ export class ReplaceAllAction extends AbstractSearchAndReplaceAction {
const
nextFocusElement
=
this
.
getElementToFocusAfterRemoved
(
tree
,
this
.
fileMatch
);
return
this
.
fileMatch
.
parent
().
replace
(
this
.
fileMatch
).
then
(()
=>
{
if
(
nextFocusElement
)
{
tree
.
setFocus
([
nextFocusElement
],
get
KeyboardEventForEditorOpen
());
tree
.
setFocus
([
nextFocusElement
],
get
SelectionKeyboardEvent
());
}
tree
.
domFocus
();
...
...
@@ -530,7 +529,7 @@ export class ReplaceAllInFolderAction extends AbstractSearchAndReplaceAction {
const
nextFocusElement
=
this
.
getElementToFocusAfterRemoved
(
this
.
viewer
,
this
.
folderMatch
);
return
this
.
folderMatch
.
replaceAll
().
then
(()
=>
{
if
(
nextFocusElement
)
{
this
.
viewer
.
setFocus
([
nextFocusElement
],
get
KeyboardEventForEditorOpen
());
this
.
viewer
.
setFocus
([
nextFocusElement
],
get
SelectionKeyboardEvent
());
}
this
.
viewer
.
domFocus
();
});
...
...
@@ -555,7 +554,7 @@ export class ReplaceAction extends AbstractSearchAndReplaceAction {
return
this
.
element
.
parent
().
replace
(
this
.
element
).
then
(()
=>
{
const
elementToFocus
=
this
.
getElementToFocusAfterReplace
();
if
(
elementToFocus
)
{
this
.
viewer
.
setFocus
([
elementToFocus
],
get
KeyboardEventForEditorOpen
());
this
.
viewer
.
setFocus
([
elementToFocus
],
get
SelectionKeyboardEvent
());
}
return
this
.
getElementToShowReplacePreview
(
elementToFocus
);
...
...
@@ -748,13 +747,3 @@ export const focusSearchListCommand: ICommandHandler = accessor => {
searchView
.
moveFocusToResults
();
});
};
export
function
getKeyboardEventForEditorOpen
(
options
:
IEditorOptions
=
{}):
KeyboardEvent
{
const
fakeKeyboardEvent
=
new
KeyboardEvent
(
'
keydown
'
);
if
(
options
.
preserveFocus
)
{
// fake double click
(
<
any
>
fakeKeyboardEvent
).
detail
=
2
;
}
return
fakeKeyboardEvent
;
}
src/vs/workbench/contrib/search/browser/searchView.ts
浏览文件 @
c1aeb66a
...
...
@@ -32,7 +32,7 @@ import { IContextMenuService, IContextViewService } from 'vs/platform/contextvie
import
{
IConfirmation
,
IDialogService
}
from
'
vs/platform/dialogs/common/dialogs
'
;
import
{
FileChangesEvent
,
FileChangeType
,
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
TreeResourceNavigator2
,
WorkbenchObjectTree
}
from
'
vs/platform/list/browser/listService
'
;
import
{
TreeResourceNavigator2
,
WorkbenchObjectTree
,
getSelectionKeyboardEvent
}
from
'
vs/platform/list/browser/listService
'
;
import
{
INotificationService
,
Severity
}
from
'
vs/platform/notification/common/notification
'
;
import
{
IProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
IPatternInfo
,
ISearchComplete
,
ISearchConfiguration
,
ISearchConfigurationProperties
,
ISearchHistoryService
,
ISearchHistoryValues
,
ITextQuery
,
SearchErrorCode
,
VIEW_ID
}
from
'
vs/workbench/services/search/common/search
'
;
...
...
@@ -48,7 +48,7 @@ import { IEditor } from 'vs/workbench/common/editor';
import
{
IPanel
}
from
'
vs/workbench/common/panel
'
;
import
{
IViewlet
}
from
'
vs/workbench/common/viewlet
'
;
import
{
ExcludePatternInputWidget
,
PatternInputWidget
}
from
'
vs/workbench/contrib/search/browser/patternInputWidget
'
;
import
{
CancelSearchAction
,
ClearSearchResultsAction
,
CollapseDeepestExpandedLevelAction
,
getKeyboardEventForEditorOpen
,
RefreshAction
}
from
'
vs/workbench/contrib/search/browser/searchActions
'
;
import
{
CancelSearchAction
,
ClearSearchResultsAction
,
CollapseDeepestExpandedLevelAction
,
RefreshAction
}
from
'
vs/workbench/contrib/search/browser/searchActions
'
;
import
{
FileMatchRenderer
,
FolderMatchRenderer
,
MatchRenderer
,
SearchAccessibilityProvider
,
SearchDelegate
,
SearchDND
}
from
'
vs/workbench/contrib/search/browser/searchResultsView
'
;
import
{
ISearchWidgetOptions
,
SearchWidget
}
from
'
vs/workbench/contrib/search/browser/searchWidget
'
;
import
*
as
Constants
from
'
vs/workbench/contrib/search/common/constants
'
;
...
...
@@ -699,7 +699,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
selectCurrentMatch
():
void
{
const
focused
=
this
.
tree
.
getFocus
()[
0
];
const
fakeKeyboardEvent
=
get
KeyboardEventForEditorOpen
({
preserveFocus
:
false
}
);
const
fakeKeyboardEvent
=
get
SelectionKeyboardEvent
(
undefined
,
false
);
this
.
tree
.
setSelection
([
focused
],
fakeKeyboardEvent
);
}
...
...
@@ -734,8 +734,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
// Reveal the newly selected element
if
(
next
)
{
this
.
tree
.
setFocus
([
next
]);
this
.
tree
.
setSelection
([
next
]);
this
.
tree
.
setFocus
([
next
],
getSelectionKeyboardEvent
(
undefined
,
false
));
this
.
tree
.
reveal
(
next
);
this
.
selectCurrentMatchEmitter
.
fire
(
undefined
);
}
...
...
@@ -775,8 +774,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
// Reveal the newly selected element
if
(
prev
)
{
this
.
tree
.
setFocus
([
prev
]);
this
.
tree
.
setSelection
([
prev
]);
this
.
tree
.
setFocus
([
prev
],
getSelectionKeyboardEvent
(
undefined
,
false
));
this
.
tree
.
reveal
(
prev
);
this
.
selectCurrentMatchEmitter
.
fire
(
undefined
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录