Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
434bc801
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,发现更多精彩内容 >>
未验证
提交
434bc801
编写于
11月 29, 2019
作者:
I
Isidor Nikolic
提交者:
GitHub
11月 29, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #85822 from microsoft/isidorn/linesPerPage
editor.accessibilityLinesPerPage
上级
113bced5
01949268
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
27 addition
and
15 deletion
+27
-15
src/vs/editor/browser/controller/textAreaHandler.ts
src/vs/editor/browser/controller/textAreaHandler.ts
+4
-1
src/vs/editor/browser/controller/textAreaState.ts
src/vs/editor/browser/controller/textAreaState.ts
+10
-12
src/vs/editor/common/config/editorOptions.ts
src/vs/editor/common/config/editorOptions.ts
+7
-0
src/vs/editor/test/browser/controller/imeTester.ts
src/vs/editor/test/browser/controller/imeTester.ts
+1
-1
src/vs/editor/test/browser/controller/textAreaState.test.ts
src/vs/editor/test/browser/controller/textAreaState.test.ts
+1
-1
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+4
-0
未找到文件。
src/vs/editor/browser/controller/textAreaHandler.ts
浏览文件 @
434bc801
...
...
@@ -62,6 +62,7 @@ export class TextAreaHandler extends ViewPart {
private
_scrollTop
:
number
;
private
_accessibilitySupport
:
AccessibilitySupport
;
private
_accessibilityPageSize
:
number
;
private
_contentLeft
:
number
;
private
_contentWidth
:
number
;
private
_contentHeight
:
number
;
...
...
@@ -92,6 +93,7 @@ export class TextAreaHandler extends ViewPart {
const
layoutInfo
=
options
.
get
(
EditorOption
.
layoutInfo
);
this
.
_accessibilitySupport
=
options
.
get
(
EditorOption
.
accessibilitySupport
);
this
.
_accessibilityPageSize
=
options
.
get
(
EditorOption
.
accessibilityPageSize
);
this
.
_contentLeft
=
layoutInfo
.
contentLeft
;
this
.
_contentWidth
=
layoutInfo
.
contentWidth
;
this
.
_contentHeight
=
layoutInfo
.
contentHeight
;
...
...
@@ -189,7 +191,7 @@ export class TextAreaHandler extends ViewPart {
return
TextAreaState
.
EMPTY
;
}
return
PagedScreenReaderStrategy
.
fromEditorSelection
(
currentState
,
simpleModel
,
this
.
_selections
[
0
],
this
.
_accessibilitySupport
===
AccessibilitySupport
.
Unknown
);
return
PagedScreenReaderStrategy
.
fromEditorSelection
(
currentState
,
simpleModel
,
this
.
_selections
[
0
],
this
.
_accessibility
PageSize
,
this
.
_accessibility
Support
===
AccessibilitySupport
.
Unknown
);
},
deduceModelPosition
:
(
viewAnchorPosition
:
Position
,
deltaOffset
:
number
,
lineFeedCnt
:
number
):
Position
=>
{
...
...
@@ -341,6 +343,7 @@ export class TextAreaHandler extends ViewPart {
const
layoutInfo
=
options
.
get
(
EditorOption
.
layoutInfo
);
this
.
_accessibilitySupport
=
options
.
get
(
EditorOption
.
accessibilitySupport
);
this
.
_accessibilityPageSize
=
options
.
get
(
EditorOption
.
accessibilityPageSize
);
this
.
_contentLeft
=
layoutInfo
.
contentLeft
;
this
.
_contentWidth
=
layoutInfo
.
contentWidth
;
this
.
_contentHeight
=
layoutInfo
.
contentHeight
;
...
...
src/vs/editor/browser/controller/textAreaState.ts
浏览文件 @
434bc801
...
...
@@ -226,26 +226,24 @@ export class TextAreaState {
}
export
class
PagedScreenReaderStrategy
{
private
static
readonly
_LINES_PER_PAGE
=
10
;
private
static
_getPageOfLine
(
lineNumber
:
number
):
number
{
return
Math
.
floor
((
lineNumber
-
1
)
/
PagedScreenReaderStrategy
.
_LINES_PER_PAGE
);
private
static
_getPageOfLine
(
lineNumber
:
number
,
linesPerPage
:
number
):
number
{
return
Math
.
floor
((
lineNumber
-
1
)
/
linesPerPage
);
}
private
static
_getRangeForPage
(
page
:
number
):
Range
{
const
offset
=
page
*
PagedScreenReaderStrategy
.
_LINES_PER_PAGE
;
private
static
_getRangeForPage
(
page
:
number
,
linesPerPage
:
number
):
Range
{
const
offset
=
page
*
linesPerPage
;
const
startLineNumber
=
offset
+
1
;
const
endLineNumber
=
offset
+
PagedScreenReaderStrategy
.
_LINES_PER_PAGE
;
const
endLineNumber
=
offset
+
linesPerPage
;
return
new
Range
(
startLineNumber
,
1
,
endLineNumber
+
1
,
1
);
}
public
static
fromEditorSelection
(
previousState
:
TextAreaState
,
model
:
ISimpleModel
,
selection
:
Range
,
trimLongText
:
boolean
):
TextAreaState
{
public
static
fromEditorSelection
(
previousState
:
TextAreaState
,
model
:
ISimpleModel
,
selection
:
Range
,
linesPerPage
:
number
,
trimLongText
:
boolean
):
TextAreaState
{
const
selectionStartPage
=
PagedScreenReaderStrategy
.
_getPageOfLine
(
selection
.
startLineNumber
);
const
selectionStartPageRange
=
PagedScreenReaderStrategy
.
_getRangeForPage
(
selectionStartPage
);
const
selectionStartPage
=
PagedScreenReaderStrategy
.
_getPageOfLine
(
selection
.
startLineNumber
,
linesPerPage
);
const
selectionStartPageRange
=
PagedScreenReaderStrategy
.
_getRangeForPage
(
selectionStartPage
,
linesPerPage
);
const
selectionEndPage
=
PagedScreenReaderStrategy
.
_getPageOfLine
(
selection
.
endLineNumber
);
const
selectionEndPageRange
=
PagedScreenReaderStrategy
.
_getRangeForPage
(
selectionEndPage
);
const
selectionEndPage
=
PagedScreenReaderStrategy
.
_getPageOfLine
(
selection
.
endLineNumber
,
linesPerPage
);
const
selectionEndPageRange
=
PagedScreenReaderStrategy
.
_getRangeForPage
(
selectionEndPage
,
linesPerPage
);
const
pretextRange
=
selectionStartPageRange
.
intersectRanges
(
new
Range
(
1
,
1
,
selection
.
startLineNumber
,
selection
.
startColumn
))
!
;
let
pretext
=
model
.
getValueInRange
(
pretextRange
,
EndOfLinePreference
.
LF
);
...
...
src/vs/editor/common/config/editorOptions.ts
浏览文件 @
434bc801
...
...
@@ -331,6 +331,10 @@ export interface IEditorOptions {
* Defaults to 'auto'. It is best to leave this to 'auto'.
*/
accessibilitySupport
?:
'
auto
'
|
'
off
'
|
'
on
'
;
/**
* Controls the number of lines in the editor that can be read out by a screen reader
*/
accessibilityPageSize
?:
number
;
/**
* Suggest options.
*/
...
...
@@ -3001,6 +3005,7 @@ export const enum EditorOption {
acceptSuggestionOnCommitCharacter
,
acceptSuggestionOnEnter
,
accessibilitySupport
,
accessibilityPageSize
,
ariaLabel
,
autoClosingBrackets
,
autoClosingOvertype
,
...
...
@@ -3128,6 +3133,8 @@ export const EditorOptions = {
}
)),
accessibilitySupport
:
register
(
new
EditorAccessibilitySupport
()),
accessibilityPageSize
:
register
(
new
EditorIntOption
(
EditorOption
.
accessibilityPageSize
,
'
accessibilityPageSize
'
,
10
,
1
,
Constants
.
MAX_SAFE_SMALL_INTEGER
,
{
description
:
nls
.
localize
(
'
accessibilityPageSize
'
,
"
Controls the number of lines in the editor that can be read out by a screen reader. Warning: this has a performance implication for numbers larger than the default.
"
)
})),
ariaLabel
:
register
(
new
EditorStringOption
(
EditorOption
.
ariaLabel
,
'
ariaLabel
'
,
nls
.
localize
(
'
editorViewAccessibleLabel
'
,
"
Editor content
"
)
)),
...
...
src/vs/editor/test/browser/controller/imeTester.ts
浏览文件 @
434bc801
...
...
@@ -103,7 +103,7 @@ function doCreateTest(description: string, inputStr: string, expectedStr: string
const
selection
=
new
Range
(
1
,
1
+
cursorOffset
,
1
,
1
+
cursorOffset
+
cursorLength
);
return
PagedScreenReaderStrategy
.
fromEditorSelection
(
currentState
,
model
,
selection
,
true
);
return
PagedScreenReaderStrategy
.
fromEditorSelection
(
currentState
,
model
,
selection
,
10
,
true
);
},
deduceModelPosition
:
(
viewAnchorPosition
:
Position
,
deltaOffset
:
number
,
lineFeedCnt
:
number
):
Position
=>
{
return
null
!
;
...
...
src/vs/editor/test/browser/controller/textAreaState.test.ts
浏览文件 @
434bc801
...
...
@@ -535,7 +535,7 @@ suite('TextAreaState', () => {
function
testPagedScreenReaderStrategy
(
lines
:
string
[],
selection
:
Selection
,
expected
:
TextAreaState
):
void
{
const
model
=
TextModel
.
createFromString
(
lines
.
join
(
'
\n
'
));
const
actual
=
PagedScreenReaderStrategy
.
fromEditorSelection
(
TextAreaState
.
EMPTY
,
model
,
selection
,
true
);
const
actual
=
PagedScreenReaderStrategy
.
fromEditorSelection
(
TextAreaState
.
EMPTY
,
model
,
selection
,
10
,
true
);
assert
.
ok
(
equalsTextAreaState
(
actual
,
expected
));
model
.
dispose
();
}
...
...
src/vs/monaco.d.ts
浏览文件 @
434bc801
...
...
@@ -2730,6 +2730,10 @@ declare namespace monaco.editor {
* Defaults to 'auto'. It is best to leave this to 'auto'.
*/
accessibilitySupport
?:
'
auto
'
|
'
off
'
|
'
on
'
;
/**
* Controls the number of lines in the editor that can be read out by a screen reader
*/
accessibilityPageSize
?:
number
;
/**
* Suggest options.
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录