diff --git a/src/Terminal.ts b/src/Terminal.ts index 6349e94f..a13d47da 100644 --- a/src/Terminal.ts +++ b/src/Terminal.ts @@ -437,11 +437,6 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II break; } }); - // TODO: Move into rendercoordinator - // Inform renderer of changes - if (this._renderCoordinator) { - this._renderCoordinator.onOptionsChanged(); - } } /** @@ -613,7 +608,6 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II this.textarea = document.createElement('textarea'); this.textarea.classList.add('xterm-helper-textarea'); - // TODO: New API to set title? This could say "Terminal bash input", etc. this.textarea.setAttribute('aria-label', Strings.promptLabel); this.textarea.setAttribute('aria-multiline', 'false'); this.textarea.setAttribute('autocorrect', 'off'); @@ -640,7 +634,7 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II this._colorManager.setTheme(this._theme); const renderer = this._createRenderer(); - this._renderCoordinator = new RenderCoordinator(renderer, this.rows, this.screenElement); + this._renderCoordinator = new RenderCoordinator(renderer, this.rows, this.screenElement, this.optionsService); this._renderCoordinator.onRender(e => this._onRender.fire(e)); this.onResize(e => this._renderCoordinator.resize(e.cols, e.rows)); diff --git a/src/renderer/RenderCoordinator.ts b/src/renderer/RenderCoordinator.ts index b4bc673c..98c9ae86 100644 --- a/src/renderer/RenderCoordinator.ts +++ b/src/renderer/RenderCoordinator.ts @@ -11,6 +11,7 @@ import { ScreenDprMonitor } from 'ui/ScreenDprMonitor'; import { addDisposableDomListener } from 'ui/Lifecycle'; import { IColorSet } from 'ui/Types'; import { CharacterJoinerHandler } from '../Types'; +import { IOptionsService } from 'common/options/Types'; export class RenderCoordinator extends Disposable { private _renderDebouncer: RenderDebouncer; @@ -33,7 +34,8 @@ export class RenderCoordinator extends Disposable { constructor( private _renderer: IRenderer, private _rowCount: number, - screenElement: HTMLElement + screenElement: HTMLElement, + optionsService: IOptionsService ) { super(); this._renderDebouncer = new RenderDebouncer((start, end) => this._renderRows(start, end)); @@ -43,6 +45,8 @@ export class RenderCoordinator extends Disposable { this._screenDprMonitor.setListener(() => this._renderer.onDevicePixelRatioChange()); this.register(this._screenDprMonitor); + this.register(optionsService.onOptionChange(() => this._renderer.onOptionsChanged())); + // dprchange should handle this case, we need this as well for browsers that don't support the // matchMedia query. this.register(addDisposableDomListener(window, 'resize', () => this._renderer.onDevicePixelRatioChange())); @@ -144,10 +148,6 @@ export class RenderCoordinator extends Disposable { this._renderer.onCursorMove(); } - public onOptionsChanged(): void { - this._renderer.onOptionsChanged(); - } - public clear(): void { this._renderer.clear(); }