@@ -17,7 +17,7 @@ import { ViewController } from 'vs/editor/browser/view/viewController';
1717import { PartFingerprint , PartFingerprints , ViewPart } from 'vs/editor/browser/view/viewPart' ;
1818import { LineNumbersOverlay } from 'vs/editor/browser/viewParts/lineNumbers/lineNumbers' ;
1919import { Margin } from 'vs/editor/browser/viewParts/margin/margin' ;
20- import { RenderLineNumbersType , EditorOption , IComputedEditorOptions } from 'vs/editor/common/config/editorOptions' ;
20+ import { RenderLineNumbersType , EditorOption , IComputedEditorOptions , EditorOptions } from 'vs/editor/common/config/editorOptions' ;
2121import { BareFontInfo } from 'vs/editor/common/config/fontInfo' ;
2222import { WordCharacterClass , getMapForWordSeparators } from 'vs/editor/common/controller/wordCharacterClassifier' ;
2323import { Position } from 'vs/editor/common/core/position' ;
@@ -62,8 +62,8 @@ export class TextAreaHandler extends ViewPart {
6262 private _scrollLeft : number ;
6363 private _scrollTop : number ;
6464
65- private _accessibilitySupport : AccessibilitySupport ;
66- private _accessibilityPageSize : number ;
65+ private _accessibilitySupport ! : AccessibilitySupport ;
66+ private _accessibilityPageSize ! : number ;
6767 private _contentLeft : number ;
6868 private _contentWidth : number ;
6969 private _contentHeight : number ;
@@ -100,8 +100,7 @@ export class TextAreaHandler extends ViewPart {
100100 const options = this . _context . configuration . options ;
101101 const layoutInfo = options . get ( EditorOption . layoutInfo ) ;
102102
103- this . _accessibilitySupport = options . get ( EditorOption . accessibilitySupport ) ;
104- this . _accessibilityPageSize = options . get ( EditorOption . accessibilityPageSize ) ;
103+ this . _setAccessibilityOptions ( options ) ;
105104 this . _contentLeft = layoutInfo . contentLeft ;
106105 this . _contentWidth = layoutInfo . contentWidth ;
107106 this . _contentHeight = layoutInfo . height ;
@@ -159,16 +158,22 @@ export class TextAreaHandler extends ViewPart {
159158 const text = ( Array . isArray ( rawTextToCopy ) ? rawTextToCopy . join ( newLineCharacter ) : rawTextToCopy ) ;
160159
161160 let html : string | null | undefined = undefined ;
161+ let mode : string | null = null ;
162162 if ( generateHTML ) {
163163 if ( CopyOptions . forceCopyWithSyntaxHighlighting || ( this . _copyWithSyntaxHighlighting && text . length < 65536 ) ) {
164- html = this . _context . model . getHTMLToCopy ( this . _modelSelections , this . _emptySelectionClipboard ) ;
164+ const richText = this . _context . model . getRichTextToCopy ( this . _modelSelections , this . _emptySelectionClipboard ) ;
165+ if ( richText ) {
166+ html = richText . html ;
167+ mode = richText . mode ;
168+ }
165169 }
166170 }
167171 return {
168172 isFromEmptySelection,
169173 multicursorText,
170174 text,
171- html
175+ html,
176+ mode
172177 } ;
173178 } ,
174179
@@ -222,11 +227,13 @@ export class TextAreaHandler extends ViewPart {
222227 this . _register ( this . _textAreaInput . onPaste ( ( e : IPasteData ) => {
223228 let pasteOnNewLine = false ;
224229 let multicursorText : string [ ] | null = null ;
230+ let mode : string | null = null ;
225231 if ( e . metadata ) {
226232 pasteOnNewLine = ( this . _emptySelectionClipboard && ! ! e . metadata . isFromEmptySelection ) ;
227233 multicursorText = ( typeof e . metadata . multicursorText !== 'undefined' ? e . metadata . multicursorText : null ) ;
234+ mode = e . metadata . mode ;
228235 }
229- this . _viewController . paste ( 'keyboard' , e . text , pasteOnNewLine , multicursorText ) ;
236+ this . _viewController . paste ( 'keyboard' , e . text , pasteOnNewLine , multicursorText , mode ) ;
230237 } ) ) ;
231238
232239 this . _register ( this . _textAreaInput . onCut ( ( ) => {
@@ -346,14 +353,24 @@ export class TextAreaHandler extends ViewPart {
346353 return options . get ( EditorOption . ariaLabel ) ;
347354 }
348355
356+ private _setAccessibilityOptions ( options : IComputedEditorOptions ) : void {
357+ this . _accessibilitySupport = options . get ( EditorOption . accessibilitySupport ) ;
358+ const accessibilityPageSize = options . get ( EditorOption . accessibilityPageSize ) ;
359+ if ( this . _accessibilitySupport === AccessibilitySupport . Enabled && accessibilityPageSize === EditorOptions . accessibilityPageSize . defaultValue ) {
360+ // If a screen reader is attached and the default value is not set we shuold automatically increase the page size to 1000 for a better experience
361+ this . _accessibilityPageSize = 1000 ;
362+ } else {
363+ this . _accessibilityPageSize = accessibilityPageSize ;
364+ }
365+ }
366+
349367 // --- begin event handlers
350368
351369 public onConfigurationChanged ( e : viewEvents . ViewConfigurationChangedEvent ) : boolean {
352370 const options = this . _context . configuration . options ;
353371 const layoutInfo = options . get ( EditorOption . layoutInfo ) ;
354372
355- this . _accessibilitySupport = options . get ( EditorOption . accessibilitySupport ) ;
356- this . _accessibilityPageSize = options . get ( EditorOption . accessibilityPageSize ) ;
373+ this . _setAccessibilityOptions ( options ) ;
357374 this . _contentLeft = layoutInfo . contentLeft ;
358375 this . _contentWidth = layoutInfo . contentWidth ;
359376 this . _contentHeight = layoutInfo . height ;
0 commit comments