Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
27c4aca1
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,发现更多精彩内容 >>
提交
27c4aca1
编写于
2月 12, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add and use NVDAPagedText strategy
上级
ace47418
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
124 addition
and
11 deletion
+124
-11
src/vs/editor/browser/widget/media/editor.css
src/vs/editor/browser/widget/media/editor.css
+8
-0
src/vs/editor/common/controller/textAreaState.ts
src/vs/editor/common/controller/textAreaState.ts
+116
-11
未找到文件。
src/vs/editor/browser/widget/media/editor.css
浏览文件 @
27c4aca1
...
...
@@ -53,6 +53,14 @@
overflow
:
hidden
;
}
/*.monaco-editor .inputarea {
position: fixed !important;
width: 200px !important;
height: 200px !important;
top: initial !important;
bottom: 0 !important;
}*/
.monaco-editor.ff
.inputarea
,
.monaco-editor.ie
.inputarea
{
width
:
0
;
...
...
src/vs/editor/common/controller/textAreaState.ts
浏览文件 @
27c4aca1
...
...
@@ -61,11 +61,16 @@ export enum TextAreaStrategy {
NVDA
}
const
USE_NVDA_FULL_TEXT
=
false
;
export
function
createTextAreaState
(
strategy
:
TextAreaStrategy
):
TextAreaState
{
if
(
strategy
===
TextAreaStrategy
.
IENarrator
)
{
return
IENarratorTextAreaState
.
EMPTY
;
}
return
NVDATextAreaState
.
EMPTY
;
if
(
USE_NVDA_FULL_TEXT
)
{
return
NVDAFullTextAreaState
.
EMPTY
;
}
return
NVDAPagedTextAreaState
.
EMPTY
;
}
export
abstract
class
TextAreaState
{
...
...
@@ -221,7 +226,10 @@ export class IENarratorTextAreaState extends TextAreaState {
if
(
strategy
===
TextAreaStrategy
.
IENarrator
)
{
return
this
;
}
return
new
NVDATextAreaState
(
this
.
previousState
,
this
.
value
,
this
.
selectionStart
,
this
.
selectionEnd
,
this
.
isInOverwriteMode
);
if
(
USE_NVDA_FULL_TEXT
)
{
return
new
NVDAFullTextAreaState
(
this
.
previousState
,
this
.
value
,
this
.
selectionStart
,
this
.
selectionEnd
,
this
.
isInOverwriteMode
);
}
return
new
NVDAPagedTextAreaState
(
this
.
previousState
,
this
.
value
,
this
.
selectionStart
,
this
.
selectionEnd
,
this
.
isInOverwriteMode
);
}
public
equals
(
other
:
TextAreaState
):
boolean
{
...
...
@@ -299,19 +307,116 @@ export class IENarratorTextAreaState extends TextAreaState {
}
}
export
class
NVDATextAreaState
extends
TextAreaState
{
public
static
EMPTY
=
new
NVDATextAreaState
(
null
,
''
,
0
,
0
,
false
);
export
class
NVDAPagedTextAreaState
extends
TextAreaState
{
public
static
EMPTY
=
new
NVDAPagedTextAreaState
(
null
,
''
,
0
,
0
,
false
);
private
static
_LINES_PER_PAGE
=
10
;
constructor
(
previousState
:
TextAreaState
,
value
:
string
,
selectionStart
:
number
,
selectionEnd
:
number
,
isInOverwriteMode
:
boolean
)
{
super
(
previousState
,
value
,
selectionStart
,
selectionEnd
,
isInOverwriteMode
);
}
protected
shallowClone
():
TextAreaState
{
return
new
NVDAPagedTextAreaState
(
null
,
this
.
value
,
this
.
selectionStart
,
this
.
selectionEnd
,
this
.
isInOverwriteMode
);
}
public
toEmpty
():
TextAreaState
{
return
NVDAPagedTextAreaState
.
EMPTY
;
}
public
toString
():
string
{
return
'
[ <
'
+
this
.
value
+
'
>, selectionStart:
'
+
this
.
selectionStart
+
'
, selectionEnd:
'
+
this
.
selectionEnd
+
'
, isInOverwriteMode:
'
+
this
.
isInOverwriteMode
+
'
]
'
;
}
public
toStrategy
(
strategy
:
TextAreaStrategy
):
TextAreaState
{
if
(
strategy
===
TextAreaStrategy
.
NVDA
)
{
return
this
;
}
return
new
IENarratorTextAreaState
(
this
.
previousState
,
this
.
value
,
this
.
selectionStart
,
this
.
selectionEnd
,
this
.
isInOverwriteMode
,
0
);
}
public
equals
(
other
:
TextAreaState
):
boolean
{
if
(
other
instanceof
NVDAPagedTextAreaState
)
{
return
(
this
.
value
===
other
.
value
&&
this
.
selectionStart
===
other
.
selectionStart
&&
this
.
selectionEnd
===
other
.
selectionEnd
&&
this
.
isInOverwriteMode
===
other
.
isInOverwriteMode
);
}
return
false
;
}
public
fromTextArea
(
textArea
:
ITextAreaWrapper
):
TextAreaState
{
return
new
NVDAPagedTextAreaState
(
this
,
textArea
.
getValue
(),
textArea
.
getSelectionStart
(),
textArea
.
getSelectionEnd
(),
textArea
.
isInOverwriteMode
());
}
private
static
_getPageOfLine
(
lineNumber
:
number
):
number
{
return
Math
.
floor
((
lineNumber
-
1
)
/
NVDAPagedTextAreaState
.
_LINES_PER_PAGE
);
}
private
static
_getRangeForPage
(
page
:
number
):
Range
{
let
offset
=
page
*
NVDAPagedTextAreaState
.
_LINES_PER_PAGE
;
let
startLineNumber
=
offset
+
1
;
let
endLineNumber
=
offset
+
NVDAPagedTextAreaState
.
_LINES_PER_PAGE
;
return
new
Range
(
startLineNumber
,
1
,
endLineNumber
,
Number
.
MAX_VALUE
);
}
public
fromEditorSelection
(
model
:
ISimpleModel
,
selection
:
EditorCommon
.
IEditorRange
):
TextAreaState
{
let
selectionStartPage
=
NVDAPagedTextAreaState
.
_getPageOfLine
(
selection
.
startLineNumber
);
let
selectionStartPageRange
=
NVDAPagedTextAreaState
.
_getRangeForPage
(
selectionStartPage
);
let
selectionEndPage
=
NVDAPagedTextAreaState
.
_getPageOfLine
(
selection
.
endLineNumber
);
let
selectionEndPageRange
=
NVDAPagedTextAreaState
.
_getRangeForPage
(
selectionEndPage
);
let
pretextRange
=
selectionStartPageRange
.
intersectRanges
(
new
Range
(
1
,
1
,
selection
.
startLineNumber
,
selection
.
startColumn
));
let
pretext
=
model
.
getValueInRange
(
pretextRange
,
EditorCommon
.
EndOfLinePreference
.
LF
);
let
lastLine
=
model
.
getLineCount
();
let
lastLineMaxColumn
=
model
.
getLineMaxColumn
(
lastLine
);
let
posttextRange
=
selectionEndPageRange
.
intersectRanges
(
new
Range
(
selection
.
endLineNumber
,
selection
.
endColumn
,
lastLine
,
lastLineMaxColumn
));
let
posttext
=
model
.
getValueInRange
(
posttextRange
,
EditorCommon
.
EndOfLinePreference
.
LF
);
let
text
:
string
=
null
;
if
(
selectionStartPage
<=
selectionEndPage
)
{
// take full selection
text
=
model
.
getValueInRange
(
selection
,
EditorCommon
.
EndOfLinePreference
.
LF
);
}
else
{
let
selectionRange1
=
selectionStartPageRange
.
intersectRanges
(
selection
);
let
selectionRange2
=
selectionEndPageRange
.
intersectRanges
(
selection
);
text
=
(
model
.
getValueInRange
(
selectionRange1
,
EditorCommon
.
EndOfLinePreference
.
LF
)
+
String
.
fromCharCode
(
8230
)
+
model
.
getValueInRange
(
selectionRange2
,
EditorCommon
.
EndOfLinePreference
.
LF
)
);
}
return
new
NVDAPagedTextAreaState
(
this
,
pretext
+
text
+
posttext
,
pretext
.
length
,
pretext
.
length
+
text
.
length
,
false
);
}
public
fromText
(
text
:
string
):
TextAreaState
{
return
new
NVDAPagedTextAreaState
(
this
,
text
,
0
,
text
.
length
,
false
);
}
public
resetSelection
():
TextAreaState
{
return
new
NVDAPagedTextAreaState
(
this
.
previousState
,
this
.
value
,
this
.
value
.
length
,
this
.
value
.
length
,
this
.
isInOverwriteMode
);
}
}
export
class
NVDAFullTextAreaState
extends
TextAreaState
{
public
static
EMPTY
=
new
NVDAFullTextAreaState
(
null
,
''
,
0
,
0
,
false
);
constructor
(
previousState
:
TextAreaState
,
value
:
string
,
selectionStart
:
number
,
selectionEnd
:
number
,
isInOverwriteMode
:
boolean
)
{
super
(
previousState
,
value
,
selectionStart
,
selectionEnd
,
isInOverwriteMode
);
}
protected
shallowClone
():
TextAreaState
{
return
new
NVDATextAreaState
(
null
,
this
.
value
,
this
.
selectionStart
,
this
.
selectionEnd
,
this
.
isInOverwriteMode
);
return
new
NVDA
Full
TextAreaState
(
null
,
this
.
value
,
this
.
selectionStart
,
this
.
selectionEnd
,
this
.
isInOverwriteMode
);
}
public
toEmpty
():
TextAreaState
{
return
NVDATextAreaState
.
EMPTY
;
return
NVDA
Full
TextAreaState
.
EMPTY
;
}
public
toString
():
string
{
...
...
@@ -326,7 +431,7 @@ export class NVDATextAreaState extends TextAreaState {
}
public
equals
(
other
:
TextAreaState
):
boolean
{
if
(
other
instanceof
NVDATextAreaState
)
{
if
(
other
instanceof
NVDA
Full
TextAreaState
)
{
return
(
this
.
value
===
other
.
value
&&
this
.
selectionStart
===
other
.
selectionStart
...
...
@@ -338,7 +443,7 @@ export class NVDATextAreaState extends TextAreaState {
}
public
fromTextArea
(
textArea
:
ITextAreaWrapper
):
TextAreaState
{
return
new
NVDATextAreaState
(
this
,
textArea
.
getValue
(),
textArea
.
getSelectionStart
(),
textArea
.
getSelectionEnd
(),
textArea
.
isInOverwriteMode
());
return
new
NVDA
Full
TextAreaState
(
this
,
textArea
.
getValue
(),
textArea
.
getSelectionStart
(),
textArea
.
getSelectionEnd
(),
textArea
.
isInOverwriteMode
());
}
public
fromEditorSelection
(
model
:
ISimpleModel
,
selection
:
EditorCommon
.
IEditorRange
):
TextAreaState
{
...
...
@@ -348,14 +453,14 @@ export class NVDATextAreaState extends TextAreaState {
let
lastLineMaxColumn
=
model
.
getLineMaxColumn
(
lastLine
);
let
posttext
=
model
.
getValueInRange
(
new
Range
(
selection
.
endLineNumber
,
selection
.
endColumn
,
lastLine
,
lastLineMaxColumn
),
EditorCommon
.
EndOfLinePreference
.
LF
);
return
new
NVDATextAreaState
(
this
,
pretext
+
text
+
posttext
,
pretext
.
length
,
pretext
.
length
+
text
.
length
,
false
);
return
new
NVDA
Full
TextAreaState
(
this
,
pretext
+
text
+
posttext
,
pretext
.
length
,
pretext
.
length
+
text
.
length
,
false
);
}
public
fromText
(
text
:
string
):
TextAreaState
{
return
new
NVDATextAreaState
(
this
,
text
,
0
,
text
.
length
,
false
);
return
new
NVDA
Full
TextAreaState
(
this
,
text
,
0
,
text
.
length
,
false
);
}
public
resetSelection
():
TextAreaState
{
return
new
NVDATextAreaState
(
this
.
previousState
,
this
.
value
,
this
.
value
.
length
,
this
.
value
.
length
,
this
.
isInOverwriteMode
);
return
new
NVDA
Full
TextAreaState
(
this
.
previousState
,
this
.
value
,
this
.
value
.
length
,
this
.
value
.
length
,
this
.
isInOverwriteMode
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录