Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f1741033
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 搜索 >>
提交
f1741033
编写于
1月 25, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add experimental editor option to toggle between text area state strategies
上级
1379c399
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
65 addition
and
14 deletion
+65
-14
src/vs/editor/browser/controller/keyboardHandler.ts
src/vs/editor/browser/controller/keyboardHandler.ts
+12
-2
src/vs/editor/common/config/commonEditorConfig.ts
src/vs/editor/common/config/commonEditorConfig.ts
+10
-8
src/vs/editor/common/config/defaultConfig.ts
src/vs/editor/common/config/defaultConfig.ts
+1
-0
src/vs/editor/common/controller/textAreaHandler.ts
src/vs/editor/common/controller/textAreaHandler.ts
+10
-4
src/vs/editor/common/controller/textAreaState.ts
src/vs/editor/common/controller/textAreaState.ts
+28
-0
src/vs/editor/common/editorCommon.ts
src/vs/editor/common/editorCommon.ts
+4
-0
未找到文件。
src/vs/editor/browser/controller/keyboardHandler.ts
浏览文件 @
f1741033
...
...
@@ -20,7 +20,7 @@ import {Position} from 'vs/editor/common/core/position';
import
{
CommonKeybindings
}
from
'
vs/base/common/keyCodes
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
TextAreaHandler
}
from
'
vs/editor/common/controller/textAreaHandler
'
;
import
{
ITextAreaWrapper
,
IClipboardEvent
,
IKeyboardEventWrapper
,
ISimpleModel
}
from
'
vs/editor/common/controller/textAreaState
'
;
import
{
ITextAreaWrapper
,
IClipboardEvent
,
IKeyboardEventWrapper
,
ISimpleModel
,
TextAreaStrategy
}
from
'
vs/editor/common/controller/textAreaState
'
;
class
ClipboardEventWrapper
implements
IClipboardEvent
{
...
...
@@ -213,7 +213,7 @@ export class KeyboardHandler extends ViewEventHandler implements Lifecycle.IDisp
this
.
contentWidth
=
0
;
this
.
scrollLeft
=
0
;
this
.
textAreaHandler
=
new
TextAreaHandler
(
Platform
,
Browser
,
this
.
textArea
,
this
.
context
.
model
);
this
.
textAreaHandler
=
new
TextAreaHandler
(
Platform
,
Browser
,
this
.
_getStrategy
(),
this
.
textArea
,
this
.
context
.
model
);
this
.
_toDispose
=
[];
this
.
_toDispose
.
push
(
this
.
textAreaHandler
.
onKeyDown
((
e
)
=>
this
.
viewController
.
emitKeyDown
(
<
DomUtils
.
IKeyboardEvent
>
e
.
_actual
)));
...
...
@@ -273,6 +273,13 @@ export class KeyboardHandler extends ViewEventHandler implements Lifecycle.IDisp
this
.
_toDispose
=
Lifecycle
.
disposeAll
(
this
.
_toDispose
);
}
private
_getStrategy
():
TextAreaStrategy
{
if
(
this
.
context
.
configuration
.
editor
.
_screenReaderNVDA
)
{
return
TextAreaStrategy
.
NVDA
;
}
return
TextAreaStrategy
.
IENarrator
;
}
public
focusTextArea
():
void
{
this
.
textAreaHandler
.
writePlaceholderAndSelectTextAreaSync
();
}
...
...
@@ -281,6 +288,9 @@ export class KeyboardHandler extends ViewEventHandler implements Lifecycle.IDisp
// Give textarea same font size & line height as editor, for the IME case (when the textarea is visible)
DomUtils
.
StyleMutator
.
setFontSize
(
this
.
textArea
.
actual
,
this
.
context
.
configuration
.
editor
.
fontSize
);
DomUtils
.
StyleMutator
.
setLineHeight
(
this
.
textArea
.
actual
,
this
.
context
.
configuration
.
editor
.
lineHeight
);
if
(
e
.
_screenReaderNVDA
)
{
this
.
textAreaHandler
.
setStrategy
(
this
.
_getStrategy
());
}
return
false
;
}
...
...
src/vs/editor/common/config/commonEditorConfig.ts
浏览文件 @
f1741033
...
...
@@ -143,6 +143,7 @@ class InternalEditorOptionsHelper {
scrollbar
:
scrollbar
,
overviewRulerLanes
:
toInteger
(
opts
.
overviewRulerLanes
,
0
,
3
),
cursorBlinking
:
opts
.
cursorBlinking
,
_screenReaderNVDA
:
toBoolean
(
opts
.
_screenReaderNVDA
),
cursorStyle
:
opts
.
cursorStyle
,
fontLigatures
:
toBoolean
(
opts
.
fontLigatures
),
hideCursorInOverviewRuler
:
toBoolean
(
opts
.
hideCursorInOverviewRuler
),
...
...
@@ -220,20 +221,20 @@ class InternalEditorOptionsHelper {
public
static
createConfigurationChangedEvent
(
prevOpts
:
EditorCommon
.
IInternalEditorOptions
,
newOpts
:
EditorCommon
.
IInternalEditorOptions
):
EditorCommon
.
IConfigurationChangedEvent
{
return
{
layoutInfo
:
(
!
EditorLayoutProvider
.
layoutEqual
(
prevOpts
.
layoutInfo
,
newOpts
.
layoutInfo
)),
layoutInfo
:
(
!
EditorLayoutProvider
.
layoutEqual
(
prevOpts
.
layoutInfo
,
newOpts
.
layoutInfo
)),
stylingInfo
:
(
!
this
.
_stylingInfoEqual
(
prevOpts
.
stylingInfo
,
newOpts
.
stylingInfo
)),
wrappingInfo
:
(
!
this
.
_wrappingInfoEqual
(
prevOpts
.
wrappingInfo
,
newOpts
.
wrappingInfo
)),
indentInfo
:
(
!
this
.
_indentInfoEqual
(
prevOpts
.
indentInfo
,
newOpts
.
indentInfo
)),
observedOuterWidth
:
(
prevOpts
.
observedOuterWidth
!==
newOpts
.
observedOuterWidth
),
observedOuterHeight
:
(
prevOpts
.
observedOuterHeight
!==
newOpts
.
observedOuterHeight
),
observedOuterHeight
:
(
prevOpts
.
observedOuterHeight
!==
newOpts
.
observedOuterHeight
),
lineHeight
:
(
prevOpts
.
lineHeight
!==
newOpts
.
lineHeight
),
pageSize
:
(
prevOpts
.
pageSize
!==
newOpts
.
pageSize
),
typicalHalfwidthCharacterWidth
:
(
prevOpts
.
typicalHalfwidthCharacterWidth
!==
newOpts
.
typicalHalfwidthCharacterWidth
),
typicalFullwidthCharacterWidth
:
(
prevOpts
.
typicalFullwidthCharacterWidth
!==
newOpts
.
typicalFullwidthCharacterWidth
),
fontSize
:
(
prevOpts
.
fontSize
!==
newOpts
.
fontSize
),
lineNumbers
:
(
prevOpts
.
lineNumbers
!==
newOpts
.
lineNumbers
),
selectOnLineNumbers
:
(
prevOpts
.
selectOnLineNumbers
!==
newOpts
.
selectOnLineNumbers
),
glyphMargin
:
(
prevOpts
.
glyphMargin
!==
newOpts
.
glyphMargin
),
lineNumbers
:
(
prevOpts
.
lineNumbers
!==
newOpts
.
lineNumbers
),
selectOnLineNumbers
:
(
prevOpts
.
selectOnLineNumbers
!==
newOpts
.
selectOnLineNumbers
),
glyphMargin
:
(
prevOpts
.
glyphMargin
!==
newOpts
.
glyphMargin
),
revealHorizontalRightPadding
:
(
prevOpts
.
revealHorizontalRightPadding
!==
newOpts
.
revealHorizontalRightPadding
),
roundedSelection
:
(
prevOpts
.
roundedSelection
!==
newOpts
.
roundedSelection
),
theme
:
(
prevOpts
.
theme
!==
newOpts
.
theme
),
...
...
@@ -241,7 +242,8 @@ class InternalEditorOptionsHelper {
scrollbar
:
(
!
this
.
_scrollbarOptsEqual
(
prevOpts
.
scrollbar
,
newOpts
.
scrollbar
)),
overviewRulerLanes
:
(
prevOpts
.
overviewRulerLanes
!==
newOpts
.
overviewRulerLanes
),
cursorBlinking
:
(
prevOpts
.
cursorBlinking
!==
newOpts
.
cursorBlinking
),
cursorStyle
:
(
prevOpts
.
cursorStyle
!==
newOpts
.
cursorStyle
),
_screenReaderNVDA
:
(
prevOpts
.
_screenReaderNVDA
!==
newOpts
.
_screenReaderNVDA
),
cursorStyle
:
(
prevOpts
.
cursorStyle
!==
newOpts
.
cursorStyle
),
fontLigatures
:
(
prevOpts
.
fontLigatures
!==
newOpts
.
fontLigatures
),
hideCursorInOverviewRuler
:
(
prevOpts
.
hideCursorInOverviewRuler
!==
newOpts
.
hideCursorInOverviewRuler
),
scrollBeyondLastLine
:
(
prevOpts
.
scrollBeyondLastLine
!==
newOpts
.
scrollBeyondLastLine
),
...
...
@@ -255,11 +257,11 @@ class InternalEditorOptionsHelper {
longLineBoundary
:
(
prevOpts
.
longLineBoundary
!==
newOpts
.
longLineBoundary
),
forcedTokenizationBoundary
:
(
prevOpts
.
forcedTokenizationBoundary
!==
newOpts
.
forcedTokenizationBoundary
),
hover
:
(
prevOpts
.
hover
!==
newOpts
.
hover
),
contextmenu
:
(
prevOpts
.
contextmenu
!==
newOpts
.
contextmenu
),
contextmenu
:
(
prevOpts
.
contextmenu
!==
newOpts
.
contextmenu
),
quickSuggestions
:
(
prevOpts
.
quickSuggestions
!==
newOpts
.
quickSuggestions
),
quickSuggestionsDelay
:
(
prevOpts
.
quickSuggestionsDelay
!==
newOpts
.
quickSuggestionsDelay
),
iconsInSuggestions
:
(
prevOpts
.
iconsInSuggestions
!==
newOpts
.
iconsInSuggestions
),
autoClosingBrackets
:
(
prevOpts
.
autoClosingBrackets
!==
newOpts
.
autoClosingBrackets
),
autoClosingBrackets
:
(
prevOpts
.
autoClosingBrackets
!==
newOpts
.
autoClosingBrackets
),
formatOnType
:
(
prevOpts
.
formatOnType
!==
newOpts
.
formatOnType
),
suggestOnTriggerCharacters
:
(
prevOpts
.
suggestOnTriggerCharacters
!==
newOpts
.
suggestOnTriggerCharacters
),
selectionHighlight
:
(
prevOpts
.
selectionHighlight
!==
newOpts
.
selectionHighlight
),
...
...
src/vs/editor/common/config/defaultConfig.ts
浏览文件 @
f1741033
...
...
@@ -16,6 +16,7 @@ class ConfigClass implements IConfiguration {
constructor
()
{
this
.
editor
=
{
_screenReaderNVDA
:
false
,
lineNumbers
:
true
,
selectOnLineNumbers
:
true
,
lineNumbersMinChars
:
5
,
...
...
src/vs/editor/common/controller/textAreaHandler.ts
浏览文件 @
f1741033
...
...
@@ -10,7 +10,10 @@ import {Disposable} from 'vs/base/common/lifecycle';
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
CommonKeybindings
}
from
'
vs/base/common/keyCodes
'
;
import
{
IKeyboardEventWrapper
,
ITextAreaWrapper
,
IClipboardEvent
,
ISimpleModel
,
TextAreaState
,
IENarratorTextAreaState
,
NVDATextAreaState
,
ITypeData
}
from
'
vs/editor/common/controller/textAreaState
'
;
import
{
IKeyboardEventWrapper
,
ITextAreaWrapper
,
IClipboardEvent
,
ISimpleModel
,
TextAreaState
,
createTextAreaState
,
ITypeData
,
TextAreaStrategy
}
from
'
vs/editor/common/controller/textAreaState
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
enum
ReadFromTextArea
{
...
...
@@ -86,7 +89,7 @@ export class TextAreaHandler extends Disposable {
private
_nextCommand
:
ReadFromTextArea
;
constructor
(
Platform
:
IPlatform
,
Browser
:
IBrowser
,
textArea
:
ITextAreaWrapper
,
model
:
ISimpleModel
)
{
constructor
(
Platform
:
IPlatform
,
Browser
:
IBrowser
,
strategy
:
TextAreaStrategy
,
textArea
:
ITextAreaWrapper
,
model
:
ISimpleModel
)
{
super
();
this
.
Platform
=
Platform
;
this
.
Browser
=
Browser
;
...
...
@@ -101,8 +104,7 @@ export class TextAreaHandler extends Disposable {
this
.
lastCopiedValue
=
null
;
this
.
lastCopiedValueIsFromEmptySelection
=
false
;
this
.
textAreaState
=
IENarratorTextAreaState
.
EMPTY
;
// this.textAreaState = NVDATextAreaState.EMPTY;
this
.
textAreaState
=
createTextAreaState
(
strategy
);
this
.
hasFocus
=
false
;
...
...
@@ -219,6 +221,10 @@ export class TextAreaHandler extends Disposable {
// --- begin event handlers
public
setStrategy
(
strategy
:
TextAreaStrategy
):
void
{
this
.
textAreaState
=
this
.
textAreaState
.
toStrategy
(
strategy
);
}
public
setHasFocus
(
isFocused
:
boolean
):
void
{
if
(
this
.
hasFocus
===
isFocused
)
{
// no change
...
...
src/vs/editor/common/controller/textAreaState.ts
浏览文件 @
f1741033
...
...
@@ -55,6 +55,18 @@ export interface ITypeData {
replaceCharCnt
:
number
;
}
export
enum
TextAreaStrategy
{
IENarrator
,
NVDA
}
export
function
createTextAreaState
(
strategy
:
TextAreaStrategy
):
TextAreaState
{
if
(
strategy
===
TextAreaStrategy
.
IENarrator
)
{
return
IENarratorTextAreaState
.
EMPTY
;
}
return
NVDATextAreaState
.
EMPTY
;
}
export
abstract
class
TextAreaState
{
protected
previousState
:
TextAreaState
;
...
...
@@ -77,6 +89,8 @@ export abstract class TextAreaState {
public
abstract
toString
():
string
;
public
abstract
toStrategy
(
strategy
:
TextAreaStrategy
):
TextAreaState
;
public
abstract
equals
(
other
:
TextAreaState
):
boolean
;
public
abstract
fromTextArea
(
textArea
:
ITextAreaWrapper
):
TextAreaState
;
...
...
@@ -196,6 +210,13 @@ export class IENarratorTextAreaState extends TextAreaState {
return
'
[ <
'
+
this
.
value
+
'
>, selectionStart:
'
+
this
.
selectionStart
+
'
, selectionEnd:
'
+
this
.
selectionEnd
+
'
, isInOverwriteMode:
'
+
this
.
isInOverwriteMode
+
'
, selectionToken:
'
+
this
.
selectionToken
+
'
]
'
;
}
public
toStrategy
(
strategy
:
TextAreaStrategy
):
TextAreaState
{
if
(
strategy
===
TextAreaStrategy
.
IENarrator
)
{
return
this
;
}
return
new
NVDATextAreaState
(
this
.
previousState
,
this
.
value
,
this
.
selectionStart
,
this
.
selectionEnd
,
this
.
isInOverwriteMode
);
}
public
equals
(
other
:
TextAreaState
):
boolean
{
if
(
other
instanceof
IENarratorTextAreaState
)
{
return
(
...
...
@@ -290,6 +311,13 @@ export class NVDATextAreaState extends TextAreaState {
return
'
[ <ENTIRE TEXT
'
+
/*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
NVDATextAreaState
)
{
return
(
...
...
src/vs/editor/common/editorCommon.ts
浏览文件 @
f1741033
...
...
@@ -272,6 +272,7 @@ export function wrappingIndentFromString(wrappingIndent:string): WrappingIndent
* Configuration options for the editor. Common between configuring the editor and the options the editor has computed
*/
export
interface
ICommonEditorOptions
{
_screenReaderNVDA
?:
boolean
;
/**
* Control the rendering of line numbers.
* If it is a function, it will be invoked when rendering a line number and the return value will be rendered.
...
...
@@ -583,6 +584,7 @@ export interface IEditorWrappingInfo {
* Internal configuration options (transformed or computed) for the editor.
*/
export
interface
IInternalEditorOptions
{
_screenReaderNVDA
:
boolean
;
// ---- Options that are transparent - get no massaging
lineNumbers
:
any
;
...
...
@@ -667,6 +669,8 @@ export interface IInternalEditorOptions {
* An event describing that the configuration of the editor has changed.
*/
export
interface
IConfigurationChangedEvent
{
_screenReaderNVDA
:
boolean
;
layoutInfo
:
boolean
;
stylingInfo
:
boolean
;
wrappingInfo
:
boolean
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录