Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
5b28babf
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,发现更多精彩内容 >>
未验证
提交
5b28babf
编写于
6月 04, 2020
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes #96809: Add sticky argument and have it be false by default
上级
f4287e67
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
51 addition
and
12 deletion
+51
-12
src/vs/editor/browser/controller/coreCommands.ts
src/vs/editor/browser/controller/coreCommands.ts
+35
-1
src/vs/editor/browser/editorExtensions.ts
src/vs/editor/browser/editorExtensions.ts
+5
-0
src/vs/editor/common/controller/cursorMoveCommands.ts
src/vs/editor/common/controller/cursorMoveCommands.ts
+9
-9
src/vs/editor/common/controller/cursorMoveOperations.ts
src/vs/editor/common/controller/cursorMoveOperations.ts
+2
-2
未找到文件。
src/vs/editor/browser/controller/coreCommands.ts
浏览文件 @
5b28babf
...
...
@@ -958,7 +958,7 @@ export namespace CoreNavigationCommands {
viewModel
.
setCursorStates
(
args
.
source
,
CursorChangeReason
.
Explicit
,
CursorMoveCommands
.
moveToEndOfLine
(
viewModel
,
viewModel
.
getCursorStates
(),
this
.
_inSelectionMode
)
CursorMoveCommands
.
moveToEndOfLine
(
viewModel
,
viewModel
.
getCursorStates
(),
this
.
_inSelectionMode
,
args
.
sticky
||
false
)
);
viewModel
.
revealPrimaryCursor
(
args
.
source
,
true
);
}
...
...
@@ -969,10 +969,27 @@ export namespace CoreNavigationCommands {
id
:
'
cursorEnd
'
,
precondition
:
undefined
,
kbOpts
:
{
args
:
{
sticky
:
false
},
weight
:
CORE_WEIGHT
,
kbExpr
:
EditorContextKeys
.
textInputFocus
,
primary
:
KeyCode
.
End
,
mac
:
{
primary
:
KeyCode
.
End
,
secondary
:
[
KeyMod
.
CtrlCmd
|
KeyCode
.
RightArrow
]
}
},
description
:
{
description
:
`Go to End`
,
args
:
[{
name
:
'
args
'
,
schema
:
{
type
:
'
object
'
,
properties
:
{
'
sticky
'
:
{
description
:
nls
.
localize
(
'
stickydesc
'
,
"
Stick to the end even when going to longer lines
"
),
type
:
'
boolean
'
,
default
:
false
}
}
}
}]
}
}));
...
...
@@ -981,10 +998,27 @@ export namespace CoreNavigationCommands {
id
:
'
cursorEndSelect
'
,
precondition
:
undefined
,
kbOpts
:
{
args
:
{
sticky
:
false
},
weight
:
CORE_WEIGHT
,
kbExpr
:
EditorContextKeys
.
textInputFocus
,
primary
:
KeyMod
.
Shift
|
KeyCode
.
End
,
mac
:
{
primary
:
KeyMod
.
Shift
|
KeyCode
.
End
,
secondary
:
[
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyCode
.
RightArrow
]
}
},
description
:
{
description
:
`Select to End`
,
args
:
[{
name
:
'
args
'
,
schema
:
{
type
:
'
object
'
,
properties
:
{
'
sticky
'
:
{
description
:
nls
.
localize
(
'
stickydesc
'
,
"
Stick to the end even when going to longer lines
"
),
type
:
'
boolean
'
,
default
:
false
}
}
}
}]
}
}));
...
...
src/vs/editor/browser/editorExtensions.ts
浏览文件 @
5b28babf
...
...
@@ -43,6 +43,10 @@ export interface IDiffEditorContributionDescription {
export
interface
ICommandKeybindingsOptions
extends
IKeybindings
{
kbExpr
?:
ContextKeyExpression
|
null
;
weight
:
number
;
/**
* the default keybinding arguments
*/
args
?:
any
;
}
export
interface
ICommandMenuOptions
{
menuId
:
MenuId
;
...
...
@@ -96,6 +100,7 @@ export abstract class Command {
id
:
this
.
id
,
handler
:
(
accessor
,
args
)
=>
this
.
runCommand
(
accessor
,
args
),
weight
:
this
.
_kbOpts
.
weight
,
args
:
this
.
_kbOpts
.
args
,
when
:
kbWhen
,
primary
:
this
.
_kbOpts
.
primary
,
secondary
:
this
.
_kbOpts
.
secondary
,
...
...
src/vs/editor/common/controller/cursorMoveCommands.ts
浏览文件 @
5b28babf
...
...
@@ -80,17 +80,17 @@ export class CursorMoveCommands {
);
}
public
static
moveToEndOfLine
(
viewModel
:
IViewModel
,
cursors
:
CursorState
[],
inSelectionMode
:
boolean
):
PartialCursorState
[]
{
public
static
moveToEndOfLine
(
viewModel
:
IViewModel
,
cursors
:
CursorState
[],
inSelectionMode
:
boolean
,
sticky
:
boolean
):
PartialCursorState
[]
{
let
result
:
PartialCursorState
[]
=
[];
for
(
let
i
=
0
,
len
=
cursors
.
length
;
i
<
len
;
i
++
)
{
const
cursor
=
cursors
[
i
];
result
[
i
]
=
this
.
_moveToLineEnd
(
viewModel
,
cursor
,
inSelectionMode
);
result
[
i
]
=
this
.
_moveToLineEnd
(
viewModel
,
cursor
,
inSelectionMode
,
sticky
);
}
return
result
;
}
private
static
_moveToLineEnd
(
viewModel
:
IViewModel
,
cursor
:
CursorState
,
inSelectionMode
:
boolean
):
PartialCursorState
{
private
static
_moveToLineEnd
(
viewModel
:
IViewModel
,
cursor
:
CursorState
,
inSelectionMode
:
boolean
,
sticky
:
boolean
):
PartialCursorState
{
const
viewStatePosition
=
cursor
.
viewState
.
position
;
const
viewModelMaxColumn
=
viewModel
.
getLineMaxColumn
(
viewStatePosition
.
lineNumber
);
const
isEndOfViewLine
=
viewStatePosition
.
column
===
viewModelMaxColumn
;
...
...
@@ -100,21 +100,21 @@ export class CursorMoveCommands {
const
isEndLineOfWrappedLine
=
viewModelMaxColumn
-
viewStatePosition
.
column
===
modelMaxColumn
-
modelStatePosition
.
column
;
if
(
isEndOfViewLine
||
isEndLineOfWrappedLine
)
{
return
this
.
_moveToLineEndByModel
(
viewModel
,
cursor
,
inSelectionMode
);
return
this
.
_moveToLineEndByModel
(
viewModel
,
cursor
,
inSelectionMode
,
sticky
);
}
else
{
return
this
.
_moveToLineEndByView
(
viewModel
,
cursor
,
inSelectionMode
);
return
this
.
_moveToLineEndByView
(
viewModel
,
cursor
,
inSelectionMode
,
sticky
);
}
}
private
static
_moveToLineEndByView
(
viewModel
:
IViewModel
,
cursor
:
CursorState
,
inSelectionMode
:
boolean
):
PartialCursorState
{
private
static
_moveToLineEndByView
(
viewModel
:
IViewModel
,
cursor
:
CursorState
,
inSelectionMode
:
boolean
,
sticky
:
boolean
):
PartialCursorState
{
return
CursorState
.
fromViewState
(
MoveOperations
.
moveToEndOfLine
(
viewModel
.
cursorConfig
,
viewModel
,
cursor
.
viewState
,
inSelectionMode
)
MoveOperations
.
moveToEndOfLine
(
viewModel
.
cursorConfig
,
viewModel
,
cursor
.
viewState
,
inSelectionMode
,
sticky
)
);
}
private
static
_moveToLineEndByModel
(
viewModel
:
IViewModel
,
cursor
:
CursorState
,
inSelectionMode
:
boolean
):
PartialCursorState
{
private
static
_moveToLineEndByModel
(
viewModel
:
IViewModel
,
cursor
:
CursorState
,
inSelectionMode
:
boolean
,
sticky
:
boolean
):
PartialCursorState
{
return
CursorState
.
fromModelState
(
MoveOperations
.
moveToEndOfLine
(
viewModel
.
cursorConfig
,
viewModel
.
model
,
cursor
.
modelState
,
inSelectionMode
)
MoveOperations
.
moveToEndOfLine
(
viewModel
.
cursorConfig
,
viewModel
.
model
,
cursor
.
modelState
,
inSelectionMode
,
sticky
)
);
}
...
...
src/vs/editor/common/controller/cursorMoveOperations.ts
浏览文件 @
5b28babf
...
...
@@ -222,10 +222,10 @@ export class MoveOperations {
return
cursor
.
move
(
inSelectionMode
,
lineNumber
,
column
,
0
);
}
public
static
moveToEndOfLine
(
config
:
CursorConfiguration
,
model
:
ICursorSimpleModel
,
cursor
:
SingleCursorState
,
inSelectionMode
:
boolean
):
SingleCursorState
{
public
static
moveToEndOfLine
(
config
:
CursorConfiguration
,
model
:
ICursorSimpleModel
,
cursor
:
SingleCursorState
,
inSelectionMode
:
boolean
,
sticky
:
boolean
):
SingleCursorState
{
let
lineNumber
=
cursor
.
position
.
lineNumber
;
let
maxColumn
=
model
.
getLineMaxColumn
(
lineNumber
);
return
cursor
.
move
(
inSelectionMode
,
lineNumber
,
maxColumn
,
Constants
.
MAX_SAFE_SMALL_INTEGER
-
maxColumn
);
return
cursor
.
move
(
inSelectionMode
,
lineNumber
,
maxColumn
,
sticky
?
Constants
.
MAX_SAFE_SMALL_INTEGER
-
maxColumn
:
0
);
}
public
static
moveToBeginningOfBuffer
(
config
:
CursorConfiguration
,
model
:
ICursorSimpleModel
,
cursor
:
SingleCursorState
,
inSelectionMode
:
boolean
):
SingleCursorState
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录