Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
6486b193
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,体验更适合开发者的 AI 搜索 >>
提交
6486b193
编写于
4月 04, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix +1 bug (#4905)
上级
a4204583
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
246 addition
and
4 deletion
+246
-4
src/vs/editor/common/controller/cursor.ts
src/vs/editor/common/controller/cursor.ts
+1
-1
src/vs/editor/test/common/controller/cursor.test.ts
src/vs/editor/test/common/controller/cursor.test.ts
+245
-3
未找到文件。
src/vs/editor/common/controller/cursor.ts
浏览文件 @
6486b193
...
...
@@ -1140,7 +1140,7 @@ export class Cursor extends EventEmitter {
private
_columnSelectMouse
(
ctx
:
IMultipleCursorOperationContext
):
boolean
{
let
cursors
=
this
.
cursors
.
getAll
();
let
result
=
OneCursorOp
.
columnSelectMouse
(
cursors
[
0
],
ctx
.
eventData
.
position
,
ctx
.
eventData
.
viewPosition
,
ctx
.
eventData
.
mouseColumn
);
let
result
=
OneCursorOp
.
columnSelectMouse
(
cursors
[
0
],
ctx
.
eventData
.
position
,
ctx
.
eventData
.
viewPosition
,
ctx
.
eventData
.
mouseColumn
-
1
);
ctx
.
shouldRevealTarget
=
(
result
.
reversed
?
RevealTarget
.
TopMost
:
RevealTarget
.
BottomMost
);
ctx
.
shouldReveal
=
true
;
...
...
src/vs/editor/test/common/controller/cursor.test.ts
浏览文件 @
6486b193
...
...
@@ -806,9 +806,9 @@ suite('Editor Controller - Cursor', () => {
});
let
expectedSelections
=
[
new
Selection
(
1
,
7
,
1
,
1
3
),
new
Selection
(
2
,
4
,
2
,
10
),
new
Selection
(
3
,
3
,
3
,
7
),
new
Selection
(
1
,
7
,
1
,
1
2
),
new
Selection
(
2
,
4
,
2
,
9
),
new
Selection
(
3
,
3
,
3
,
6
),
new
Selection
(
4
,
4
,
4
,
4
),
];
...
...
@@ -817,6 +817,248 @@ suite('Editor Controller - Cursor', () => {
cursor
.
dispose
();
model
.
dispose
();
});
test
(
'
issue #4905 - column select is biased to the right
'
,
()
=>
{
let
model
=
new
Model
([
'
var gulp = require("gulp");
'
,
'
var path = require("path");
'
,
'
var rimraf = require("rimraf");
'
,
'
var isarray = require("isarray");
'
,
'
var merge = require("merge-stream");
'
,
'
var concat = require("gulp-concat");
'
,
'
var newer = require("gulp-newer");
'
,
].
join
(
'
\n
'
),
Model
.
DEFAULT_CREATION_OPTIONS
,
null
);
let
cursor
=
new
Cursor
(
1
,
new
MockConfiguration
(
null
),
model
,
null
,
true
);
moveTo
(
cursor
,
1
,
4
,
false
);
cursorEqual
(
cursor
,
1
,
4
);
cursorCommand
(
cursor
,
H
.
ColumnSelect
,
{
position
:
new
Position
(
4
,
1
),
viewPosition
:
new
Position
(
4
,
1
),
mouseColumn
:
1
});
cursorEquals
(
cursor
,
[
new
Selection
(
1
,
4
,
1
,
1
),
new
Selection
(
2
,
4
,
2
,
1
),
new
Selection
(
3
,
4
,
3
,
1
),
new
Selection
(
4
,
4
,
4
,
1
),
]);
cursor
.
dispose
();
model
.
dispose
();
});
test
(
'
column select with keyboard
'
,
()
=>
{
let
model
=
new
Model
([
'
var gulp = require("gulp");
'
,
'
var path = require("path");
'
,
'
var rimraf = require("rimraf");
'
,
'
var isarray = require("isarray");
'
,
'
var merge = require("merge-stream");
'
,
'
var concat = require("gulp-concat");
'
,
'
var newer = require("gulp-newer");
'
,
].
join
(
'
\n
'
),
Model
.
DEFAULT_CREATION_OPTIONS
,
null
);
let
cursor
=
new
Cursor
(
1
,
new
MockConfiguration
(
null
),
model
,
null
,
true
);
moveTo
(
cursor
,
1
,
4
,
false
);
cursorEqual
(
cursor
,
1
,
4
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorEquals
(
cursor
,
[
new
Selection
(
1
,
4
,
1
,
5
)
]);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectDown
);
cursorEquals
(
cursor
,
[
new
Selection
(
1
,
4
,
1
,
5
),
new
Selection
(
2
,
4
,
2
,
5
)
]);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectDown
);
cursorEquals
(
cursor
,
[
new
Selection
(
1
,
4
,
1
,
5
),
new
Selection
(
2
,
4
,
2
,
5
),
new
Selection
(
3
,
4
,
3
,
5
),
]);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectDown
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectDown
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectDown
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectDown
);
cursorEquals
(
cursor
,
[
new
Selection
(
1
,
4
,
1
,
5
),
new
Selection
(
2
,
4
,
2
,
5
),
new
Selection
(
3
,
4
,
3
,
5
),
new
Selection
(
4
,
4
,
4
,
5
),
new
Selection
(
5
,
4
,
5
,
5
),
new
Selection
(
6
,
4
,
6
,
5
),
new
Selection
(
7
,
4
,
7
,
5
),
]);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorEquals
(
cursor
,
[
new
Selection
(
1
,
4
,
1
,
6
),
new
Selection
(
2
,
4
,
2
,
6
),
new
Selection
(
3
,
4
,
3
,
6
),
new
Selection
(
4
,
4
,
4
,
6
),
new
Selection
(
5
,
4
,
5
,
6
),
new
Selection
(
6
,
4
,
6
,
6
),
new
Selection
(
7
,
4
,
7
,
6
),
]);
// 10 times
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorEquals
(
cursor
,
[
new
Selection
(
1
,
4
,
1
,
16
),
new
Selection
(
2
,
4
,
2
,
16
),
new
Selection
(
3
,
4
,
3
,
16
),
new
Selection
(
4
,
4
,
4
,
16
),
new
Selection
(
5
,
4
,
5
,
16
),
new
Selection
(
6
,
4
,
6
,
16
),
new
Selection
(
7
,
4
,
7
,
16
),
]);
// 10 times
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorEquals
(
cursor
,
[
new
Selection
(
1
,
4
,
1
,
26
),
new
Selection
(
2
,
4
,
2
,
26
),
new
Selection
(
3
,
4
,
3
,
26
),
new
Selection
(
4
,
4
,
4
,
26
),
new
Selection
(
5
,
4
,
5
,
26
),
new
Selection
(
6
,
4
,
6
,
26
),
new
Selection
(
7
,
4
,
7
,
26
),
]);
// 2 times => reaching the ending of lines 1 and 2
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorEquals
(
cursor
,
[
new
Selection
(
1
,
4
,
1
,
28
),
new
Selection
(
2
,
4
,
2
,
28
),
new
Selection
(
3
,
4
,
3
,
28
),
new
Selection
(
4
,
4
,
4
,
28
),
new
Selection
(
5
,
4
,
5
,
28
),
new
Selection
(
6
,
4
,
6
,
28
),
new
Selection
(
7
,
4
,
7
,
28
),
]);
// 4 times => reaching the ending of line 3
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorEquals
(
cursor
,
[
new
Selection
(
1
,
4
,
1
,
28
),
new
Selection
(
2
,
4
,
2
,
28
),
new
Selection
(
3
,
4
,
3
,
32
),
new
Selection
(
4
,
4
,
4
,
32
),
new
Selection
(
5
,
4
,
5
,
32
),
new
Selection
(
6
,
4
,
6
,
32
),
new
Selection
(
7
,
4
,
7
,
32
),
]);
// 2 times => reaching the ending of line 4
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorEquals
(
cursor
,
[
new
Selection
(
1
,
4
,
1
,
28
),
new
Selection
(
2
,
4
,
2
,
28
),
new
Selection
(
3
,
4
,
3
,
32
),
new
Selection
(
4
,
4
,
4
,
34
),
new
Selection
(
5
,
4
,
5
,
34
),
new
Selection
(
6
,
4
,
6
,
34
),
new
Selection
(
7
,
4
,
7
,
34
),
]);
// 1 time => reaching the ending of line 7
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorEquals
(
cursor
,
[
new
Selection
(
1
,
4
,
1
,
28
),
new
Selection
(
2
,
4
,
2
,
28
),
new
Selection
(
3
,
4
,
3
,
32
),
new
Selection
(
4
,
4
,
4
,
34
),
new
Selection
(
5
,
4
,
5
,
35
),
new
Selection
(
6
,
4
,
6
,
35
),
new
Selection
(
7
,
4
,
7
,
35
),
]);
// 3 times => reaching the ending of lines 5 & 6
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorEquals
(
cursor
,
[
new
Selection
(
1
,
4
,
1
,
28
),
new
Selection
(
2
,
4
,
2
,
28
),
new
Selection
(
3
,
4
,
3
,
32
),
new
Selection
(
4
,
4
,
4
,
34
),
new
Selection
(
5
,
4
,
5
,
37
),
new
Selection
(
6
,
4
,
6
,
37
),
new
Selection
(
7
,
4
,
7
,
35
),
]);
// cannot go anywhere anymore
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorEquals
(
cursor
,
[
new
Selection
(
1
,
4
,
1
,
28
),
new
Selection
(
2
,
4
,
2
,
28
),
new
Selection
(
3
,
4
,
3
,
32
),
new
Selection
(
4
,
4
,
4
,
34
),
new
Selection
(
5
,
4
,
5
,
37
),
new
Selection
(
6
,
4
,
6
,
37
),
new
Selection
(
7
,
4
,
7
,
35
),
]);
// cannot go anywhere anymore even if we insist
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorCommand
(
cursor
,
H
.
CursorColumnSelectRight
);
cursorEquals
(
cursor
,
[
new
Selection
(
1
,
4
,
1
,
28
),
new
Selection
(
2
,
4
,
2
,
28
),
new
Selection
(
3
,
4
,
3
,
32
),
new
Selection
(
4
,
4
,
4
,
34
),
new
Selection
(
5
,
4
,
5
,
37
),
new
Selection
(
6
,
4
,
6
,
37
),
new
Selection
(
7
,
4
,
7
,
35
),
]);
// can easily go back
cursorCommand
(
cursor
,
H
.
CursorColumnSelectLeft
);
cursorEquals
(
cursor
,
[
new
Selection
(
1
,
4
,
1
,
28
),
new
Selection
(
2
,
4
,
2
,
28
),
new
Selection
(
3
,
4
,
3
,
32
),
new
Selection
(
4
,
4
,
4
,
34
),
new
Selection
(
5
,
4
,
5
,
36
),
new
Selection
(
6
,
4
,
6
,
36
),
new
Selection
(
7
,
4
,
7
,
35
),
]);
cursor
.
dispose
();
model
.
dispose
();
});
});
class
TestMode
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录