@@ -14,7 +14,6 @@ import paths = require('vs/base/common/paths');
14
14
import types = require( 'vs/base/common/types' ) ;
15
15
import uri from 'vs/base/common/uri' ;
16
16
import errors = require( 'vs/base/common/errors' ) ;
17
- import * as browser from 'vs/base/browser/browser' ;
18
17
import { IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar' ;
19
18
import { Action } from 'vs/base/common/actions' ;
20
19
import { language , LANGUAGE_DEFAULT , AccessibilitySupport } from 'vs/base/common/platform' ;
@@ -47,6 +46,7 @@ import { ITextFileService } from 'vs/workbench/services/textfile/common/textfile
47
46
import { getCodeEditor as getEditorWidget } from 'vs/editor/common/services/codeEditorService' ;
48
47
import { IPreferencesService } from 'vs/workbench/parts/preferences/common/preferences' ;
49
48
import { ICursorPositionChangedEvent } from 'vs/editor/common/controller/cursorEvents' ;
49
+ import { IConfigurationChangedEvent } from "vs/editor/common/config/editorOptions" ;
50
50
51
51
function toEditorWithEncodingSupport ( input : IEditorInput ) : IEncodingSupport {
52
52
if ( input instanceof SideBySideEditorInput ) {
@@ -329,9 +329,7 @@ export class EditorStatus implements IStatusbarItem {
329
329
this . untitledEditorService . onDidChangeEncoding ( r => this . onResourceEncodingChange ( r ) ) ,
330
330
this . textFileService . models . onModelEncodingChanged ( e => this . onResourceEncodingChange ( e . resource ) ) ,
331
331
TabFocus . onDidChangeTabFocus ( e => this . onTabFocusModeChange ( ) ) ,
332
- browser . onDidChangeAccessibilitySupport ( ( ) => this . onScreenReaderModeChange ( ) )
333
332
) ;
334
- this . onScreenReaderModeChange ( ) ;
335
333
336
334
return combinedDisposable ( this . toDispose ) ;
337
335
}
@@ -492,6 +490,7 @@ export class EditorStatus implements IStatusbarItem {
492
490
const control = getEditorWidget ( activeEditor ) ;
493
491
494
492
// Update all states
493
+ this . onScreenReaderModeChange ( control ) ;
495
494
this . onSelectionChange ( control ) ;
496
495
this . onModeChange ( control ) ;
497
496
this . onEOLChange ( control ) ;
@@ -505,6 +504,13 @@ export class EditorStatus implements IStatusbarItem {
505
504
// Attach new listeners to active editor
506
505
if ( control ) {
507
506
507
+ // Hook Listener for Configuration changes
508
+ this . activeEditorListeners . push ( control . onDidChangeConfiguration ( ( event : IConfigurationChangedEvent ) => {
509
+ if ( event . accessibilitySupport ) {
510
+ this . onScreenReaderModeChange ( control ) ;
511
+ }
512
+ } ) ) ;
513
+
508
514
// Hook Listener for Selection changes
509
515
this . activeEditorListeners . push ( control . onDidChangeCursorPosition ( ( event : ICursorPositionChangedEvent ) => {
510
516
this . onSelectionChange ( control ) ;
@@ -595,6 +601,18 @@ export class EditorStatus implements IStatusbarItem {
595
601
this . updateState ( update ) ;
596
602
}
597
603
604
+ private onScreenReaderModeChange ( editorWidget : ICommonCodeEditor ) : void {
605
+ let screenReaderMode = false ;
606
+
607
+ // We only support text based editors
608
+ if ( editorWidget ) {
609
+
610
+ screenReaderMode = ( editorWidget . getConfiguration ( ) . accessibilitySupport === AccessibilitySupport . Enabled ) ;
611
+ }
612
+
613
+ this . updateState ( { screenReaderMode : screenReaderMode } ) ;
614
+ }
615
+
598
616
private onSelectionChange ( editorWidget : ICommonCodeEditor ) : void {
599
617
const info : IEditorSelectionStatus = { } ;
600
618
@@ -685,12 +703,6 @@ export class EditorStatus implements IStatusbarItem {
685
703
this . updateState ( info ) ;
686
704
}
687
705
688
- private onScreenReaderModeChange ( ) : void {
689
- const info : StateDelta = { screenReaderMode : browser . getAccessibilitySupport ( ) === AccessibilitySupport . Enabled } ;
690
-
691
- this . updateState ( info ) ;
692
- }
693
-
694
706
private isActiveEditor ( e : IBaseEditor ) : boolean {
695
707
const activeEditor = this . editorService . getActiveEditor ( ) ;
696
708
0 commit comments