Move RenderCoordinator options listener out of Terminal

This commit is contained in:
Daniel Imms
2019-06-01 09:34:13 -07:00
parent 3ba7069787
commit 041bd7a5d1
2 changed files with 6 additions and 12 deletions
+1 -7
View File
@@ -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));
+5 -5
View File
@@ -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();
}