Moves reservedHeight computation into commonEditorConfig.

This commit is contained in:
Henning Dieterichs 2021-11-26 10:55:17 +01:00
parent 42ec6e7924
commit 75d09de705
No known key found for this signature in database
GPG key ID: 771381EFFDB9EC06
3 changed files with 7 additions and 13 deletions

View file

@ -314,7 +314,6 @@ export class Configuration extends CommonEditorConfiguration {
}
private readonly _elementSizeObserver: ElementSizeObserver;
private _reservedHeight: number = 0;
constructor(
isSimpleWidget: boolean,
@ -366,7 +365,7 @@ export class Configuration extends CommonEditorConfiguration {
return {
extraEditorClassName: Configuration._getExtraEditorClassName(),
outerWidth: this._elementSizeObserver.getWidth(),
outerHeight: this._elementSizeObserver.getHeight() - this._reservedHeight,
outerHeight: this._elementSizeObserver.getHeight(),
emptySelectionClipboard: browser.isWebKit || browser.isFirefox,
pixelRatio: browser.getPixelRatio(),
zoomLevel: browser.getZoomLevel(),
@ -381,9 +380,4 @@ export class Configuration extends CommonEditorConfiguration {
protected readConfiguration(bareFontInfo: BareFontInfo): FontInfo {
return CSSBasedConfiguration.INSTANCE.readConfiguration(bareFontInfo);
}
public reserveHeight(height: number) {
this._reservedHeight = height;
this._recomputeOptions();
}
}

View file

@ -313,6 +313,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements IC
private _rawOptions: IEditorOptions;
private _readOptions: RawEditorOptions;
protected _validatedOptions: ValidatedEditorOptions;
private _reservedHeight: number = 0;
constructor(isSimpleWidget: boolean, _options: Readonly<IEditorOptions>) {
super();
@ -367,7 +368,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements IC
const env: IEnvironmentalOptions = {
memory: this._computeOptionsMemory,
outerWidth: partialEnv.outerWidth,
outerHeight: partialEnv.outerHeight,
outerHeight: partialEnv.outerHeight - this._reservedHeight,
fontInfo: this.readConfiguration(bareFontInfo),
extraEditorClassName: partialEnv.extraEditorClassName,
isDominatedByLongLines: this._isDominatedByLongLines,
@ -458,7 +459,10 @@ export abstract class CommonEditorConfiguration extends Disposable implements IC
protected abstract readConfiguration(styling: BareFontInfo): FontInfo;
public abstract reserveHeight(height: number): void;
public reserveHeight(height: number) {
this._reservedHeight = height;
this._recomputeOptions();
}
}
export const editorConfigurationBaseNode = Object.freeze<IConfigurationNode>({

View file

@ -47,8 +47,4 @@ export class TestConfiguration extends CommonEditorConfiguration {
maxDigitWidth: 10,
}, true);
}
public reserveHeight(height: number): void {
throw new Error('Not supported');
}
}