Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
460645a1
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,发现更多精彩内容 >>
提交
460645a1
编写于
2月 27, 2019
作者:
S
SteVen Batten
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix russian mnemonics
fixes #69515 fixes #62449
上级
0acb3901
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
15 addition
and
15 deletion
+15
-15
src/vs/base/browser/ui/menu/menu.ts
src/vs/base/browser/ui/menu/menu.ts
+9
-9
src/vs/base/browser/ui/menu/menubar.ts
src/vs/base/browser/ui/menu/menubar.ts
+6
-6
未找到文件。
src/vs/base/browser/ui/menu/menu.ts
浏览文件 @
460645a1
...
...
@@ -8,7 +8,7 @@ import * as nls from 'vs/nls';
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
IActionRunner
,
IAction
,
Action
}
from
'
vs/base/common/actions
'
;
import
{
ActionBar
,
IActionItemProvider
,
ActionsOrientation
,
Separator
,
ActionItem
,
IActionItemOptions
,
BaseActionItem
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
ResolvedKeybinding
,
KeyCode
,
KeyCodeUtils
}
from
'
vs/base/common/keyCodes
'
;
import
{
ResolvedKeybinding
,
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
addClass
,
EventType
,
EventHelper
,
EventLike
,
removeTabIndexAndUpdateFocus
,
isAncestor
,
hasClass
,
addDisposableListener
,
removeClass
,
append
,
$
,
addClasses
,
removeClasses
}
from
'
vs/base/browser/dom
'
;
import
{
StandardKeyboardEvent
}
from
'
vs/base/browser/keyboardEvent
'
;
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
...
...
@@ -20,8 +20,8 @@ import { Event, Emitter } from 'vs/base/common/event';
import
{
AnchorAlignment
}
from
'
vs/base/browser/ui/contextview/contextview
'
;
import
{
isLinux
}
from
'
vs/base/common/platform
'
;
export
const
MENU_MNEMONIC_REGEX
:
RegExp
=
/
\(
&
(
\w)\)
|
(?<
!&
)
&
(\w
)
/
;
export
const
MENU_ESCAPED_MNEMONIC_REGEX
:
RegExp
=
/
(?<
!&
)(?:
&
)(
\w
)
/
;
export
const
MENU_MNEMONIC_REGEX
:
RegExp
=
/
\(
&
(
[^\s
&
])\)
|
(?<
!&
)
&
([^\s
&
]
)
/
;
export
const
MENU_ESCAPED_MNEMONIC_REGEX
:
RegExp
=
/
(?<
!&
)(?:
&
)(
[^\s
&
]
)
/
;
export
interface
IMenuOptions
{
context
?:
any
;
...
...
@@ -56,7 +56,7 @@ interface ISubMenuData {
}
export
class
Menu
extends
ActionBar
{
private
mnemonics
:
Map
<
KeyCode
,
Array
<
MenuActionItem
>>
;
private
mnemonics
:
Map
<
string
,
Array
<
MenuActionItem
>>
;
private
menuDisposables
:
IDisposable
[];
private
scrollableElement
:
DomScrollableElement
;
private
menuElement
:
HTMLElement
;
...
...
@@ -93,7 +93,7 @@ export class Menu extends ActionBar {
if
(
options
.
enableMnemonics
)
{
this
.
menuDisposables
.
push
(
addDisposableListener
(
menuElement
,
EventType
.
KEY_DOWN
,
(
e
)
=>
{
const
key
=
KeyCodeUtils
.
fromString
(
e
.
key
);
const
key
=
e
.
key
.
toLocaleLowerCase
(
);
if
(
this
.
mnemonics
.
has
(
key
))
{
EventHelper
.
stop
(
e
,
true
);
const
actions
=
this
.
mnemonics
.
get
(
key
)
!
;
...
...
@@ -175,7 +175,7 @@ export class Menu extends ActionBar {
parent
:
this
};
this
.
mnemonics
=
new
Map
<
KeyCode
,
Array
<
MenuActionItem
>>
();
this
.
mnemonics
=
new
Map
<
string
,
Array
<
MenuActionItem
>>
();
this
.
push
(
actions
,
{
icon
:
true
,
label
:
true
,
isMenu
:
true
});
...
...
@@ -349,7 +349,7 @@ class MenuActionItem extends BaseActionItem {
private
label
:
HTMLElement
;
private
check
:
HTMLElement
;
private
mnemonic
:
KeyCode
;
private
mnemonic
:
string
;
private
cssClass
:
string
;
protected
menuStyle
:
IMenuStyles
;
...
...
@@ -368,7 +368,7 @@ class MenuActionItem extends BaseActionItem {
if
(
label
)
{
let
matches
=
MENU_MNEMONIC_REGEX
.
exec
(
label
);
if
(
matches
)
{
this
.
mnemonic
=
KeyCodeUtils
.
fromString
((
!!
matches
[
1
]
?
matches
[
1
]
:
matches
[
2
]).
toLocaleLowerCase
()
);
this
.
mnemonic
=
(
!!
matches
[
1
]
?
matches
[
1
]
:
matches
[
2
]).
toLocaleLowerCase
(
);
}
}
}
...
...
@@ -522,7 +522,7 @@ class MenuActionItem extends BaseActionItem {
}
}
getMnemonic
():
KeyCode
{
getMnemonic
():
string
{
return
this
.
mnemonic
;
}
...
...
src/vs/base/browser/ui/menu/menubar.ts
浏览文件 @
460645a1
...
...
@@ -14,7 +14,7 @@ import { cleanMnemonic, IMenuOptions, Menu, MENU_ESCAPED_MNEMONIC_REGEX, MENU_MN
import
{
ActionRunner
,
IAction
,
IActionRunner
}
from
'
vs/base/common/actions
'
;
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
KeyCode
,
KeyCodeUtils
,
ResolvedKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
KeyCode
,
ResolvedKeybinding
}
from
'
vs/base/common/keyCodes
'
;
import
{
Disposable
,
dispose
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
const
$
=
DOM
.
$
;
...
...
@@ -70,7 +70,7 @@ export class MenuBar extends Disposable {
private
openedViaKeyboard
:
boolean
;
private
awaitingAltRelease
:
boolean
;
private
ignoreNextMouseUp
:
boolean
;
private
mnemonics
:
Map
<
KeyCode
,
number
>
;
private
mnemonics
:
Map
<
string
,
number
>
;
private
updatePending
:
boolean
;
private
_focusState
:
MenubarState
;
...
...
@@ -89,7 +89,7 @@ export class MenuBar extends Disposable {
this
.
container
.
attributes
[
'
role
'
]
=
'
menubar
'
;
this
.
menuCache
=
[];
this
.
mnemonics
=
new
Map
<
KeyCode
,
number
>
();
this
.
mnemonics
=
new
Map
<
string
,
number
>
();
this
.
_focusState
=
MenubarState
.
VISIBLE
;
...
...
@@ -110,7 +110,7 @@ export class MenuBar extends Disposable {
this
.
_register
(
DOM
.
addDisposableListener
(
this
.
container
,
DOM
.
EventType
.
KEY_DOWN
,
(
e
)
=>
{
let
event
=
new
StandardKeyboardEvent
(
e
as
KeyboardEvent
);
let
eventHandled
=
true
;
const
key
=
!!
e
.
key
?
KeyCodeUtils
.
fromString
(
e
.
key
)
:
KeyCode
.
Unknown
;
const
key
=
!!
e
.
key
?
e
.
key
.
toLocaleLowerCase
()
:
''
;
if
(
event
.
equals
(
KeyCode
.
LeftArrow
))
{
this
.
focusPrevious
();
...
...
@@ -162,7 +162,7 @@ export class MenuBar extends Disposable {
return
;
}
const
key
=
KeyCodeUtils
.
fromString
(
e
.
key
);
const
key
=
e
.
key
.
toLocaleLowerCase
(
);
if
(
!
this
.
mnemonics
.
has
(
key
))
{
return
;
}
...
...
@@ -505,7 +505,7 @@ export class MenuBar extends Disposable {
}
private
registerMnemonic
(
menuIndex
:
number
,
mnemonic
:
string
):
void
{
this
.
mnemonics
.
set
(
KeyCodeUtils
.
fromString
(
mnemonic
),
menuIndex
);
this
.
mnemonics
.
set
(
mnemonic
.
toLocaleLowerCase
(
),
menuIndex
);
}
private
hideMenubar
():
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录