Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
d842339c
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,发现更多精彩内容 >>
提交
d842339c
编写于
3月 16, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Assert entire mapping
上级
207686d2
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
1010 addition
and
777 deletion
+1010
-777
src/vs/workbench/services/keybinding/common/keyboardMapper.ts
...vs/workbench/services/keybinding/common/keyboardMapper.ts
+73
-11
src/vs/workbench/services/keybinding/test/keyboardMapper.test.ts
...workbench/services/keybinding/test/keyboardMapper.test.ts
+87
-758
src/vs/workbench/services/keybinding/test/linux_de_ch.js
src/vs/workbench/services/keybinding/test/linux_de_ch.js
+2
-4
src/vs/workbench/services/keybinding/test/linux_de_ch.txt
src/vs/workbench/services/keybinding/test/linux_de_ch.txt
+423
-0
src/vs/workbench/services/keybinding/test/mac_de_ch.js
src/vs/workbench/services/keybinding/test/mac_de_ch.js
+2
-4
src/vs/workbench/services/keybinding/test/mac_de_ch.txt
src/vs/workbench/services/keybinding/test/mac_de_ch.txt
+423
-0
未找到文件。
src/vs/workbench/services/keybinding/common/keyboardMapper.ts
浏览文件 @
d842339c
...
...
@@ -134,6 +134,7 @@ interface IHardwareCodeMapping {
export
class
KeyboardMapper
{
private
readonly
_OS
:
OperatingSystem
;
private
readonly
_codeInfo
:
IHardwareCodeMapping
[];
private
readonly
_hwToKb
:
number
[]
=
[];
private
readonly
_hwToLabel
:
string
[]
=
[];
private
readonly
_kbToHw
:
number
[][]
=
[];
...
...
@@ -154,6 +155,7 @@ export class KeyboardMapper {
}
}
this
.
_codeInfo
=
[];
let
mappings
:
IHardwareCodeMapping
[]
=
[],
mappingsLen
=
0
;
for
(
let
strCode
in
rawMappings
)
{
if
(
rawMappings
.
hasOwnProperty
(
strCode
))
{
...
...
@@ -180,6 +182,7 @@ export class KeyboardMapper {
withShiftAltGr
:
withShiftAltGr
,
};
mappings
[
mappingsLen
++
]
=
mapping
;
this
.
_codeInfo
[
code
]
=
mapping
;
if
(
value
>=
CharCode
.
a
&&
value
<=
CharCode
.
z
)
{
this
.
_hwToLabel
[
code
]
=
String
.
fromCharCode
(
CharCode
.
A
+
(
value
-
CharCode
.
a
));
...
...
@@ -235,19 +238,78 @@ export class KeyboardMapper {
}
}
private
_register
(
hwCtrlKey
:
boolean
,
hwShiftKey
:
boolean
,
hwAltKey
:
boolean
,
code
:
KeyboardEventCode
,
kbCtrlKey
:
boolean
,
kbShiftKey
:
boolean
,
kbAltKey
:
boolean
,
keyCode
:
KeyCode
,
):
void
{
let
hwEncoded
=
this
.
_encode
(
hwCtrlKey
,
hwShiftKey
,
hwAltKey
,
code
);
let
kbEncoded
=
this
.
_encode
(
kbCtrlKey
,
kbShiftKey
,
kbAltKey
,
keyCode
);
public
dumpDebugInfo
():
string
{
let
result
:
string
[]
=
[];
this
.
_hwToKb
[
hwEncoded
]
=
kbEncoded
;
let
cnt
=
0
;
for
(
let
code
=
KeyboardEventCode
.
None
;
code
<
KeyboardEventCode
.
MAX_VALUE
;
code
++
)
{
if
(
IMMUTABLE_CODE_TO_KEY_CODE
[
code
]
!==
-
1
)
{
continue
;
}
if
(
cnt
%
5
===
0
)
{
result
.
push
(
`--------------------------------------------------------------------------------------------------`
);
result
.
push
(
`| HW Code combination | Key | KeyCode combination | UI label |`
);
result
.
push
(
`--------------------------------------------------------------------------------------------------`
);
}
cnt
++
;
const
mapping
=
this
.
_codeInfo
[
code
];
const
strCode
=
KeyboardEventCodeUtils
.
toString
(
code
);
const
uiLabel
=
this
.
_hwToLabel
[
code
];
for
(
let
mod
=
0
;
mod
<
8
;
mod
++
)
{
const
hwCtrlKey
=
(
mod
&
0b0001
)
?
true
:
false
;
const
hwShiftKey
=
(
mod
&
0b0010
)
?
true
:
false
;
const
hwAltKey
=
(
mod
&
0b0100
)
?
true
:
false
;
const
strHw
=
`
${
hwCtrlKey
?
'
Ctrl+
'
:
''
}${
hwShiftKey
?
'
Shift+
'
:
''
}${
hwAltKey
?
'
Alt+
'
:
''
}${
strCode
}
`
;
const
uiHwLabel
=
`
${
hwCtrlKey
?
'
Ctrl+
'
:
''
}${
hwShiftKey
?
'
Shift+
'
:
''
}${
hwAltKey
?
'
Alt+
'
:
''
}${
uiLabel
}
`
;
let
key
=
0
;
if
(
mapping
)
{
if
(
hwCtrlKey
&&
hwShiftKey
&&
hwAltKey
)
{
key
=
mapping
.
withShiftAltGr
;
}
else
if
(
hwCtrlKey
&&
hwAltKey
)
{
key
=
mapping
.
withAltGr
;
}
else
if
(
hwShiftKey
)
{
key
=
mapping
.
withShift
;
}
else
{
key
=
mapping
.
value
;
}
}
let
strKey
:
string
=
'
---
'
;
if
(
key
!==
0
)
{
if
(
key
>=
CharCode
.
U_Combining_Grave_Accent
&&
key
<=
CharCode
.
U_Combining_Latin_Small_Letter_X
)
{
// combining
strKey
=
'
U+
'
+
key
.
toString
(
16
);
}
else
{
strKey
=
'
'
+
String
.
fromCharCode
(
key
)
+
'
'
;
}
}
const
hwEncoded
=
this
.
_encode
(
hwCtrlKey
,
hwShiftKey
,
hwAltKey
,
code
);
const
kbEncoded
=
this
.
_hwToKb
[
hwEncoded
];
const
kbCtrlKey
=
(
kbEncoded
&
0b0001
)
?
true
:
false
;
const
kbShiftKey
=
(
kbEncoded
&
0b0010
)
?
true
:
false
;
const
kbAltKey
=
(
kbEncoded
&
0b0100
)
?
true
:
false
;
const
keyCode
=
(
kbEncoded
>>>
3
);
const
strKb
=
`
${
kbCtrlKey
?
'
Ctrl+
'
:
''
}${
kbShiftKey
?
'
Shift+
'
:
''
}${
kbAltKey
?
'
Alt+
'
:
''
}${
KeyCodeUtils
.
toString
(
keyCode
)}
`
;
result
.
push
(
`|
${
this
.
_leftPad
(
strHw
,
30
)}
|
${
strKey
}
|
${
this
.
_leftPad
(
strKb
,
25
)}
|
${
this
.
_leftPad
(
uiHwLabel
,
25
)}
|`
);
}
}
result
.
push
(
`--------------------------------------------------------------------------------------------------`
);
return
result
.
join
(
'
\n
'
);
}
if
(
keyCode
!==
KeyCode
.
Unknown
)
{
this
.
_kbToHw
[
kbEncoded
]
=
this
.
_kbToHw
[
kbEncoded
]
||
[];
this
.
_kbToHw
[
kbEncoded
].
unshift
(
hwEncoded
)
;
private
_leftPad
(
str
:
string
,
cnt
:
number
):
string
{
while
(
str
.
length
<
cnt
)
{
str
=
'
'
+
str
;
}
return
str
;
}
private
_registerIfUnknown
(
...
...
@@ -293,7 +355,7 @@ export class KeyboardMapper {
hwCtrlKey
:
boolean
,
hwShiftKey
:
boolean
,
hwAltKey
:
boolean
,
code
:
KeyboardEventCode
,
kbShiftKey
:
boolean
,
keyCode
:
KeyCode
,
):
void
{
this
.
_register
(
this
.
_register
IfUnknown
(
hwCtrlKey
,
hwShiftKey
,
hwAltKey
,
code
,
false
,
kbShiftKey
,
false
,
keyCode
);
...
...
src/vs/workbench/services/keybinding/test/keyboardMapper.test.ts
浏览文件 @
d842339c
此差异已折叠。
点击以展开。
src/vs/workbench/services/keybinding/test/linux_de_ch.
t
s
→
src/vs/workbench/services/keybinding/test/linux_de_ch.
j
s
浏览文件 @
d842339c
...
...
@@ -4,9 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
IKeyboardMapping
}
from
'
vs/workbench/services/keybinding/common/keyboardMapper
'
;
export
const
linux_de_ch
:
IKeyboardMapping
=
{
define
({
Sleep
:
{
value
:
''
,
withShift
:
''
,
withAltGr
:
''
,
withShiftAltGr
:
''
},
WakeUp
:
{
value
:
''
,
withShift
:
''
,
withAltGr
:
''
,
withShiftAltGr
:
''
},
KeyA
:
{
...
...
@@ -490,4 +488,4 @@ export const linux_de_ch: IKeyboardMapping = {
MailReply
:
{
value
:
''
,
withShift
:
''
,
withAltGr
:
''
,
withShiftAltGr
:
''
},
MailForward
:
{
value
:
''
,
withShift
:
''
,
withAltGr
:
''
,
withShiftAltGr
:
''
},
MailSend
:
{
value
:
''
,
withShift
:
''
,
withAltGr
:
''
,
withShiftAltGr
:
''
}
};
\ No newline at end of file
});
src/vs/workbench/services/keybinding/test/linux_de_ch.txt
0 → 100644
浏览文件 @
d842339c
此差异已折叠。
点击以展开。
src/vs/workbench/services/keybinding/test/mac_de_ch.
t
s
→
src/vs/workbench/services/keybinding/test/mac_de_ch.
j
s
浏览文件 @
d842339c
...
...
@@ -4,9 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
IKeyboardMapping
}
from
'
vs/workbench/services/keybinding/common/keyboardMapper
'
;
export
const
mac_de_ch
:
IKeyboardMapping
=
{
define
({
Hyper
:
{
value
:
''
,
valueIsDeadKey
:
false
,
...
...
@@ -1917,4 +1915,4 @@ export const mac_de_ch: IKeyboardMapping = {
withShiftAltGr
:
''
,
withShiftAltGrIsDeadKey
:
false
}
};
}
)
;
src/vs/workbench/services/keybinding/test/mac_de_ch.txt
0 → 100644
浏览文件 @
d842339c
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录