Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
262c0afa
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,发现更多精彩内容 >>
提交
262c0afa
编写于
9月 12, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Towards inlining KeyMod
上级
c291a213
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
33 addition
and
23 deletion
+33
-23
build/monaco/monaco.d.ts.recipe
build/monaco/monaco.d.ts.recipe
+1
-2
src/vs/base/common/keyCodes.ts
src/vs/base/common/keyCodes.ts
+16
-19
src/vs/editor/common/standalone/standaloneBase.ts
src/vs/editor/common/standalone/standaloneBase.ts
+15
-1
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+1
-1
未找到文件。
build/monaco/monaco.d.ts.recipe
浏览文件 @
262c0afa
...
...
@@ -39,8 +39,7 @@ declare module monaco {
#include(vs/base/common/winjs.base.d.ts): TValueCallback, ProgressCallback, TPromise
#include(vs/base/common/cancellation): CancellationTokenSource, CancellationToken
#include(vs/base/common/uri): URI
#include(vs/editor/common/standalone/standaloneBase): KeyCode
#include(vs/base/common/keyCodes): KeyMod
#include(vs/editor/common/standalone/standaloneBase): KeyCode, KeyMod
#include(vs/base/common/htmlContent): MarkedString
#include(vs/base/browser/keyboardEvent): IKeyboardEvent
#include(vs/base/browser/mouseEvent): IMouseEvent
...
...
src/vs/base/common/keyCodes.ts
浏览文件 @
262c0afa
...
...
@@ -419,12 +419,13 @@ export namespace KeyCodeUtils {
// 13: 1 bit for alt
// 12: 1 bit for winCtrl
// 0: 12 bits for keyCode (up to a maximum keyCode of 4096. Given we have 83 at this point thats good enough)
const
BIN_CTRLCMD_MASK
=
1
<<
15
;
const
BIN_SHIFT_MASK
=
1
<<
14
;
const
BIN_ALT_MASK
=
1
<<
13
;
const
BIN_WINCTRL_MASK
=
1
<<
12
;
const
BIN_KEYCODE_MASK
=
0x00000fff
;
const
enum
BinaryKeybindingsMask
{
CtrlCmd
=
1
<<
15
,
Shift
=
1
<<
14
,
Alt
=
1
<<
13
,
WinCtrl
=
1
<<
12
,
KeyCode
=
0x00000fff
}
export
class
BinaryKeybindings
{
...
...
@@ -441,37 +442,33 @@ export class BinaryKeybindings {
}
public
static
hasCtrlCmd
(
keybinding
:
number
):
boolean
{
return
(
keybinding
&
B
IN_CTRLCMD_MASK
?
true
:
false
);
return
(
keybinding
&
B
inaryKeybindingsMask
.
CtrlCmd
?
true
:
false
);
}
public
static
hasShift
(
keybinding
:
number
):
boolean
{
return
(
keybinding
&
B
IN_SHIFT_MASK
?
true
:
false
);
return
(
keybinding
&
B
inaryKeybindingsMask
.
Shift
?
true
:
false
);
}
public
static
hasAlt
(
keybinding
:
number
):
boolean
{
return
(
keybinding
&
B
IN_ALT_MASK
?
true
:
false
);
return
(
keybinding
&
B
inaryKeybindingsMask
.
Alt
?
true
:
false
);
}
public
static
hasWinCtrl
(
keybinding
:
number
):
boolean
{
return
(
keybinding
&
B
IN_WINCTRL_MASK
?
true
:
false
);
return
(
keybinding
&
B
inaryKeybindingsMask
.
WinCtrl
?
true
:
false
);
}
public
static
extractKeyCode
(
keybinding
:
number
):
KeyCode
{
return
(
keybinding
&
B
IN_KEYCODE_MASK
);
return
(
keybinding
&
B
inaryKeybindingsMask
.
KeyCode
);
}
}
export
class
KeyMod
{
public
static
CtrlCmd
=
BIN_CTRLCMD_MASK
;
public
static
Shift
=
BIN_SHIFT_MASK
;
public
static
Alt
=
BIN_ALT_MASK
;
public
static
WinCtrl
=
BIN_WINCTRL_MASK
;
public
static
chord
(
firstPart
:
number
,
secondPart
:
number
):
number
{
return
KeyChord
(
firstPart
,
secondPart
);
}
public
static
CtrlCmd
:
number
=
BinaryKeybindingsMask
.
CtrlCmd
;
public
static
Shift
:
number
=
BinaryKeybindingsMask
.
Shift
;
public
static
Alt
:
number
=
BinaryKeybindingsMask
.
Alt
;
public
static
WinCtrl
:
number
=
BinaryKeybindingsMask
.
WinCtrl
;
}
export
function
KeyChord
(
firstPart
:
number
,
secondPart
:
number
):
number
{
...
...
src/vs/editor/common/standalone/standaloneBase.ts
浏览文件 @
262c0afa
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
KeyMod
}
from
'
vs/base/common/keyCodes
'
;
import
{
KeyMod
as
ConstKeyMod
,
KeyChord
}
from
'
vs/base/common/keyCodes
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
Selection
,
SelectionDirection
}
from
'
vs/editor/common/core/selection
'
;
...
...
@@ -14,6 +14,20 @@ import {CancellationTokenSource} from 'vs/base/common/cancellation';
import
Severity
from
'
vs/base/common/severity
'
;
import
URI
from
'
vs/base/common/uri
'
;
// --------------------------------------------
// This is repeated here so it can be exported
// --------------------------------------------
export
class
KeyMod
{
public
static
CtrlCmd
:
number
=
ConstKeyMod
.
CtrlCmd
;
public
static
Shift
:
number
=
ConstKeyMod
.
Shift
;
public
static
Alt
:
number
=
ConstKeyMod
.
Alt
;
public
static
WinCtrl
:
number
=
ConstKeyMod
.
WinCtrl
;
public
static
chord
(
firstPart
:
number
,
secondPart
:
number
):
number
{
return
KeyChord
(
firstPart
,
secondPart
);
}
}
// --------------------------------------------
// This is repeated here so it can be exported
// --------------------------------------------
...
...
src/vs/monaco.d.ts
浏览文件 @
262c0afa
...
...
@@ -170,6 +170,7 @@ declare module monaco {
toJSON
():
any
;
static
revive
(
data
:
any
):
Uri
;
}
/**
* Virtual Key Codes, the value does not hold any inherent meaning.
* Inspired somewhat from https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
...
...
@@ -344,7 +345,6 @@ declare module monaco {
*/
MAX_VALUE
=
109
,
}
export
class
KeyMod
{
static
CtrlCmd
:
number
;
static
Shift
:
number
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录