Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
978065ad
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,发现更多精彩内容 >>
提交
978065ad
编写于
7月 15, 2016
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Code review
上级
5c28e68b
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
33 addition
and
35 deletion
+33
-35
src/vs/editor/browser/standalone/standaloneEditor.ts
src/vs/editor/browser/standalone/standaloneEditor.ts
+1
-1
src/vs/editor/common/controller/cursor.ts
src/vs/editor/common/controller/cursor.ts
+4
-5
src/vs/editor/common/controller/oneCursor.ts
src/vs/editor/common/controller/oneCursor.ts
+11
-12
src/vs/editor/common/editorCommon.ts
src/vs/editor/common/editorCommon.ts
+8
-8
src/vs/editor/test/common/controller/cursor.test.ts
src/vs/editor/test/common/controller/cursor.test.ts
+6
-6
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+3
-3
未找到文件。
src/vs/editor/browser/standalone/standaloneEditor.ts
浏览文件 @
978065ad
...
...
@@ -433,8 +433,8 @@ export function createMonacoEditorAPI(): typeof monaco.editor {
// vars
EditorType
:
editorCommon
.
EditorType
,
CursorMoveViewPosition
:
editorCommon
.
CursorMoveViewPosition
,
Handler
:
editorCommon
.
Handler
,
ViewPosition
:
editorCommon
.
ViewPosition
,
// consts
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
:
editorCommon
.
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
,
...
...
src/vs/editor/common/controller/cursor.ts
浏览文件 @
978065ad
...
...
@@ -944,7 +944,7 @@ export class Cursor extends EventEmitter {
this
.
_handlers
[
H
.
JumpToBracket
]
=
(
ctx
)
=>
this
.
_jumpToBracket
(
ctx
);
this
.
_handlers
[
H
.
CursorMove
]
=
(
ctx
)
=>
this
.
_
move
(
false
,
ctx
);
this
.
_handlers
[
H
.
CursorMove
]
=
(
ctx
)
=>
this
.
_
cursorMove
(
ctx
);
this
.
_handlers
[
H
.
MoveTo
]
=
(
ctx
)
=>
this
.
_moveTo
(
false
,
ctx
);
this
.
_handlers
[
H
.
MoveToSelect
]
=
(
ctx
)
=>
this
.
_moveTo
(
true
,
ctx
);
this
.
_handlers
[
H
.
ColumnSelect
]
=
(
ctx
)
=>
this
.
_columnSelectMouse
(
ctx
);
...
...
@@ -1093,8 +1093,7 @@ export class Cursor extends EventEmitter {
postOperationRunnable
:
null
,
shouldPushStackElementBefore
:
false
,
shouldPushStackElementAfter
:
false
,
requestScrollDeltaLines
:
0
,
eventData
:
ctx
.
eventData
requestScrollDeltaLines
:
0
};
result
=
callable
(
i
,
cursors
[
i
],
context
)
||
result
;
...
...
@@ -1128,8 +1127,8 @@ export class Cursor extends EventEmitter {
return
this
.
_invokeForAll
(
ctx
,
(
cursorIndex
:
number
,
oneCursor
:
OneCursor
,
oneCtx
:
IOneCursorOperationContext
)
=>
OneCursorOp
.
moveTo
(
oneCursor
,
inSelectionMode
,
ctx
.
eventData
.
position
,
ctx
.
eventData
.
viewPosition
,
ctx
.
eventSource
,
oneCtx
));
}
private
_
move
(
inSelectionMode
:
boolean
,
ctx
:
IMultipleCursorOperationContext
):
boolean
{
return
this
.
_invokeForAll
(
ctx
,
(
cursorIndex
:
number
,
oneCursor
:
OneCursor
,
oneCtx
:
IOneCursorOperationContext
)
=>
OneCursorOp
.
move
(
oneCursor
,
inSelectionMode
,
ctx
.
eventData
.
to
,
ctx
.
eventSource
,
oneCtx
));
private
_
cursorMove
(
ctx
:
IMultipleCursorOperationContext
):
boolean
{
return
this
.
_invokeForAll
(
ctx
,
(
cursorIndex
:
number
,
oneCursor
:
OneCursor
,
oneCtx
:
IOneCursorOperationContext
)
=>
OneCursorOp
.
move
(
oneCursor
,
!!
ctx
.
eventData
.
inSelectionMode
,
ctx
.
eventData
.
to
,
ctx
.
eventSource
,
oneCtx
));
}
private
_columnSelectToLineNumber
:
number
=
0
;
...
...
src/vs/editor/common/controller/oneCursor.ts
浏览文件 @
978065ad
...
...
@@ -6,7 +6,7 @@
import
{
onUnexpectedError
,
illegalArgument
}
from
'
vs/base/common/errors
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
types
=
require
(
'
vs/base/common/types
'
)
;
import
*
as
types
from
'
vs/base/common/types
'
;
import
{
ReplaceCommand
,
ReplaceCommandWithOffsetCursorState
,
ReplaceCommandWithoutChangingPosition
}
from
'
vs/editor/common/commands/replaceCommand
'
;
import
{
ShiftCommand
}
from
'
vs/editor/common/commands/shiftCommand
'
;
import
{
SurroundSelectionCommand
}
from
'
vs/editor/common/commands/surroundSelectionCommand
'
;
...
...
@@ -24,7 +24,6 @@ export interface IPostOperationRunnable {
export
interface
IOneCursorOperationContext
{
cursorPositionChangeReason
:
editorCommon
.
CursorChangeReason
;
eventData
:
any
;
shouldReveal
:
boolean
;
shouldRevealVerticalInCenter
:
boolean
;
shouldRevealHorizontal
:
boolean
;
...
...
@@ -635,16 +634,16 @@ export class OneCursorOp {
return
this
.
move
(
cursor
,
inSelectionMode
,
validatedViewPosition
,
eventSource
,
ctx
);
}
public
static
move
(
cursor
:
OneCursor
,
inSelectionMode
:
boolean
,
to
:
editorCommon
.
IPosition
|
string
,
eventSource
:
string
,
ctx
:
IOneCursorOperationContext
):
boolean
{
public
static
move
(
cursor
:
OneCursor
,
inSelectionMode
:
boolean
,
to
:
editorCommon
.
IPosition
|
string
,
eventSource
:
string
,
ctx
:
IOneCursorOperationContext
):
boolean
{
if
(
!
to
)
{
illegalArgument
(
'
to
'
);
}
if
(
types
.
isString
(
to
))
{
return
this
.
_move
(
cursor
,
inSelectionMode
,
to
,
ctx
);
return
this
.
moveToLogicalViewPosition
(
cursor
,
inSelectionMode
,
to
,
ctx
);
}
let
viewPosition
:
editorCommon
.
IPosition
=
<
editorCommon
.
IPosition
>
to
;
let
viewPosition
:
editorCommon
.
IPosition
=
<
editorCommon
.
IPosition
>
to
;
let
reason
=
(
eventSource
===
'
mouse
'
?
editorCommon
.
CursorChangeReason
.
Explicit
:
editorCommon
.
CursorChangeReason
.
NotSet
);
if
(
eventSource
===
'
api
'
)
{
ctx
.
shouldRevealVerticalInCenter
=
true
;
...
...
@@ -656,24 +655,24 @@ export class OneCursorOp {
return
true
;
}
private
static
_move
(
cursor
:
OneCursor
,
inSelectionMode
:
boolean
,
viewPosition
:
string
,
ctx
:
IOneCursorOperationContext
):
boolean
{
private
static
moveToLogicalViewPosition
(
cursor
:
OneCursor
,
inSelectionMode
:
boolean
,
cursorMoveViewPosition
:
string
,
ctx
:
IOneCursorOperationContext
):
boolean
{
let
validatedViewPosition
=
cursor
.
getValidViewPosition
();
let
viewLineNumber
=
validatedViewPosition
.
lineNumber
;
let
viewColumn
;
switch
(
v
iewPosition
)
{
case
editorCommon
.
ViewPosition
.
LineStart
:
switch
(
cursorMoveV
iewPosition
)
{
case
editorCommon
.
CursorMove
ViewPosition
.
LineStart
:
viewColumn
=
cursor
.
getViewLineMinColumn
(
viewLineNumber
);
break
;
case
editorCommon
.
ViewPosition
.
LineFirstNonWhitespaceCharacter
:
case
editorCommon
.
CursorMove
ViewPosition
.
LineFirstNonWhitespaceCharacter
:
viewColumn
=
cursor
.
getViewLineFirstNonWhiteSpaceColumn
(
viewLineNumber
);
break
;
case
editorCommon
.
ViewPosition
.
Line
Center
:
case
editorCommon
.
CursorMoveViewPosition
.
LineColumn
Center
:
viewColumn
=
cursor
.
getViewLineCenterColumn
(
viewLineNumber
);
break
;
case
editorCommon
.
ViewPosition
.
LineEnd
:
case
editorCommon
.
CursorMove
ViewPosition
.
LineEnd
:
viewColumn
=
cursor
.
getViewLineMaxColumn
(
viewLineNumber
);
break
;
case
editorCommon
.
ViewPosition
.
LineLastNonWhitespaceCharacter
:
case
editorCommon
.
CursorMove
ViewPosition
.
LineLastNonWhitespaceCharacter
:
viewColumn
=
cursor
.
getViewLineLastNonWhiteSpaceColumn
(
viewLineNumber
);
break
;
default
:
...
...
src/vs/editor/common/editorCommon.ts
浏览文件 @
978065ad
...
...
@@ -4,11 +4,11 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
nls
=
require
(
'
vs/nls
'
)
;
import
*
as
nls
from
'
vs/nls
'
;
import
{
IAction
}
from
'
vs/base/common/actions
'
;
import
{
IEventEmitter
,
BulkListenerCallback
}
from
'
vs/base/common/eventEmitter
'
;
import
{
MarkedString
}
from
'
vs/base/common/htmlContent
'
;
import
types
=
require
(
'
vs/base/common/types
'
)
;
import
*
as
types
from
'
vs/base/common/types
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IInstantiationService
,
IConstructorSignature1
,
IConstructorSignature2
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -4167,12 +4167,12 @@ export var EventType = {
};
/**
*
Positions on the view
*
Logical positions in the view for cursor move command.
*/
export
const
ViewPosition
=
{
export
const
CursorMove
ViewPosition
=
{
LineStart
:
'
lineStart
'
,
LineFirstNonWhitespaceCharacter
:
'
lineFirstNonWhitespaceCharacter
'
,
LineC
enter
:
'
line
Center
'
,
LineC
olumnCenter
:
'
lineColumn
Center
'
,
LineEnd
:
'
lineEnd
'
,
LineLastNonWhitespaceCharacter
:
'
lineLastNonWhitespaceCharacter
'
};
...
...
@@ -4185,9 +4185,9 @@ export var CommandDescription= {
description
:
nls
.
localize
(
'
editorCommand.cursorMove.description
'
,
"
Move cursor to a logical position in the view
"
),
args
:
[
{
name
:
'
Logical position argument
'
,
description
:
nls
.
localize
(
'
editorCommand.cursorMove.arg.description
'
,
"
A
logical position in the view
"
),
constraint
:
(
arg
)
=>
types
.
isObject
(
arg
)
&&
types
.
isString
(
arg
.
to
)
name
:
nls
.
localize
(
'
editorCommand.cursorMove.arg.name
'
,
"
Cursor move argument
"
)
,
description
:
nls
.
localize
(
'
editorCommand.cursorMove.arg.description
'
,
"
A
rgument containing mandatory 'to' value and an optional 'inSelectionMode' value. Value of 'to' has to be a defined value in `CursorMoveViewPosition`.
"
),
constraint
:
(
arg
)
=>
types
.
isObject
(
arg
)
&&
types
.
isString
(
arg
.
to
)
&&
(
types
.
isUndefined
(
arg
.
inSelectionMode
)
||
types
.
isBoolean
(
arg
.
inSelectionMode
))
}
]
}
...
...
src/vs/editor/test/common/controller/cursor.test.ts
浏览文件 @
978065ad
...
...
@@ -13,7 +13,7 @@ import {Selection} from 'vs/editor/common/core/selection';
import
{
EndOfLinePreference
,
EventType
,
Handler
,
IPosition
,
ISelection
,
IEditorOptions
,
DefaultEndOfLine
,
ITextModelCreationOptions
,
ICommand
,
ITokenizedModel
,
IEditOperationBuilder
,
ICursorStateComputerData
,
ViewPosition
ITokenizedModel
,
IEditOperationBuilder
,
ICursorStateComputerData
,
CursorMove
ViewPosition
}
from
'
vs/editor/common/editorCommon
'
;
import
{
Model
}
from
'
vs/editor/common/model/model
'
;
import
{
IMode
,
IndentAction
}
from
'
vs/editor/common/modes
'
;
...
...
@@ -37,23 +37,23 @@ function move(cursor: Cursor, args: any) {
}
function
moveToLineStart
(
cursor
:
Cursor
)
{
move
(
cursor
,
{
to
:
ViewPosition
.
LineStart
});
move
(
cursor
,
{
to
:
CursorMove
ViewPosition
.
LineStart
});
}
function
moveToLineFirstNonWhiteSpaceCharacter
(
cursor
:
Cursor
)
{
move
(
cursor
,
{
to
:
ViewPosition
.
LineFirstNonWhitespaceCharacter
});
move
(
cursor
,
{
to
:
CursorMove
ViewPosition
.
LineFirstNonWhitespaceCharacter
});
}
function
moveToLineCenter
(
cursor
:
Cursor
)
{
move
(
cursor
,
{
to
:
ViewPosition
.
Line
Center
});
move
(
cursor
,
{
to
:
CursorMoveViewPosition
.
LineColumn
Center
});
}
function
moveToLineEnd
(
cursor
:
Cursor
)
{
move
(
cursor
,
{
to
:
ViewPosition
.
LineEnd
});
move
(
cursor
,
{
to
:
CursorMove
ViewPosition
.
LineEnd
});
}
function
moveToLineLastNonWhiteSpaceCharacter
(
cursor
:
Cursor
)
{
move
(
cursor
,
{
to
:
ViewPosition
.
LineLastNonWhitespaceCharacter
});
move
(
cursor
,
{
to
:
CursorMove
ViewPosition
.
LineLastNonWhitespaceCharacter
});
}
function
moveToPosition
(
cursor
:
Cursor
,
lineNumber
:
number
,
column
:
number
)
{
...
...
src/vs/monaco.d.ts
浏览文件 @
978065ad
...
...
@@ -3185,12 +3185,12 @@ declare module monaco.editor {
};
/**
*
Positions on the view
*
Logical positions in the view for cursor move command.
*/
export
const
ViewPosition
:
{
export
const
CursorMove
ViewPosition
:
{
LineStart
:
string
;
LineFirstNonWhitespaceCharacter
:
string
;
LineCenter
:
string
;
LineC
olumnC
enter
:
string
;
LineEnd
:
string
;
LineLastNonWhitespaceCharacter
:
string
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录