Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
旅途_2012
vscode
提交
6c61f430
V
vscode
项目概览
旅途_2012
/
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,发现更多精彩内容 >>
提交
6c61f430
编写于
7月 04, 2019
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
history - allow to navigate with mouse buttons 3/4
上级
befa9e6f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
50 addition
and
12 deletion
+50
-12
src/vs/code/electron-main/window.ts
src/vs/code/electron-main/window.ts
+7
-10
src/vs/workbench/browser/workbench.contribution.ts
src/vs/workbench/browser/workbench.contribution.ts
+7
-1
src/vs/workbench/common/editor.ts
src/vs/workbench/common/editor.ts
+1
-0
src/vs/workbench/services/history/browser/history.ts
src/vs/workbench/services/history/browser/history.ts
+35
-1
未找到文件。
src/vs/code/electron-main/window.ts
浏览文件 @
6c61f430
...
...
@@ -373,9 +373,6 @@ export class CodeWindow extends Disposable implements ICodeWindow {
}
});
// App commands support
this
.
registerNavigationListenerOn
(
'
app-command
'
,
'
browser-backward
'
,
'
browser-forward
'
,
false
);
// Window Focus
this
.
_win
.
on
(
'
focus
'
,
()
=>
{
this
.
_lastFocusTime
=
Date
.
now
();
...
...
@@ -466,23 +463,23 @@ export class CodeWindow extends Disposable implements ICodeWindow {
if
(
isMacintosh
)
{
const
config
=
this
.
configurationService
.
getValue
<
IWorkbenchEditorConfiguration
>
();
if
(
config
&&
config
.
workbench
&&
config
.
workbench
.
editor
&&
config
.
workbench
.
editor
.
swipeToNavigate
)
{
this
.
register
NavigationListenerOn
(
'
swipe
'
,
'
left
'
,
'
right
'
,
true
);
this
.
register
SwipeListener
(
);
}
else
{
this
.
_win
.
removeAllListeners
(
'
swipe
'
);
}
}
}
private
register
NavigationListenerOn
(
command
:
'
swipe
'
|
'
app-command
'
,
back
:
'
left
'
|
'
browser-backward
'
,
forward
:
'
right
'
|
'
browser-forward
'
,
acrossEditors
:
boolean
)
{
this
.
_win
.
on
(
command
as
'
swipe
'
/* | 'app-command' */
,
(
e
:
Electron
.
Event
,
cmd
:
string
)
=>
{
private
register
SwipeListener
(
)
{
this
.
_win
.
on
(
'
swipe
'
,
(
event
:
Electron
.
Event
,
cmd
:
string
)
=>
{
if
(
!
this
.
isReady
)
{
return
;
// window must be ready
}
if
(
cmd
===
back
)
{
this
.
send
(
'
vscode:runAction
'
,
{
id
:
acrossEditors
?
'
workbench.action.openPreviousRecentlyUsedEditor
'
:
'
workbench.action.navigateBack
'
,
from
:
'
mouse
'
}
as
IRunActionInWindowRequest
);
}
else
if
(
cmd
===
forward
)
{
this
.
send
(
'
vscode:runAction
'
,
{
id
:
acrossEditors
?
'
workbench.action.openNextRecentlyUsedEditor
'
:
'
workbench.action.navigateForward
'
,
from
:
'
mouse
'
}
as
IRunActionInWindowRequest
);
if
(
cmd
===
'
left
'
)
{
this
.
send
(
'
vscode:runAction
'
,
{
id
:
'
workbench.action.openPreviousRecentlyUsedEditor
'
,
from
:
'
mouse
'
}
as
IRunActionInWindowRequest
);
}
else
if
(
cmd
===
'
right
'
)
{
this
.
send
(
'
vscode:runAction
'
,
{
id
:
'
workbench.action.openNextRecentlyUsedEditor
'
,
from
:
'
mouse
'
}
as
IRunActionInWindowRequest
);
}
});
}
...
...
src/vs/workbench/browser/workbench.contribution.ts
浏览文件 @
6c61f430
...
...
@@ -111,7 +111,13 @@ import { isMacintosh, isWindows, isLinux, isWeb } from 'vs/base/common/platform'
'
type
'
:
'
boolean
'
,
'
description
'
:
nls
.
localize
(
'
swipeToNavigate
'
,
"
Navigate between open files using three-finger swipe horizontally.
"
),
'
default
'
:
false
,
'
included
'
:
isMacintosh
'
included
'
:
isMacintosh
&&
!
isWeb
},
'
workbench.editor.mouseBackForwardToNavigate
'
:
{
'
type
'
:
'
boolean
'
,
'
description
'
:
nls
.
localize
(
'
mouseBackForwardToNavigate
'
,
"
Navigate between open files using mouse buttons four and five if provided.
"
),
'
default
'
:
true
,
'
included
'
:
!
isMacintosh
},
'
workbench.editor.restoreViewState
'
:
{
'
type
'
:
'
boolean
'
,
...
...
src/vs/workbench/common/editor.ts
浏览文件 @
6c61f430
...
...
@@ -987,6 +987,7 @@ interface IEditorPartConfiguration {
closeEmptyGroups
?:
boolean
;
revealIfOpen
?:
boolean
;
swipeToNavigate
?:
boolean
;
mouseBackForwardToNavigate
?:
boolean
;
labelFormat
?:
'
default
'
|
'
short
'
|
'
medium
'
|
'
long
'
;
restoreViewState
?:
boolean
;
}
...
...
src/vs/workbench/services/history/browser/history.ts
浏览文件 @
6c61f430
...
...
@@ -32,6 +32,7 @@ import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/cont
import
{
coalesce
}
from
'
vs/base/common/arrays
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
withNullAsUndefined
}
from
'
vs/base/common/types
'
;
import
{
addDisposableListener
,
EventType
,
EventHelper
}
from
'
vs/base/browser/dom
'
;
/**
* Stores the selection & view state of an editor and allows to compare it to other selection states.
...
...
@@ -140,7 +141,7 @@ export class HistoryService extends Disposable implements IHistoryService {
@
IWindowService
private
readonly
windowService
:
IWindowService
,
@
IInstantiationService
private
readonly
instantiationService
:
IInstantiationService
,
@
IWorkbenchLayoutService
private
readonly
layoutService
:
IWorkbenchLayoutService
,
@
IContextKeyService
private
readonly
contextKeyService
:
IContextKeyService
@
IContextKeyService
private
readonly
contextKeyService
:
IContextKeyService
,
)
{
super
();
...
...
@@ -184,6 +185,39 @@ export class HistoryService extends Disposable implements IHistoryService {
if
(
this
.
editorService
.
activeControl
)
{
this
.
onActiveEditorChanged
();
}
// Mouse back/forward support
const
mouseBackForwardSupportListener
=
this
.
_register
(
new
DisposableStore
());
const
handleMouseBackForwardSupport
=
()
=>
{
mouseBackForwardSupportListener
.
clear
();
if
(
this
.
configurationService
.
getValue
(
'
workbench.editor.mouseBackForwardToNavigate
'
))
{
mouseBackForwardSupportListener
.
add
(
addDisposableListener
(
this
.
layoutService
.
getWorkbenchElement
(),
EventType
.
MOUSE_DOWN
,
e
=>
this
.
onMouseDown
(
e
)));
}
};
this
.
_register
(
this
.
configurationService
.
onDidChangeConfiguration
(
event
=>
{
if
(
event
.
affectsConfiguration
(
'
workbench.editor.mouseBackForwardToNavigate
'
))
{
handleMouseBackForwardSupport
();
}
}));
handleMouseBackForwardSupport
();
}
private
onMouseDown
(
e
:
MouseEvent
):
void
{
// Support to navigate in history when mouse buttons 4/5 are pressed
switch
(
e
.
button
)
{
case
3
:
EventHelper
.
stop
(
e
);
this
.
back
();
break
;
case
4
:
EventHelper
.
stop
(
e
);
this
.
forward
();
break
;
}
}
private
onActiveEditorChanged
():
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录