Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b8e63912
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,发现更多精彩内容 >>
提交
b8e63912
编写于
3月 27, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve handling of modifier only key presses in define keybinding widget
上级
b7da8414
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
535 addition
and
35 deletion
+535
-35
src/vs/base/common/keyCodes.ts
src/vs/base/common/keyCodes.ts
+12
-0
src/vs/platform/keybinding/common/keybindingLabels.ts
src/vs/platform/keybinding/common/keybindingLabels.ts
+6
-6
src/vs/platform/keybinding/common/usLayoutResolvedKeybinding.ts
.../platform/keybinding/common/usLayoutResolvedKeybinding.ts
+50
-10
src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.ts
...ench/services/keybinding/common/macLinuxKeyboardMapper.ts
+65
-9
src/vs/workbench/services/keybinding/common/scanCode.ts
src/vs/workbench/services/keybinding/common/scanCode.ts
+12
-0
src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.ts
...bench/services/keybinding/common/windowsKeyboardMapper.ts
+50
-10
src/vs/workbench/services/keybinding/test/macLinuxFallbackKeyboardMapper.test.ts
...es/keybinding/test/macLinuxFallbackKeyboardMapper.test.ts
+56
-0
src/vs/workbench/services/keybinding/test/macLinuxKeyboardMapper.test.ts
...h/services/keybinding/test/macLinuxKeyboardMapper.test.ts
+228
-0
src/vs/workbench/services/keybinding/test/windowsKeyboardMapper.test.ts
...ch/services/keybinding/test/windowsKeyboardMapper.test.ts
+56
-0
未找到文件。
src/vs/base/common/keyCodes.ts
浏览文件 @
b8e63912
...
@@ -514,6 +514,18 @@ export class SimpleKeybinding {
...
@@ -514,6 +514,18 @@ export class SimpleKeybinding {
||
this
.
keyCode
===
KeyCode
.
Shift
||
this
.
keyCode
===
KeyCode
.
Shift
);
);
}
}
/**
* Does this keybinding refer to the key code of a modifier and it also has the modifier flag?
*/
public
isDuplicateModifierCase
():
boolean
{
return
(
(
this
.
ctrlKey
&&
this
.
keyCode
===
KeyCode
.
Ctrl
)
||
(
this
.
shiftKey
&&
this
.
keyCode
===
KeyCode
.
Shift
)
||
(
this
.
altKey
&&
this
.
keyCode
===
KeyCode
.
Alt
)
||
(
this
.
metaKey
&&
this
.
keyCode
===
KeyCode
.
Meta
)
);
}
}
}
export
class
ChordKeybinding
{
export
class
ChordKeybinding
{
...
...
src/vs/platform/keybinding/common/keybindingLabels.ts
浏览文件 @
b8e63912
...
@@ -36,14 +36,14 @@ export class ModifierLabelProvider {
...
@@ -36,14 +36,14 @@ export class ModifierLabelProvider {
}
}
public
toLabel
(
firstPartMod
:
Modifiers
,
firstPartKey
:
string
,
chordPartMod
:
Modifiers
,
chordPartKey
:
string
,
OS
:
OperatingSystem
):
string
{
public
toLabel
(
firstPartMod
:
Modifiers
,
firstPartKey
:
string
,
chordPartMod
:
Modifiers
,
chordPartKey
:
string
,
OS
:
OperatingSystem
):
string
{
if
(
!
firstPartKey
&&
!
chordPartKey
)
{
if
(
firstPartKey
===
null
&&
chordPartKey
===
null
)
{
return
null
;
return
null
;
}
}
return
_asString
(
firstPartMod
,
firstPartKey
,
chordPartMod
,
chordPartKey
,
this
.
_labels
[
OS
]);
return
_asString
(
firstPartMod
,
firstPartKey
,
chordPartMod
,
chordPartKey
,
this
.
_labels
[
OS
]);
}
}
public
toHTMLLabel
(
firstPartMod
:
Modifiers
,
firstPartKey
:
string
,
chordPartMod
:
Modifiers
,
chordPartKey
:
string
,
OS
:
OperatingSystem
):
IHTMLContentElement
[]
{
public
toHTMLLabel
(
firstPartMod
:
Modifiers
,
firstPartKey
:
string
,
chordPartMod
:
Modifiers
,
chordPartKey
:
string
,
OS
:
OperatingSystem
):
IHTMLContentElement
[]
{
if
(
!
firstPartKey
&&
!
chordPartKey
)
{
if
(
firstPartKey
===
null
&&
chordPartKey
===
null
)
{
return
null
;
return
null
;
}
}
return
_asHTML
(
firstPartMod
,
firstPartKey
,
chordPartMod
,
chordPartKey
,
this
.
_labels
[
OS
]);
return
_asHTML
(
firstPartMod
,
firstPartKey
,
chordPartMod
,
chordPartKey
,
this
.
_labels
[
OS
]);
...
@@ -139,7 +139,7 @@ export const UserSettingsLabelProvider = new ModifierLabelProvider(
...
@@ -139,7 +139,7 @@ export const UserSettingsLabelProvider = new ModifierLabelProvider(
);
);
function
_simpleAsString
(
modifiers
:
Modifiers
,
key
:
string
,
labels
:
ModifierLabels
):
string
{
function
_simpleAsString
(
modifiers
:
Modifiers
,
key
:
string
,
labels
:
ModifierLabels
):
string
{
if
(
!
key
)
{
if
(
key
===
null
)
{
return
''
;
return
''
;
}
}
...
@@ -171,7 +171,7 @@ function _simpleAsString(modifiers: Modifiers, key: string, labels: ModifierLabe
...
@@ -171,7 +171,7 @@ function _simpleAsString(modifiers: Modifiers, key: string, labels: ModifierLabe
function
_asString
(
firstPartMod
:
Modifiers
,
firstPartKey
:
string
,
chordPartMod
:
Modifiers
,
chordPartKey
:
string
,
labels
:
ModifierLabels
):
string
{
function
_asString
(
firstPartMod
:
Modifiers
,
firstPartKey
:
string
,
chordPartMod
:
Modifiers
,
chordPartKey
:
string
,
labels
:
ModifierLabels
):
string
{
let
result
=
_simpleAsString
(
firstPartMod
,
firstPartKey
,
labels
);
let
result
=
_simpleAsString
(
firstPartMod
,
firstPartKey
,
labels
);
if
(
chordPartKey
)
{
if
(
chordPartKey
!==
null
)
{
result
+=
'
'
;
result
+=
'
'
;
result
+=
_simpleAsString
(
chordPartMod
,
chordPartKey
,
labels
);
result
+=
_simpleAsString
(
chordPartMod
,
chordPartKey
,
labels
);
}
}
...
@@ -194,7 +194,7 @@ function _pushKey(result: IHTMLContentElement[], str: string, append: string): v
...
@@ -194,7 +194,7 @@ function _pushKey(result: IHTMLContentElement[], str: string, append: string): v
}
}
function
_simpleAsHTML
(
result
:
IHTMLContentElement
[],
modifiers
:
Modifiers
,
key
:
string
,
labels
:
ModifierLabels
):
void
{
function
_simpleAsHTML
(
result
:
IHTMLContentElement
[],
modifiers
:
Modifiers
,
key
:
string
,
labels
:
ModifierLabels
):
void
{
if
(
!
key
)
{
if
(
key
===
null
)
{
return
;
return
;
}
}
...
@@ -223,7 +223,7 @@ function _asHTML(firstPartMod: Modifiers, firstPartKey: string, chordPartMod: Mo
...
@@ -223,7 +223,7 @@ function _asHTML(firstPartMod: Modifiers, firstPartKey: string, chordPartMod: Mo
let
result
:
IHTMLContentElement
[]
=
[];
let
result
:
IHTMLContentElement
[]
=
[];
_simpleAsHTML
(
result
,
firstPartMod
,
firstPartKey
,
labels
);
_simpleAsHTML
(
result
,
firstPartMod
,
firstPartKey
,
labels
);
if
(
chordPartKey
)
{
if
(
chordPartKey
!==
null
)
{
result
.
push
({
result
.
push
({
tagName
:
'
span
'
,
tagName
:
'
span
'
,
text
:
'
'
text
:
'
'
...
...
src/vs/platform/keybinding/common/usLayoutResolvedKeybinding.ts
浏览文件 @
b8e63912
...
@@ -49,21 +49,41 @@ export class USLayoutResolvedKeybinding extends ResolvedKeybinding {
...
@@ -49,21 +49,41 @@ export class USLayoutResolvedKeybinding extends ResolvedKeybinding {
return
KeyCodeUtils
.
toString
(
keyCode
);
return
KeyCodeUtils
.
toString
(
keyCode
);
}
}
private
_getUILabelForKeybinding
(
keybinding
:
SimpleKeybinding
):
string
{
if
(
!
keybinding
)
{
return
null
;
}
if
(
keybinding
.
isDuplicateModifierCase
())
{
return
''
;
}
return
this
.
_keyCodeToUILabel
(
keybinding
.
keyCode
);
}
public
getLabel
():
string
{
public
getLabel
():
string
{
let
firstPart
=
this
.
_
firstPart
?
this
.
_keyCodeToUILabel
(
this
.
_firstPart
.
keyCode
)
:
null
;
let
firstPart
=
this
.
_
getUILabelForKeybinding
(
this
.
_firstPart
)
;
let
chordPart
=
this
.
_
chordPart
?
this
.
_keyCodeToUILabel
(
this
.
_chordPart
.
keyCode
)
:
null
;
let
chordPart
=
this
.
_
getUILabelForKeybinding
(
this
.
_chordPart
)
;
return
UILabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
this
.
_os
);
return
UILabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
this
.
_os
);
}
}
private
_getAriaLabelForKeybinding
(
keybinding
:
SimpleKeybinding
):
string
{
if
(
!
keybinding
)
{
return
null
;
}
if
(
keybinding
.
isDuplicateModifierCase
())
{
return
''
;
}
return
KeyCodeUtils
.
toString
(
keybinding
.
keyCode
);
}
public
getAriaLabel
():
string
{
public
getAriaLabel
():
string
{
let
firstPart
=
this
.
_
firstPart
?
KeyCodeUtils
.
toString
(
this
.
_firstPart
.
keyCode
)
:
null
;
let
firstPart
=
this
.
_
getAriaLabelForKeybinding
(
this
.
_firstPart
)
;
let
chordPart
=
this
.
_
chordPart
?
KeyCodeUtils
.
toString
(
this
.
_chordPart
.
keyCode
)
:
null
;
let
chordPart
=
this
.
_
getAriaLabelForKeybinding
(
this
.
_chordPart
)
;
return
AriaLabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
this
.
_os
);
return
AriaLabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
this
.
_os
);
}
}
public
getHTMLLabel
():
IHTMLContentElement
[]
{
public
getHTMLLabel
():
IHTMLContentElement
[]
{
let
firstPart
=
this
.
_
firstPart
?
this
.
_keyCodeToUILabel
(
this
.
_firstPart
.
keyCode
)
:
null
;
let
firstPart
=
this
.
_
getUILabelForKeybinding
(
this
.
_firstPart
)
;
let
chordPart
=
this
.
_
chordPart
?
this
.
_keyCodeToUILabel
(
this
.
_chordPart
.
keyCode
)
:
null
;
let
chordPart
=
this
.
_
getUILabelForKeybinding
(
this
.
_chordPart
)
;
return
UILabelProvider
.
toHTMLLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
this
.
_os
);
return
UILabelProvider
.
toHTMLLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
this
.
_os
);
}
}
...
@@ -87,21 +107,41 @@ export class USLayoutResolvedKeybinding extends ResolvedKeybinding {
...
@@ -87,21 +107,41 @@ export class USLayoutResolvedKeybinding extends ResolvedKeybinding {
return
KeyCodeUtils
.
toString
(
keyCode
);
return
KeyCodeUtils
.
toString
(
keyCode
);
}
}
private
_getElectronAcceleratorLabelForKeybinding
(
keybinding
:
SimpleKeybinding
):
string
{
if
(
!
keybinding
)
{
return
null
;
}
if
(
keybinding
.
isDuplicateModifierCase
())
{
return
null
;
}
return
this
.
_keyCodeToElectronAccelerator
(
keybinding
.
keyCode
);
}
public
getElectronAccelerator
():
string
{
public
getElectronAccelerator
():
string
{
if
(
this
.
_chordPart
!==
null
)
{
if
(
this
.
_chordPart
!==
null
)
{
// Electron cannot handle chords
// Electron cannot handle chords
return
null
;
return
null
;
}
}
let
firstPart
=
this
.
_
firstPart
?
this
.
_keyCodeToElectronAccelerator
(
this
.
_firstPart
.
keyCode
)
:
null
;
let
firstPart
=
this
.
_
getElectronAcceleratorLabelForKeybinding
(
this
.
_firstPart
)
;
return
ElectronAcceleratorLabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
null
,
null
,
this
.
_os
);
return
ElectronAcceleratorLabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
null
,
null
,
this
.
_os
);
}
}
private
_getUserSettingsLabelForKeybinding
(
keybinding
:
SimpleKeybinding
):
string
{
if
(
!
keybinding
)
{
return
null
;
}
if
(
keybinding
.
isDuplicateModifierCase
())
{
return
''
;
}
return
USER_SETTINGS
.
fromKeyCode
(
keybinding
.
keyCode
);
}
public
getUserSettingsLabel
():
string
{
public
getUserSettingsLabel
():
string
{
let
firstPart
=
this
.
_
firstPart
?
USER_SETTINGS
.
fromKeyCode
(
this
.
_firstPart
.
keyCode
)
:
null
;
let
firstPart
=
this
.
_
getUserSettingsLabelForKeybinding
(
this
.
_firstPart
)
;
let
chordPart
=
this
.
_
chordPart
?
USER_SETTINGS
.
fromKeyCode
(
this
.
_chordPart
.
keyCode
)
:
null
;
let
chordPart
=
this
.
_
getUserSettingsLabelForKeybinding
(
this
.
_chordPart
)
;
let
result
=
UserSettingsLabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
this
.
_os
);
let
result
=
UserSettingsLabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
this
.
_os
);
return
result
.
toLowerCase
(
);
return
(
result
?
result
.
toLowerCase
()
:
result
);
}
}
public
isWYSIWYG
():
boolean
{
public
isWYSIWYG
():
boolean
{
...
...
src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.ts
浏览文件 @
b8e63912
...
@@ -88,37 +88,77 @@ export class NativeResolvedKeybinding extends ResolvedKeybinding {
...
@@ -88,37 +88,77 @@ export class NativeResolvedKeybinding extends ResolvedKeybinding {
this
.
_chordPart
=
chordPart
;
this
.
_chordPart
=
chordPart
;
}
}
private
_getUILabelForScanCodeBinding
(
binding
:
ScanCodeBinding
):
string
{
if
(
!
binding
)
{
return
null
;
}
if
(
binding
.
isDuplicateModifierCase
())
{
return
''
;
}
return
this
.
_mapper
.
getUILabelForScanCode
(
binding
.
scanCode
);
}
public
getLabel
():
string
{
public
getLabel
():
string
{
let
firstPart
=
this
.
_
firstPart
?
this
.
_mapper
.
getUILabelForScanCode
(
this
.
_firstPart
.
scanCode
)
:
null
;
let
firstPart
=
this
.
_
getUILabelForScanCodeBinding
(
this
.
_firstPart
)
;
let
chordPart
=
this
.
_
chordPart
?
this
.
_mapper
.
getUILabelForScanCode
(
this
.
_chordPart
.
scanCode
)
:
null
;
let
chordPart
=
this
.
_
getUILabelForScanCodeBinding
(
this
.
_chordPart
)
;
return
UILabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
this
.
_OS
);
return
UILabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
this
.
_OS
);
}
}
private
_getAriaLabelForScanCodeBinding
(
binding
:
ScanCodeBinding
):
string
{
if
(
!
binding
)
{
return
null
;
}
if
(
binding
.
isDuplicateModifierCase
())
{
return
''
;
}
return
this
.
_mapper
.
getAriaLabelForScanCode
(
binding
.
scanCode
);
}
public
getAriaLabel
():
string
{
public
getAriaLabel
():
string
{
let
firstPart
=
this
.
_
firstPart
?
this
.
_mapper
.
getAriaLabelForScanCode
(
this
.
_firstPart
.
scanCode
)
:
null
;
let
firstPart
=
this
.
_
getAriaLabelForScanCodeBinding
(
this
.
_firstPart
)
;
let
chordPart
=
this
.
_
chordPart
?
this
.
_mapper
.
getAriaLabelForScanCode
(
this
.
_chordPart
.
scanCode
)
:
null
;
let
chordPart
=
this
.
_
getAriaLabelForScanCodeBinding
(
this
.
_chordPart
)
;
return
AriaLabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
this
.
_OS
);
return
AriaLabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
this
.
_OS
);
}
}
public
getHTMLLabel
():
IHTMLContentElement
[]
{
public
getHTMLLabel
():
IHTMLContentElement
[]
{
let
firstPart
=
this
.
_
firstPart
?
this
.
_mapper
.
getUILabelForScanCode
(
this
.
_firstPart
.
scanCode
)
:
null
;
let
firstPart
=
this
.
_
getUILabelForScanCodeBinding
(
this
.
_firstPart
)
;
let
chordPart
=
this
.
_
chordPart
?
this
.
_mapper
.
getUILabelForScanCode
(
this
.
_chordPart
.
scanCode
)
:
null
;
let
chordPart
=
this
.
_
getUILabelForScanCodeBinding
(
this
.
_chordPart
)
;
return
UILabelProvider
.
toHTMLLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
this
.
_OS
);
return
UILabelProvider
.
toHTMLLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
this
.
_OS
);
}
}
private
_getElectronAcceleratorLabelForScanCodeBinding
(
binding
:
ScanCodeBinding
):
string
{
if
(
!
binding
)
{
return
null
;
}
if
(
binding
.
isDuplicateModifierCase
())
{
return
null
;
}
return
this
.
_mapper
.
getElectronLabelForScanCode
(
binding
.
scanCode
);
}
public
getElectronAccelerator
():
string
{
public
getElectronAccelerator
():
string
{
if
(
this
.
_chordPart
!==
null
)
{
if
(
this
.
_chordPart
!==
null
)
{
// Electron cannot handle chords
// Electron cannot handle chords
return
null
;
return
null
;
}
}
let
firstPart
=
this
.
_
firstPart
?
this
.
_mapper
.
getElectronLabelForScanCode
(
this
.
_firstPart
.
scanCode
)
:
null
;
let
firstPart
=
this
.
_
getElectronAcceleratorLabelForScanCodeBinding
(
this
.
_firstPart
)
;
return
ElectronAcceleratorLabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
null
,
null
,
this
.
_OS
);
return
ElectronAcceleratorLabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
null
,
null
,
this
.
_OS
);
}
}
private
_getUserSettingsLabelForScanCodeBinding
(
binding
:
ScanCodeBinding
):
string
{
if
(
!
binding
)
{
return
null
;
}
if
(
binding
.
isDuplicateModifierCase
())
{
return
''
;
}
return
this
.
_mapper
.
getUserSettingsLabel
(
binding
.
scanCode
);
}
public
getUserSettingsLabel
():
string
{
public
getUserSettingsLabel
():
string
{
let
firstPart
=
this
.
_
firstPart
?
this
.
_mapper
.
getUserSettingsLabel
(
this
.
_firstPart
.
scanCode
)
:
null
;
let
firstPart
=
this
.
_
getUserSettingsLabelForScanCodeBinding
(
this
.
_firstPart
)
;
let
chordPart
=
this
.
_
chordPart
?
this
.
_mapper
.
getUserSettingsLabel
(
this
.
_chordPart
.
scanCode
)
:
null
;
let
chordPart
=
this
.
_
getUserSettingsLabelForScanCodeBinding
(
this
.
_chordPart
)
;
return
UserSettingsLabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
this
.
_OS
);
return
UserSettingsLabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
this
.
_OS
);
}
}
...
@@ -488,6 +528,17 @@ export class MacLinuxKeyboardMapper implements IKeyboardMapper {
...
@@ -488,6 +528,17 @@ export class MacLinuxKeyboardMapper implements IKeyboardMapper {
this
.
_scanCodeToLabel
=
[];
this
.
_scanCodeToLabel
=
[];
this
.
_scanCodeToDispatch
=
[];
this
.
_scanCodeToDispatch
=
[];
// Initialize `_scanCodeToLabel`
for
(
let
scanCode
=
ScanCode
.
None
;
scanCode
<
ScanCode
.
MAX_VALUE
;
scanCode
++
)
{
this
.
_scanCodeToLabel
[
scanCode
]
=
null
;
}
// Initialize `_scanCodeToDispatch`
for
(
let
scanCode
=
ScanCode
.
None
;
scanCode
<
ScanCode
.
MAX_VALUE
;
scanCode
++
)
{
this
.
_scanCodeToDispatch
[
scanCode
]
=
null
;
}
// Handle immutable mappings
for
(
let
scanCode
=
ScanCode
.
None
;
scanCode
<
ScanCode
.
MAX_VALUE
;
scanCode
++
)
{
for
(
let
scanCode
=
ScanCode
.
None
;
scanCode
<
ScanCode
.
MAX_VALUE
;
scanCode
++
)
{
const
keyCode
=
IMMUTABLE_CODE_TO_KEY_CODE
[
scanCode
];
const
keyCode
=
IMMUTABLE_CODE_TO_KEY_CODE
[
scanCode
];
if
(
keyCode
!==
-
1
)
{
if
(
keyCode
!==
-
1
)
{
...
@@ -530,6 +581,10 @@ export class MacLinuxKeyboardMapper implements IKeyboardMapper {
...
@@ -530,6 +581,10 @@ export class MacLinuxKeyboardMapper implements IKeyboardMapper {
mappings
[
mappingsLen
++
]
=
mapping
;
mappings
[
mappingsLen
++
]
=
mapping
;
this
.
_codeInfo
[
scanCode
]
=
mapping
;
this
.
_codeInfo
[
scanCode
]
=
mapping
;
if
(
scanCode
===
ScanCode
.
IntlHash
)
{
console
.
log
(
'
here i am
'
);
}
this
.
_scanCodeToDispatch
[
scanCode
]
=
`[
${
ScanCodeUtils
.
toString
(
scanCode
)}
]`
;
this
.
_scanCodeToDispatch
[
scanCode
]
=
`[
${
ScanCodeUtils
.
toString
(
scanCode
)}
]`
;
if
(
value
>=
CharCode
.
a
&&
value
<=
CharCode
.
z
)
{
if
(
value
>=
CharCode
.
a
&&
value
<=
CharCode
.
z
)
{
...
@@ -537,6 +592,7 @@ export class MacLinuxKeyboardMapper implements IKeyboardMapper {
...
@@ -537,6 +592,7 @@ export class MacLinuxKeyboardMapper implements IKeyboardMapper {
}
else
if
(
value
)
{
}
else
if
(
value
)
{
this
.
_scanCodeToLabel
[
scanCode
]
=
String
.
fromCharCode
(
value
);
this
.
_scanCodeToLabel
[
scanCode
]
=
String
.
fromCharCode
(
value
);
}
else
{
}
else
{
console
.
log
(
`_scanCodeToLabel[
${
ScanCodeUtils
.
toString
(
scanCode
)}
] => null.`
);
this
.
_scanCodeToLabel
[
scanCode
]
=
null
;
this
.
_scanCodeToLabel
[
scanCode
]
=
null
;
}
}
}
}
...
...
src/vs/workbench/services/keybinding/common/scanCode.ts
浏览文件 @
b8e63912
...
@@ -238,6 +238,18 @@ export class ScanCodeBinding {
...
@@ -238,6 +238,18 @@ export class ScanCodeBinding {
this
.
metaKey
=
metaKey
;
this
.
metaKey
=
metaKey
;
this
.
scanCode
=
scanCode
;
this
.
scanCode
=
scanCode
;
}
}
/**
* Does this keybinding refer to the key code of a modifier and it also has the modifier flag?
*/
public
isDuplicateModifierCase
():
boolean
{
return
(
(
this
.
ctrlKey
&&
(
this
.
scanCode
===
ScanCode
.
ControlLeft
||
this
.
scanCode
===
ScanCode
.
ControlRight
))
||
(
this
.
shiftKey
&&
(
this
.
scanCode
===
ScanCode
.
ShiftLeft
||
this
.
scanCode
===
ScanCode
.
ShiftRight
))
||
(
this
.
altKey
&&
(
this
.
scanCode
===
ScanCode
.
AltLeft
||
this
.
scanCode
===
ScanCode
.
AltRight
))
||
(
this
.
metaKey
&&
(
this
.
scanCode
===
ScanCode
.
MetaLeft
||
this
.
scanCode
===
ScanCode
.
MetaRight
))
);
}
}
}
(
function
()
{
(
function
()
{
...
...
src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.ts
浏览文件 @
b8e63912
...
@@ -92,21 +92,41 @@ export class WindowsNativeResolvedKeybinding extends ResolvedKeybinding {
...
@@ -92,21 +92,41 @@ export class WindowsNativeResolvedKeybinding extends ResolvedKeybinding {
this
.
_chordPart
=
chordPart
;
this
.
_chordPart
=
chordPart
;
}
}
private
_getUILabelForKeybinding
(
keybinding
:
SimpleKeybinding
):
string
{
if
(
!
keybinding
)
{
return
null
;
}
if
(
keybinding
.
isDuplicateModifierCase
())
{
return
''
;
}
return
this
.
_mapper
.
getUILabelForKeyCode
(
keybinding
.
keyCode
);
}
public
getLabel
():
string
{
public
getLabel
():
string
{
let
firstPart
=
this
.
_
firstPart
?
this
.
_mapper
.
getUILabelForKeyCode
(
this
.
_firstPart
.
keyCode
)
:
null
;
let
firstPart
=
this
.
_
getUILabelForKeybinding
(
this
.
_firstPart
)
;
let
chordPart
=
this
.
_
chordPart
?
this
.
_mapper
.
getUILabelForKeyCode
(
this
.
_chordPart
.
keyCode
)
:
null
;
let
chordPart
=
this
.
_
getUILabelForKeybinding
(
this
.
_chordPart
)
;
return
UILabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
OperatingSystem
.
Windows
);
return
UILabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
OperatingSystem
.
Windows
);
}
}
private
_getAriaLabelForKeybinding
(
keybinding
:
SimpleKeybinding
):
string
{
if
(
!
keybinding
)
{
return
null
;
}
if
(
keybinding
.
isDuplicateModifierCase
())
{
return
''
;
}
return
this
.
_mapper
.
getAriaLabelForKeyCode
(
keybinding
.
keyCode
);
}
public
getAriaLabel
():
string
{
public
getAriaLabel
():
string
{
let
firstPart
=
this
.
_
firstPart
?
this
.
_mapper
.
getAriaLabelForKeyCode
(
this
.
_firstPart
.
keyCode
)
:
null
;
let
firstPart
=
this
.
_
getAriaLabelForKeybinding
(
this
.
_firstPart
)
;
let
chordPart
=
this
.
_
chordPart
?
this
.
_mapper
.
getAriaLabelForKeyCode
(
this
.
_chordPart
.
keyCode
)
:
null
;
let
chordPart
=
this
.
_
getAriaLabelForKeybinding
(
this
.
_chordPart
)
;
return
AriaLabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
OperatingSystem
.
Windows
);
return
AriaLabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
OperatingSystem
.
Windows
);
}
}
public
getHTMLLabel
():
IHTMLContentElement
[]
{
public
getHTMLLabel
():
IHTMLContentElement
[]
{
let
firstPart
=
this
.
_
firstPart
?
this
.
_mapper
.
getUILabelForKeyCode
(
this
.
_firstPart
.
keyCode
)
:
null
;
let
firstPart
=
this
.
_
getUILabelForKeybinding
(
this
.
_firstPart
)
;
let
chordPart
=
this
.
_
chordPart
?
this
.
_mapper
.
getUILabelForKeyCode
(
this
.
_chordPart
.
keyCode
)
:
null
;
let
chordPart
=
this
.
_
getUILabelForKeybinding
(
this
.
_chordPart
)
;
return
UILabelProvider
.
toHTMLLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
OperatingSystem
.
Windows
);
return
UILabelProvider
.
toHTMLLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
OperatingSystem
.
Windows
);
}
}
...
@@ -131,21 +151,41 @@ export class WindowsNativeResolvedKeybinding extends ResolvedKeybinding {
...
@@ -131,21 +151,41 @@ export class WindowsNativeResolvedKeybinding extends ResolvedKeybinding {
return
KeyCodeUtils
.
toString
(
keyCode
);
return
KeyCodeUtils
.
toString
(
keyCode
);
}
}
private
_getElectronAcceleratorLabelForKeybinding
(
keybinding
:
SimpleKeybinding
):
string
{
if
(
!
keybinding
)
{
return
null
;
}
if
(
keybinding
.
isDuplicateModifierCase
())
{
return
null
;
}
return
this
.
_keyCodeToElectronAccelerator
(
keybinding
.
keyCode
);
}
public
getElectronAccelerator
():
string
{
public
getElectronAccelerator
():
string
{
if
(
this
.
_chordPart
!==
null
)
{
if
(
this
.
_chordPart
!==
null
)
{
// Electron cannot handle chords
// Electron cannot handle chords
return
null
;
return
null
;
}
}
let
firstPart
=
this
.
_
firstPart
?
this
.
_keyCodeToElectronAccelerator
(
this
.
_firstPart
.
keyCode
)
:
null
;
let
firstPart
=
this
.
_
getElectronAcceleratorLabelForKeybinding
(
this
.
_firstPart
)
;
return
ElectronAcceleratorLabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
null
,
null
,
OperatingSystem
.
Windows
);
return
ElectronAcceleratorLabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
null
,
null
,
OperatingSystem
.
Windows
);
}
}
private
_getUserSettingsLabelForKeybinding
(
keybinding
:
SimpleKeybinding
):
string
{
if
(
!
keybinding
)
{
return
null
;
}
if
(
keybinding
.
isDuplicateModifierCase
())
{
return
''
;
}
return
USER_SETTINGS
.
fromKeyCode
(
keybinding
.
keyCode
);
}
public
getUserSettingsLabel
():
string
{
public
getUserSettingsLabel
():
string
{
let
firstPart
=
this
.
_
firstPart
?
USER_SETTINGS
.
fromKeyCode
(
this
.
_firstPart
.
keyCode
)
:
null
;
let
firstPart
=
this
.
_
getUserSettingsLabelForKeybinding
(
this
.
_firstPart
)
;
let
chordPart
=
this
.
_
chordPart
?
USER_SETTINGS
.
fromKeyCode
(
this
.
_chordPart
.
keyCode
)
:
null
;
let
chordPart
=
this
.
_
getUserSettingsLabelForKeybinding
(
this
.
_chordPart
)
;
let
result
=
UserSettingsLabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
OperatingSystem
.
Windows
);
let
result
=
UserSettingsLabelProvider
.
toLabel
(
this
.
_firstPart
,
firstPart
,
this
.
_chordPart
,
chordPart
,
OperatingSystem
.
Windows
);
return
result
.
toLowerCase
(
);
return
(
result
?
result
.
toLowerCase
()
:
result
);
}
}
public
isWYSIWYG
():
boolean
{
public
isWYSIWYG
():
boolean
{
...
...
src/vs/workbench/services/keybinding/test/macLinuxFallbackKeyboardMapper.test.ts
浏览文件 @
b8e63912
...
@@ -117,6 +117,34 @@ suite('keyboardMapper - MAC fallback', () => {
...
@@ -117,6 +117,34 @@ suite('keyboardMapper - MAC fallback', () => {
}]
}]
);
);
});
});
test
(
'
resolveKeyboardEvent Modifier only Meta+
'
,
()
=>
{
assertResolveKeyboardEvent
(
mapper
,
{
ctrlKey
:
false
,
shiftKey
:
false
,
altKey
:
false
,
metaKey
:
true
,
keyCode
:
KeyCode
.
Meta
,
code
:
null
},
{
label
:
'
⌘
'
,
ariaLabel
:
'
Command+
'
,
HTMLLabel
:
[
_simpleHTMLLabel
([
'
⌘
'
,
''
])],
electronAccelerator
:
null
,
userSettingsLabel
:
'
cmd+
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
false
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
true
,
dispatchParts
:
[
null
,
null
],
}
);
});
});
});
suite
(
'
keyboardMapper - LINUX fallback
'
,
()
=>
{
suite
(
'
keyboardMapper - LINUX fallback
'
,
()
=>
{
...
@@ -246,4 +274,32 @@ suite('keyboardMapper - LINUX fallback', () => {
...
@@ -246,4 +274,32 @@ suite('keyboardMapper - LINUX fallback', () => {
}]
}]
);
);
});
});
test
(
'
resolveKeyboardEvent Modifier only Ctrl+
'
,
()
=>
{
assertResolveKeyboardEvent
(
mapper
,
{
ctrlKey
:
true
,
shiftKey
:
false
,
altKey
:
false
,
metaKey
:
false
,
keyCode
:
KeyCode
.
Ctrl
,
code
:
null
},
{
label
:
'
Ctrl+
'
,
ariaLabel
:
'
Control+
'
,
HTMLLabel
:
[
_simpleHTMLLabel
([
'
Ctrl
'
,
''
])],
electronAccelerator
:
null
,
userSettingsLabel
:
'
ctrl+
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
null
,
null
],
}
);
});
});
});
src/vs/workbench/services/keybinding/test/macLinuxKeyboardMapper.test.ts
浏览文件 @
b8e63912
...
@@ -415,6 +415,62 @@ suite('keyboardMapper - MAC de_ch', () => {
...
@@ -415,6 +415,62 @@ suite('keyboardMapper - MAC de_ch', () => {
}]
}]
);
);
});
});
test
(
'
resolveKeyboardEvent Modifier only MetaLeft+
'
,
()
=>
{
assertResolveKeyboardEvent
(
mapper
,
{
ctrlKey
:
false
,
shiftKey
:
false
,
altKey
:
false
,
metaKey
:
true
,
keyCode
:
-
1
,
code
:
'
MetaLeft
'
},
{
label
:
'
⌘
'
,
ariaLabel
:
'
Command+
'
,
HTMLLabel
:
[
_simpleHTMLLabel
([
'
⌘
'
,
''
])],
electronAccelerator
:
null
,
userSettingsLabel
:
'
cmd+
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
false
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
true
,
dispatchParts
:
[
null
,
null
],
}
);
});
test
(
'
resolveKeyboardEvent Modifier only MetaRight+
'
,
()
=>
{
assertResolveKeyboardEvent
(
mapper
,
{
ctrlKey
:
false
,
shiftKey
:
false
,
altKey
:
false
,
metaKey
:
true
,
keyCode
:
-
1
,
code
:
'
MetaRight
'
},
{
label
:
'
⌘
'
,
ariaLabel
:
'
Command+
'
,
HTMLLabel
:
[
_simpleHTMLLabel
([
'
⌘
'
,
''
])],
electronAccelerator
:
null
,
userSettingsLabel
:
'
cmd+
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
false
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
true
,
dispatchParts
:
[
null
,
null
],
}
);
});
});
});
suite
(
'
keyboardMapper - MAC en_us
'
,
()
=>
{
suite
(
'
keyboardMapper - MAC en_us
'
,
()
=>
{
...
@@ -432,6 +488,10 @@ suite('keyboardMapper - MAC en_us', () => {
...
@@ -432,6 +488,10 @@ suite('keyboardMapper - MAC en_us', () => {
assertMapping
(
WRITE_FILE_IF_DIFFERENT
,
mapper
,
'
mac_en_us.txt
'
,
done
);
assertMapping
(
WRITE_FILE_IF_DIFFERENT
,
mapper
,
'
mac_en_us.txt
'
,
done
);
});
});
function
_simpleHTMLLabel
(
pieces
:
string
[]):
IHTMLContentElement
{
return
simpleHTMLLabel
(
pieces
,
OperatingSystem
.
Macintosh
);
}
function
_chordHTMLLabel
(
firstPart
:
string
[],
chordPart
:
string
[]):
IHTMLContentElement
{
function
_chordHTMLLabel
(
firstPart
:
string
[],
chordPart
:
string
[]):
IHTMLContentElement
{
return
chordHTMLLabel
(
firstPart
,
chordPart
,
OperatingSystem
.
Macintosh
);
return
chordHTMLLabel
(
firstPart
,
chordPart
,
OperatingSystem
.
Macintosh
);
}
}
...
@@ -457,6 +517,62 @@ suite('keyboardMapper - MAC en_us', () => {
...
@@ -457,6 +517,62 @@ suite('keyboardMapper - MAC en_us', () => {
}]
}]
);
);
});
});
test
(
'
resolveKeyboardEvent Modifier only MetaLeft+
'
,
()
=>
{
assertResolveKeyboardEvent
(
mapper
,
{
ctrlKey
:
false
,
shiftKey
:
false
,
altKey
:
false
,
metaKey
:
true
,
keyCode
:
-
1
,
code
:
'
MetaLeft
'
},
{
label
:
'
⌘
'
,
ariaLabel
:
'
Command+
'
,
HTMLLabel
:
[
_simpleHTMLLabel
([
'
⌘
'
,
''
])],
electronAccelerator
:
null
,
userSettingsLabel
:
'
cmd+
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
false
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
true
,
dispatchParts
:
[
null
,
null
],
}
);
});
test
(
'
resolveKeyboardEvent Modifier only MetaRight+
'
,
()
=>
{
assertResolveKeyboardEvent
(
mapper
,
{
ctrlKey
:
false
,
shiftKey
:
false
,
altKey
:
false
,
metaKey
:
true
,
keyCode
:
-
1
,
code
:
'
MetaRight
'
},
{
label
:
'
⌘
'
,
ariaLabel
:
'
Command+
'
,
HTMLLabel
:
[
_simpleHTMLLabel
([
'
⌘
'
,
''
])],
electronAccelerator
:
null
,
userSettingsLabel
:
'
cmd+
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
false
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
true
,
dispatchParts
:
[
null
,
null
],
}
);
});
});
});
suite
(
'
keyboardMapper - LINUX de_ch
'
,
()
=>
{
suite
(
'
keyboardMapper - LINUX de_ch
'
,
()
=>
{
...
@@ -845,6 +961,62 @@ suite('keyboardMapper - LINUX de_ch', () => {
...
@@ -845,6 +961,62 @@ suite('keyboardMapper - LINUX de_ch', () => {
}]
}]
);
);
});
});
test
(
'
resolveKeyboardEvent Modifier only ControlLeft+
'
,
()
=>
{
assertResolveKeyboardEvent
(
mapper
,
{
ctrlKey
:
true
,
shiftKey
:
false
,
altKey
:
false
,
metaKey
:
false
,
keyCode
:
-
1
,
code
:
'
ControlLeft
'
},
{
label
:
'
Ctrl+
'
,
ariaLabel
:
'
Control+
'
,
HTMLLabel
:
[
_simpleHTMLLabel
([
'
Ctrl
'
,
''
])],
electronAccelerator
:
null
,
userSettingsLabel
:
'
ctrl+
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
null
,
null
],
}
);
});
test
(
'
resolveKeyboardEvent Modifier only ControlRight+
'
,
()
=>
{
assertResolveKeyboardEvent
(
mapper
,
{
ctrlKey
:
true
,
shiftKey
:
false
,
altKey
:
false
,
metaKey
:
false
,
keyCode
:
-
1
,
code
:
'
ControlRight
'
},
{
label
:
'
Ctrl+
'
,
ariaLabel
:
'
Control+
'
,
HTMLLabel
:
[
_simpleHTMLLabel
([
'
Ctrl
'
,
''
])],
electronAccelerator
:
null
,
userSettingsLabel
:
'
ctrl+
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
null
,
null
],
}
);
});
});
});
suite
(
'
keyboardMapper - LINUX en_us
'
,
()
=>
{
suite
(
'
keyboardMapper - LINUX en_us
'
,
()
=>
{
...
@@ -1254,6 +1426,62 @@ suite('keyboardMapper - LINUX en_us', () => {
...
@@ -1254,6 +1426,62 @@ suite('keyboardMapper - LINUX en_us', () => {
}]
}]
);
);
});
});
test
(
'
resolveKeyboardEvent Modifier only ControlLeft+
'
,
()
=>
{
assertResolveKeyboardEvent
(
mapper
,
{
ctrlKey
:
true
,
shiftKey
:
false
,
altKey
:
false
,
metaKey
:
false
,
keyCode
:
-
1
,
code
:
'
ControlLeft
'
},
{
label
:
'
Ctrl+
'
,
ariaLabel
:
'
Control+
'
,
HTMLLabel
:
[
_simpleHTMLLabel
([
'
Ctrl
'
,
''
])],
electronAccelerator
:
null
,
userSettingsLabel
:
'
ctrl+
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
null
,
null
],
}
);
});
test
(
'
resolveKeyboardEvent Modifier only ControlRight+
'
,
()
=>
{
assertResolveKeyboardEvent
(
mapper
,
{
ctrlKey
:
true
,
shiftKey
:
false
,
altKey
:
false
,
metaKey
:
false
,
keyCode
:
-
1
,
code
:
'
ControlRight
'
},
{
label
:
'
Ctrl+
'
,
ariaLabel
:
'
Control+
'
,
HTMLLabel
:
[
_simpleHTMLLabel
([
'
Ctrl
'
,
''
])],
electronAccelerator
:
null
,
userSettingsLabel
:
'
ctrl+
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
null
,
null
],
}
);
});
});
});
function
_assertKeybindingTranslation
(
mapper
:
MacLinuxKeyboardMapper
,
OS
:
OperatingSystem
,
kb
:
number
,
_expected
:
string
|
string
[]):
void
{
function
_assertKeybindingTranslation
(
mapper
:
MacLinuxKeyboardMapper
,
OS
:
OperatingSystem
,
kb
:
number
,
_expected
:
string
|
string
[]):
void
{
...
...
src/vs/workbench/services/keybinding/test/windowsKeyboardMapper.test.ts
浏览文件 @
b8e63912
...
@@ -371,6 +371,34 @@ suite('keyboardMapper - WINDOWS de_ch', () => {
...
@@ -371,6 +371,34 @@ suite('keyboardMapper - WINDOWS de_ch', () => {
}]
}]
);
);
});
});
test
(
'
resolveKeyboardEvent Modifier only Ctrl+
'
,
()
=>
{
assertResolveKeyboardEvent
(
mapper
,
{
ctrlKey
:
true
,
shiftKey
:
false
,
altKey
:
false
,
metaKey
:
false
,
keyCode
:
KeyCode
.
Ctrl
,
code
:
null
},
{
label
:
'
Ctrl+
'
,
ariaLabel
:
'
Control+
'
,
HTMLLabel
:
[
_simpleHTMLLabel
([
'
Ctrl
'
,
''
])],
electronAccelerator
:
null
,
userSettingsLabel
:
'
ctrl+
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
null
,
null
],
}
);
});
});
});
suite
(
'
keyboardMapper - WINDOWS en_us
'
,
()
=>
{
suite
(
'
keyboardMapper - WINDOWS en_us
'
,
()
=>
{
...
@@ -452,4 +480,32 @@ suite('keyboardMapper - WINDOWS en_us', () => {
...
@@ -452,4 +480,32 @@ suite('keyboardMapper - WINDOWS en_us', () => {
}]
}]
);
);
});
});
test
(
'
resolveKeyboardEvent Modifier only Ctrl+
'
,
()
=>
{
assertResolveKeyboardEvent
(
mapper
,
{
ctrlKey
:
true
,
shiftKey
:
false
,
altKey
:
false
,
metaKey
:
false
,
keyCode
:
KeyCode
.
Ctrl
,
code
:
null
},
{
label
:
'
Ctrl+
'
,
ariaLabel
:
'
Control+
'
,
HTMLLabel
:
[
_simpleHTMLLabel
([
'
Ctrl
'
,
''
])],
electronAccelerator
:
null
,
userSettingsLabel
:
'
ctrl+
'
,
isWYSIWYG
:
true
,
isChord
:
false
,
hasCtrlModifier
:
true
,
hasShiftModifier
:
false
,
hasAltModifier
:
false
,
hasMetaModifier
:
false
,
dispatchParts
:
[
null
,
null
],
}
);
});
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录