Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
ef2eaf81
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,发现更多精彩内容 >>
提交
ef2eaf81
编写于
6月 19, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Delete unused code
上级
254d0999
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
2 addition
and
1191 deletion
+2
-1191
src/vs/editor/common/controller/accGenerator.ts
src/vs/editor/common/controller/accGenerator.ts
+0
-194
src/vs/editor/test/common/controller/cursor.test.ts
src/vs/editor/test/common/controller/cursor.test.ts
+2
-996
tslint.json
tslint.json
+0
-1
未找到文件。
src/vs/editor/common/controller/accGenerator.ts
已删除
100644 → 0
浏览文件 @
254d0999
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
export
class
ScreenReaderMessageGenerator
{
public
static
xSelected
(
x
:
string
):
string
{
return
nls
.
localize
(
{
key
:
'
x.selected
'
,
comment
:
[
'
A piece of text was added to the selection (this should be a message suitable for a Screen Reader).
'
]
},
"
{0}
\n
Selected
"
,
x
);
}
public
static
xUnselected
(
x
:
string
):
string
{
return
nls
.
localize
(
{
key
:
'
x.unselected
'
,
comment
:
[
'
A piece of text was removed from the selection (this should be a message suitable for a Screen Reader).
'
]
},
"
{0}
\n
Unselected
"
,
x
);
}
public
static
xCharsSelected
(
x
:
number
):
string
{
return
nls
.
localize
(
{
key
:
'
x.chars.selected
'
,
comment
:
[
'
A large number of characters were added to the selection (this should be a message suitable for a Screen Reader).
'
]
},
"
{0}
\n
Characters selected
"
,
x
);
}
public
static
xCharsUnselected
(
x
:
number
):
string
{
return
nls
.
localize
(
{
key
:
'
x.chars.unselected
'
,
comment
:
[
'
A large number of characters were removed from the selection (this should be a message suitable for a Screen Reader).
'
]
},
"
{0}
\n
Characters unselected
"
,
x
);
}
public
static
generateMessage
(
source
:
string
,
model
:
IModel
,
oldModelId
:
number
,
oldSelection
:
Selection
,
newModelId
:
number
,
newSelection
:
Selection
):
string
{
if
(
oldModelId
===
newModelId
)
{
return
this
.
_cursorChangeMessage
(
source
,
model
,
oldSelection
,
newSelection
);
}
return
'
TODO
'
;
}
private
static
_cursorChangeMessage
(
source
:
string
,
model
:
IModel
,
oldSelection
:
Selection
,
newSelection
:
Selection
):
string
{
if
(
oldSelection
.
equalsRange
(
newSelection
))
{
return
''
;
}
if
(
oldSelection
.
isEmpty
())
{
if
(
newSelection
.
isEmpty
())
{
// ...[]... => ...[]...
return
this
.
_cursorMoveMessage
(
source
,
model
,
oldSelection
.
getPosition
(),
newSelection
.
getPosition
());
}
// ...[]... => ...[x]...:
return
this
.
_cursorSelectedMessage
(
model
,
newSelection
);
}
if
(
newSelection
.
isEmpty
())
{
if
(
oldSelection
.
containsPosition
(
newSelection
.
getPosition
()))
{
// ...a[xy]b... => ...a[]xyb... or ...ax[]yb... or ...axy[]b...
return
this
.
_cursorUnselectedMessage
(
model
,
oldSelection
);
}
// moved away from the old selection and collapsed it
return
this
.
_cursorMoveMessage
(
source
,
model
,
oldSelection
.
getPosition
(),
newSelection
.
getPosition
())
+
'
\n
'
+
this
.
_cursorUnselectedMessage
(
model
,
oldSelection
);
}
// ...[x]... => ...[y]...
if
(
newSelection
.
getStartPosition
().
equals
(
oldSelection
.
getStartPosition
()))
{
// ...a[x]... => ...a[y]...
if
(
newSelection
.
getEndPosition
().
isBefore
(
oldSelection
.
getEndPosition
()))
{
// ...a[xy]... => ...a[x]y...
return
this
.
_cursorUnselectedMessage
(
model
,
new
Range
(
newSelection
.
endLineNumber
,
newSelection
.
endColumn
,
oldSelection
.
endLineNumber
,
oldSelection
.
endColumn
));
}
// ...a[x]y... => ...a[xy]...
return
this
.
_cursorSelectedMessage
(
model
,
new
Range
(
oldSelection
.
endLineNumber
,
oldSelection
.
endColumn
,
newSelection
.
endLineNumber
,
newSelection
.
endColumn
));
}
if
(
newSelection
.
getEndPosition
().
equals
(
oldSelection
.
getEndPosition
()))
{
// ...[x]a... => ...[y]a...
if
(
newSelection
.
getStartPosition
().
isBefore
(
oldSelection
.
getStartPosition
()))
{
// ...y[x]a... => ...[yx]a...
return
this
.
_cursorSelectedMessage
(
model
,
new
Range
(
newSelection
.
startLineNumber
,
newSelection
.
startColumn
,
oldSelection
.
startLineNumber
,
oldSelection
.
startColumn
));
}
// ...[yx]a... => ...y[x]a...
return
this
.
_cursorUnselectedMessage
(
model
,
new
Range
(
oldSelection
.
startLineNumber
,
oldSelection
.
startColumn
,
newSelection
.
startLineNumber
,
newSelection
.
startColumn
));
}
// weird jump
return
this
.
_cursorSelectedMessage
(
model
,
newSelection
)
+
'
\n
'
+
this
.
_cursorUnselectedMessage
(
model
,
oldSelection
);
}
private
static
_cursorMoveMessage
(
source
:
string
,
model
:
IModel
,
oldPosition
:
Position
,
newPosition
:
Position
):
string
{
if
(
source
===
'
moveWordCommand
'
)
{
return
model
.
getValueInRange
(
new
Range
(
oldPosition
.
lineNumber
,
oldPosition
.
column
,
newPosition
.
lineNumber
,
newPosition
.
column
));
}
const
oldLineNumber
=
oldPosition
.
lineNumber
;
const
oldColumn
=
oldPosition
.
column
;
const
newLineNumber
=
newPosition
.
lineNumber
;
const
newColumn
=
newPosition
.
column
;
// check going down via right arrow
if
(
newLineNumber
===
oldLineNumber
+
1
&&
newColumn
===
1
&&
oldColumn
===
model
.
getLineMaxColumn
(
oldLineNumber
))
{
return
this
.
_cursorCharMessage
(
model
,
newPosition
);
}
// check going up via up arrow
if
(
newLineNumber
===
oldLineNumber
-
1
&&
newColumn
===
model
.
getLineMaxColumn
(
newLineNumber
)
&&
oldColumn
===
1
)
{
return
this
.
_cursorCharMessage
(
model
,
newPosition
);
}
const
lineCount
=
model
.
getLineCount
();
if
(
oldLineNumber
!==
newLineNumber
)
{
if
(
newLineNumber
===
lineCount
)
{
// Last line does not have an EOL
return
model
.
getLineContent
(
newLineNumber
);
}
return
model
.
getLineContent
(
newLineNumber
)
+
model
.
getEOL
();
}
return
this
.
_cursorCharMessage
(
model
,
newPosition
);
}
private
static
_cursorCharMessage
(
model
:
IModel
,
position
:
Position
):
string
{
const
lineNumber
=
position
.
lineNumber
;
const
column
=
position
.
column
;
const
maxLineColumn
=
model
.
getLineMaxColumn
(
lineNumber
);
if
(
column
===
maxLineColumn
)
{
const
lineCount
=
model
.
getLineCount
();
if
(
lineNumber
===
lineCount
)
{
// At the end of the file
return
''
;
}
return
model
.
getEOL
();
}
return
model
.
getLineContent
(
lineNumber
).
charAt
(
column
-
1
);
}
private
static
_cursorSelectedMessage
(
model
:
IModel
,
range
:
Range
):
string
{
const
valueLength
=
model
.
getValueLengthInRange
(
range
);
if
(
valueLength
>
512
)
{
return
this
.
xCharsSelected
(
valueLength
);
}
return
this
.
xSelected
(
model
.
getValueInRange
(
range
));
}
private
static
_cursorUnselectedMessage
(
model
:
IModel
,
range
:
Range
):
string
{
const
valueLength
=
model
.
getValueLengthInRange
(
range
);
if
(
valueLength
>
512
)
{
return
this
.
xCharsUnselected
(
valueLength
);
}
return
this
.
xUnselected
(
model
.
getValueInRange
(
range
));
}
}
src/vs/editor/test/common/controller/cursor.test.ts
浏览文件 @
ef2eaf81
此差异已折叠。
点击以展开。
tslint.json
浏览文件 @
ef2eaf81
...
...
@@ -151,7 +151,6 @@
"**/vs/platform/*/common/**"
,
"**/vs/platform/*/test/common/**"
,
"**/vs/editor/common/**"
,
"**/vs/editor/contrib/wordOperations/**"
,
//
TODO@Alex
"**/vs/editor/contrib/folding/common/**"
,
//
TODO@Alex
"**/vs/editor/test/common/**"
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录