Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
e9b79682
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,发现更多精彩内容 >>
提交
e9b79682
编写于
3月 10, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Dispatch typing, replace previous char, pasting and cutting through keybinding service
上级
7e9e05bb
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
37 addition
and
10 deletion
+37
-10
src/vs/editor/browser/view/viewController.ts
src/vs/editor/browser/view/viewController.ts
+14
-6
src/vs/editor/browser/view/viewImpl.ts
src/vs/editor/browser/view/viewImpl.ts
+1
-1
src/vs/editor/common/config/config.ts
src/vs/editor/common/config/config.ts
+18
-3
src/vs/editor/common/editorCommon.ts
src/vs/editor/common/editorCommon.ts
+4
-0
未找到文件。
src/vs/editor/browser/view/viewController.ts
浏览文件 @
e9b79682
...
...
@@ -10,41 +10,49 @@ import {Position} from 'vs/editor/common/core/position';
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
Configuration
}
from
'
vs/editor/browser/config/configuration
'
;
import
{
IEditorMouseEvent
,
IViewController
,
IMouseDispatchData
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybindingService
'
;
export
class
ViewController
implements
IViewController
{
private
viewModel
:
editorCommon
.
IViewModel
;
private
configuration
:
Configuration
;
private
outgoingEventBus
:
IEventEmitter
;
constructor
(
viewModel
:
editorCommon
.
IViewModel
,
configuration
:
Configuration
,
outgoingEventBus
:
IEventEmitter
)
{
private
keybindingService
:
IKeybindingService
;
constructor
(
viewModel
:
editorCommon
.
IViewModel
,
configuration
:
Configuration
,
outgoingEventBus
:
IEventEmitter
,
keybindingService
:
IKeybindingService
)
{
this
.
viewModel
=
viewModel
;
this
.
configuration
=
configuration
;
this
.
outgoingEventBus
=
outgoingEventBus
;
this
.
keybindingService
=
keybindingService
;
}
public
paste
(
source
:
string
,
text
:
string
,
pasteOnNewLine
:
boolean
):
void
{
this
.
configuration
.
handlerDispatcher
.
trigger
(
source
,
editorCommon
.
Handler
.
Paste
,
{
this
.
keybindingService
.
executeCommand
(
editorCommon
.
Handler
.
Dispatch
Paste
,
{
text
:
text
,
pasteOnNewLine
:
pasteOnNewLine
,
});
}
public
type
(
source
:
string
,
text
:
string
):
void
{
this
.
configuration
.
handlerDispatcher
.
trigger
(
source
,
editorCommon
.
Handler
.
Type
,
{
this
.
keybindingService
.
executeCommand
(
editorCommon
.
Handler
.
Dispatch
Type
,
{
text
:
text
});
}
public
replacePreviousChar
(
source
:
string
,
text
:
string
,
replaceCharCnt
:
number
):
void
{
this
.
configuration
.
handlerDispatcher
.
trigger
(
source
,
editorCommon
.
Handler
.
ReplacePreviousChar
,
{
this
.
keybindingService
.
executeCommand
(
editorCommon
.
Handler
.
Dispatch
ReplacePreviousChar
,
{
text
:
text
,
replaceCharCnt
:
replaceCharCnt
});
}
public
cut
(
source
:
string
):
void
{
this
.
configuration
.
handlerDispatcher
.
trigger
(
source
,
editorCommon
.
Handler
.
Cut
,
null
);
this
.
keybindingService
.
executeCommand
(
editorCommon
.
Handler
.
DispatchCut
,
{}
);
}
private
_validateViewColumn
(
viewPosition
:
editorCommon
.
IEditorPosition
):
editorCommon
.
IEditorPosition
{
...
...
src/vs/editor/browser/view/viewImpl.ts
浏览文件 @
e9b79682
...
...
@@ -90,7 +90,7 @@ export class View extends ViewEventHandler implements editorBrowser.IView, IDisp
this
.
_renderAnimationFrame
=
null
;
this
.
outgoingEventBus
=
new
EventEmitter
();
var
viewController
=
new
ViewController
(
model
,
configuration
,
this
.
outgoingEventBus
);
var
viewController
=
new
ViewController
(
model
,
configuration
,
this
.
outgoingEventBus
,
keybindingService
);
this
.
listenersToRemove
=
[];
this
.
listenersToDispose
=
[];
...
...
src/vs/editor/common/config/config.ts
浏览文件 @
e9b79682
...
...
@@ -12,6 +12,8 @@ import {ICommandDescriptor, KeybindingsRegistry} from 'vs/platform/keybinding/co
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/common/services/codeEditorService
'
;
const
H
=
editorCommon
.
Handler
;
export
function
findFocusedEditor
(
commandId
:
string
,
accessor
:
ServicesAccessor
,
args
:
any
,
complain
:
boolean
):
editorCommon
.
ICommonCodeEditor
{
var
codeEditorService
=
accessor
.
get
(
ICodeEditorService
);
var
editorId
=
args
.
context
.
editorId
;
...
...
@@ -60,7 +62,7 @@ function triggerEditorHandler(handlerId: string, accessor: ServicesAccessor, arg
});
}
function
registerCoreCommand
(
handlerId
:
string
,
kb
:
IKeybindings
,
weight
:
number
=
KeybindingsRegistry
.
WEIGHT
.
editorCore
(),
context
?:
KbExpr
)
{
function
registerCoreCommand
(
handlerId
:
string
,
kb
:
IKeybindings
,
weight
:
number
=
KeybindingsRegistry
.
WEIGHT
.
editorCore
(),
context
?:
KbExpr
)
:
void
{
var
desc
:
ICommandDescriptor
=
{
id
:
handlerId
,
handler
:
triggerEditorHandler
.
bind
(
null
,
handlerId
),
...
...
@@ -75,6 +77,21 @@ function registerCoreCommand(handlerId: string, kb: IKeybindings, weight: number
KeybindingsRegistry
.
registerCommandDesc
(
desc
);
}
function
registerCoreDispatchCommand
(
dispatchId
:
string
,
handlerId
:
string
)
{
var
desc
:
ICommandDescriptor
=
{
id
:
dispatchId
,
handler
:
triggerEditorHandler
.
bind
(
null
,
handlerId
),
weight
:
KeybindingsRegistry
.
WEIGHT
.
editorCore
(),
context
:
null
,
primary
:
0
};
KeybindingsRegistry
.
registerCommandDesc
(
desc
);
}
registerCoreDispatchCommand
(
H
.
DispatchType
,
H
.
Type
);
registerCoreDispatchCommand
(
H
.
DispatchReplacePreviousChar
,
H
.
ReplacePreviousChar
);
registerCoreDispatchCommand
(
H
.
DispatchPaste
,
H
.
Paste
);
registerCoreDispatchCommand
(
H
.
DispatchCut
,
H
.
Cut
);
function
getMacWordNavigationKB
(
shift
:
boolean
,
key
:
KeyCode
):
number
{
// For macs, word navigation is based on the alt modifier
if
(
shift
)
{
...
...
@@ -93,8 +110,6 @@ function getWordNavigationKB(shift:boolean, key:KeyCode): number {
}
}
var
H
=
editorCommon
.
Handler
;
// https://support.apple.com/en-gb/HT201236
// [ADDED] Control-H Delete the character to the left of the insertion point. Or use Delete.
// [ADDED] Control-D Delete the character to the right of the insertion point. Or use Fn-Delete.
...
...
src/vs/editor/common/editorCommon.ts
浏览文件 @
e9b79682
...
...
@@ -3356,8 +3356,11 @@ export var Handler = {
JumpToBracket
:
'
jumpToBracket
'
,
DispatchType
:
'
dispatchType
'
,
Type
:
'
type
'
,
DispatchReplacePreviousChar
:
'
dispatchReplacePreviousChar
'
,
ReplacePreviousChar
:
'
replacePreviousChar
'
,
DispatchPaste
:
'
dispatchPaste
'
,
Paste
:
'
paste
'
,
Tab
:
'
tab
'
,
...
...
@@ -3375,6 +3378,7 @@ export var Handler = {
RemoveSecondaryCursors
:
'
removeSecondaryCursors
'
,
CancelSelection
:
'
cancelSelection
'
,
DispatchCut
:
'
dispatchCut
'
,
Cut
:
'
cut
'
,
Undo
:
'
undo
'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录