Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
a20fe852
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
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,发现更多精彩内容 >>
提交
a20fe852
编写于
11月 28, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix list double context menu on windows
related to #31850
上级
a24a9a05
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
27 addition
and
10 deletion
+27
-10
src/vs/base/browser/ui/list/listWidget.ts
src/vs/base/browser/ui/list/listWidget.ts
+18
-10
src/vs/base/common/event.ts
src/vs/base/common/event.ts
+9
-0
未找到文件。
src/vs/base/browser/ui/list/listWidget.ts
浏览文件 @
a20fe852
...
...
@@ -353,14 +353,24 @@ function isSelectionChangeEvent(event: IListMouseEvent<any> | IListTouchEvent<an
class
MouseController
<
T
>
implements
IDisposable
{
private
multipleSelectionSupport
:
boolean
;
private
didJustPressContextMenuKey
:
boolean
=
false
;
private
disposables
:
IDisposable
[]
=
[];
@
memoize
get
onContextMenu
():
Event
<
IListContextMenuEvent
<
T
>>
{
const
fromKey
board
=
chain
(
domEvent
(
this
.
view
.
domNode
,
'
keydown
'
))
const
fromKey
down
=
chain
(
domEvent
(
this
.
view
.
domNode
,
'
keydown
'
))
.
map
(
e
=>
new
StandardKeyboardEvent
(
e
))
.
filter
(
e
=>
this
.
list
.
getFocus
().
length
>
0
)
.
filter
(
e
=>
e
.
keyCode
===
KeyCode
.
ContextMenu
||
(
e
.
shiftKey
&&
e
.
keyCode
===
KeyCode
.
F10
))
.
map
(
e
=>
{
.
filter
(
e
=>
this
.
didJustPressContextMenuKey
=
e
.
keyCode
===
KeyCode
.
ContextMenu
||
(
e
.
shiftKey
&&
e
.
keyCode
===
KeyCode
.
F10
))
.
filter
(
e
=>
{
e
.
preventDefault
();
e
.
stopPropagation
();
return
false
;
})
.
event
as
Event
<
any
>
;
const
fromKeyup
=
chain
(
domEvent
(
this
.
view
.
domNode
,
'
keyup
'
))
.
filter
(()
=>
{
const
didJustPressContextMenuKey
=
this
.
didJustPressContextMenuKey
;
this
.
didJustPressContextMenuKey
=
false
;
return
didJustPressContextMenuKey
;
})
.
filter
(()
=>
this
.
list
.
getFocus
().
length
>
0
)
.
map
(()
=>
{
const
index
=
this
.
list
.
getFocus
()[
0
];
const
element
=
this
.
view
.
element
(
index
);
const
anchor
=
this
.
view
.
domElement
(
index
);
...
...
@@ -370,10 +380,11 @@ class MouseController<T> implements IDisposable {
.
event
;
const
fromMouse
=
chain
(
this
.
view
.
onContextMenu
)
.
filter
(()
=>
!
this
.
didJustPressContextMenuKey
)
.
map
(({
element
,
index
,
browserEvent
})
=>
({
element
,
index
,
anchor
:
{
x
:
browserEvent
.
clientX
+
1
,
y
:
browserEvent
.
clientY
}
}))
.
event
;
return
anyEvent
<
IListContextMenuEvent
<
T
>>
(
fromKey
board
,
fromMouse
);
return
anyEvent
<
IListContextMenuEvent
<
T
>>
(
fromKey
down
,
fromKeyup
,
fromMouse
);
}
constructor
(
...
...
@@ -655,10 +666,7 @@ export class List<T> implements ISpliceable<T>, IDisposable {
return
mapEvent
(
this
.
eventBufferer
.
wrapEvent
(
this
.
selection
.
onChange
),
e
=>
this
.
toListEvent
(
e
));
}
private
_onContextMenu
:
Event
<
IListContextMenuEvent
<
T
>>
=
Event
.
None
;
get
onContextMenu
():
Event
<
IListContextMenuEvent
<
T
>>
{
return
this
.
_onContextMenu
;
}
readonly
onContextMenu
:
Event
<
IListContextMenuEvent
<
T
>>
=
Event
.
None
;
private
_onOpen
=
new
Emitter
<
number
[]
>
();
@
memoize
get
onOpen
():
Event
<
IListEvent
<
T
>>
{
...
...
@@ -731,7 +739,7 @@ export class List<T> implements ISpliceable<T>, IDisposable {
if
(
typeof
options
.
mouseSupport
!==
'
boolean
'
||
options
.
mouseSupport
)
{
const
controller
=
new
MouseController
(
this
,
this
.
view
,
options
);
this
.
disposables
.
push
(
controller
);
this
.
_
onContextMenu
=
controller
.
onContextMenu
;
this
.
onContextMenu
=
controller
.
onContextMenu
;
}
this
.
onFocusChange
(
this
.
_onFocusChange
,
this
,
this
.
disposables
);
...
...
src/vs/base/common/event.ts
浏览文件 @
a20fe852
...
...
@@ -365,6 +365,7 @@ export class EventBufferer {
export
interface
IChainableEvent
<
T
>
{
event
:
Event
<
T
>
;
map
<
O
>
(
fn
:
(
i
:
T
)
=>
O
):
IChainableEvent
<
O
>
;
forEach
(
fn
:
(
i
:
T
)
=>
void
):
IChainableEvent
<
T
>
;
filter
(
fn
:
(
e
:
T
)
=>
boolean
):
IChainableEvent
<
T
>
;
on
(
listener
:
(
e
:
T
)
=>
any
,
thisArgs
?:
any
,
disposables
?:
IDisposable
[]):
IDisposable
;
}
...
...
@@ -373,6 +374,10 @@ export function mapEvent<I, O>(event: Event<I>, map: (i: I) => O): Event<O> {
return
(
listener
,
thisArgs
=
null
,
disposables
?)
=>
event
(
i
=>
listener
.
call
(
thisArgs
,
map
(
i
)),
null
,
disposables
);
}
export
function
forEach
<
I
>
(
event
:
Event
<
I
>
,
each
:
(
i
:
I
)
=>
void
):
Event
<
I
>
{
return
(
listener
,
thisArgs
=
null
,
disposables
?)
=>
event
(
i
=>
{
each
(
i
);
listener
.
call
(
thisArgs
,
i
);
},
null
,
disposables
);
}
export
function
filterEvent
<
T
>
(
event
:
Event
<
T
>
,
filter
:
(
e
:
T
)
=>
boolean
):
Event
<
T
>
{
return
(
listener
,
thisArgs
=
null
,
disposables
?)
=>
event
(
e
=>
filter
(
e
)
&&
listener
.
call
(
thisArgs
,
e
),
null
,
disposables
);
}
...
...
@@ -387,6 +392,10 @@ class ChainableEvent<T> implements IChainableEvent<T> {
return
new
ChainableEvent
(
mapEvent
(
this
.
_event
,
fn
));
}
forEach
(
fn
:
(
i
:
T
)
=>
void
):
IChainableEvent
<
T
>
{
return
new
ChainableEvent
(
forEach
(
this
.
_event
,
fn
));
}
filter
(
fn
:
(
e
:
T
)
=>
boolean
):
IChainableEvent
<
T
>
{
return
new
ChainableEvent
(
filterEvent
(
this
.
_event
,
fn
));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录