Move Terminal option updates into owning components

This commit is contained in:
Daniel Imms
2022-10-09 09:07:01 -07:00
parent 7eead44048
commit 8ac88bc6bf
3 changed files with 24 additions and 36 deletions
+2 -2
View File
@@ -7,6 +7,7 @@ import { IOptionsService } from 'common/services/Services';
import { EventEmitter } from 'common/EventEmitter';
import { ICharSizeService } from 'browser/services/Services';
import { Disposable } from 'common/Lifecycle';
import { ITerminalOptions } from 'common/Types';
export class CharSizeService extends Disposable implements ICharSizeService {
public serviceBrand: undefined;
@@ -27,8 +28,7 @@ export class CharSizeService extends Disposable implements ICharSizeService {
) {
super();
this._measureStrategy = new DomMeasureStrategy(document, parentElement, this._optionsService);
// TODO: ...
// this.register(this._optionsService.onSpecificOptionChange(
this.register(this._optionsService.onMultipleOptionChange(['fontFamily', 'fontSize'], () => this.measure()));
}
public measure(): void {
+22 -2
View File
@@ -84,8 +84,28 @@ export class RenderService extends Disposable implements IRenderService {
this.register(decorationService.onDecorationRegistered(() => this._fullRefresh()));
this.register(decorationService.onDecorationRemoved(() => this._fullRefresh()));
// No need to register this as renderer is explicitly disposed in RenderService.dispose
// this._renderer.onRequestRedraw(e => this.refreshRows(e.start, e.end, true));
// Clear the renderer when the a change that could affect glyphs occurs
this.register(optionsService.onMultipleOptionChange([
'customGlyphs',
'drawBoldTextInBrightColors',
'letterSpacing',
'lineHeight',
'fontFamily',
'fontSize',
'fontWeight',
'fontWeightBold',
'minimumContrastRatio'
], () => {
this.clear();
this.handleResize(bufferService.cols, bufferService.rows);
this._fullRefresh();
}));
// Refresh the cursor line when the cursor changes
this.register(optionsService.onMultipleOptionChange([
'cursorBlink',
'cursorStyle'
], () => this.refreshRows(bufferService.buffer.y, bufferService.buffer.y, true)));
// dprchange should handle this case, we need this as well for browsers that don't support the
// matchMedia query.