Adopt onSpecificOptionChange

This commit is contained in:
Daniel Imms
2022-10-09 07:46:10 -07:00
parent cad9c4164c
commit 415100e8b8
8 changed files with 18 additions and 53 deletions
+2 -5
View File
@@ -265,8 +265,6 @@ export class Terminal extends CoreTerminal implements ITerminal {
}
protected _updateOptions(key: string): void {
super._updateOptions(key);
// TODO: These listeners should be owned by individual components
switch (key) {
case 'fontFamily':
@@ -307,7 +305,6 @@ export class Terminal extends CoreTerminal implements ITerminal {
this._accessibilityManager = undefined;
}
break;
case 'tabStopWidth': this.buffers.setupTabStops(); break;
}
}
@@ -584,8 +581,8 @@ export class Terminal extends CoreTerminal implements ITerminal {
if (this.options.overviewRulerWidth) {
this._overviewRulerRenderer = this.register(this._instantiationService.createInstance(OverviewRulerRenderer, this._viewportElement, this.screenElement));
}
this.optionsService.onOptionChange(() => {
if (!this._overviewRulerRenderer && this.options.overviewRulerWidth && this._viewportElement && this.screenElement) {
this.optionsService.onSpecificOptionChange('overviewRulerWidth', value => {
if (!this._overviewRulerRenderer && value && this._viewportElement && this.screenElement) {
this._overviewRulerRenderer = this.register(this._instantiationService.createInstance(OverviewRulerRenderer, this._viewportElement, this.screenElement));
}
});
@@ -110,15 +110,9 @@ export class OverviewRulerRenderer extends Disposable {
}
}));
// overview ruler width changed
this.register(this._optionsService.onOptionChange(o => {
if (o === 'overviewRulerWidth') {
this._queueRefresh(true);
}
}));
this.register(this._optionsService.onSpecificOptionChange('overviewRulerWidth', () => this._queueRefresh(true)));
// device pixel ratio changed
this.register(addDisposableDomListener(this._coreBrowseService.window, 'resize', () => {
this._queueRefresh(true);
}));
this.register(addDisposableDomListener(this._coreBrowseService.window, 'resize', () => this._queueRefresh(true)));
// set the canvas dimensions
this._queueRefresh(true);
}
+2 -10
View File
@@ -111,16 +111,8 @@ export class ThemeService extends Disposable implements IThemeService {
this._updateRestoreColors();
this._setTheme(this._optionsService.rawOptions.theme);
this.register(this._optionsService.onOptionChange(key => {
switch (key) {
case 'minimumContrastRatio':
this._contrastCache.clear();
break;
case 'theme':
this._setTheme(this._optionsService.rawOptions.theme);
break;
}
}));
this.register(this._optionsService.onSpecificOptionChange('minimumContrastRatio', () => this._contrastCache.clear()));
this.register(this._optionsService.onSpecificOptionChange('theme', () => this._setTheme(this._optionsService.rawOptions.theme)));
}
/**