Fixes #67214
This commit is contained in:
parent
9fd249ad85
commit
b574eeaf66
5 changed files with 16 additions and 8 deletions
|
@ -320,8 +320,13 @@ export class Configuration extends CommonEditorConfiguration {
|
|||
|
||||
private readonly _elementSizeObserver: ElementSizeObserver;
|
||||
|
||||
constructor(options: IEditorOptions, referenceDomElement: HTMLElement | null = null, private readonly accessibilityService: IAccessibilityService) {
|
||||
super(options);
|
||||
constructor(
|
||||
isSimpleWidget: boolean,
|
||||
options: IEditorOptions,
|
||||
referenceDomElement: HTMLElement | null = null,
|
||||
private readonly accessibilityService: IAccessibilityService
|
||||
) {
|
||||
super(isSimpleWidget, options);
|
||||
|
||||
this._elementSizeObserver = this._register(new ElementSizeObserver(referenceDomElement, () => this._onReferenceDomElementSizeChanged()));
|
||||
|
||||
|
|
|
@ -324,7 +324,7 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
|
|||
}
|
||||
|
||||
protected _createConfiguration(options: editorOptions.IEditorOptions, accessibilityService: IAccessibilityService): editorCommon.IConfiguration {
|
||||
return new Configuration(options, this._domElement, accessibilityService);
|
||||
return new Configuration(this.isSimpleWidget, options, this._domElement, accessibilityService);
|
||||
}
|
||||
|
||||
public getId(): string {
|
||||
|
|
|
@ -65,6 +65,7 @@ const hasOwnProperty = Object.hasOwnProperty;
|
|||
|
||||
export abstract class CommonEditorConfiguration extends Disposable implements editorCommon.IConfiguration {
|
||||
|
||||
public readonly isSimpleWidget: boolean;
|
||||
protected _rawOptions: editorOptions.IEditorOptions;
|
||||
protected _validatedOptions: editorOptions.IValidatedEditorOptions;
|
||||
public editor: editorOptions.InternalEditorOptions;
|
||||
|
@ -74,9 +75,11 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
|
|||
private _onDidChange = this._register(new Emitter<editorOptions.IConfigurationChangedEvent>());
|
||||
public readonly onDidChange: Event<editorOptions.IConfigurationChangedEvent> = this._onDidChange.event;
|
||||
|
||||
constructor(options: editorOptions.IEditorOptions) {
|
||||
constructor(isSimpleWidget: boolean, options: editorOptions.IEditorOptions) {
|
||||
super();
|
||||
|
||||
this.isSimpleWidget = isSimpleWidget;
|
||||
|
||||
// Do a "deep clone of sorts" on the incoming options
|
||||
this._rawOptions = objects.mixin({}, options || {});
|
||||
this._rawOptions.scrollbar = objects.mixin({}, this._rawOptions.scrollbar || {});
|
||||
|
@ -122,7 +125,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
|
|||
private _computeInternalOptions(): editorOptions.InternalEditorOptions {
|
||||
const opts = this._validatedOptions;
|
||||
const partialEnv = this._getEnvConfiguration();
|
||||
const bareFontInfo = BareFontInfo.createFromRawSettings(this._rawOptions, partialEnv.zoomLevel);
|
||||
const bareFontInfo = BareFontInfo.createFromRawSettings(this._rawOptions, partialEnv.zoomLevel, this.isSimpleWidget);
|
||||
const env: editorOptions.IEnvironmentalOptions = {
|
||||
outerWidth: partialEnv.outerWidth,
|
||||
outerHeight: partialEnv.outerHeight,
|
||||
|
|
|
@ -80,7 +80,7 @@ export class BareFontInfo {
|
|||
fontSize?: number | string;
|
||||
lineHeight?: number | string;
|
||||
letterSpacing?: number | string;
|
||||
}, zoomLevel: number): BareFontInfo {
|
||||
}, zoomLevel: number, ignoreEditorZoom: boolean = false): BareFontInfo {
|
||||
|
||||
let fontFamily = _string(opts.fontFamily, EDITOR_FONT_DEFAULTS.fontFamily);
|
||||
let fontWeight = _string(opts.fontWeight, EDITOR_FONT_DEFAULTS.fontWeight);
|
||||
|
@ -105,7 +105,7 @@ export class BareFontInfo {
|
|||
let letterSpacing = safeParseFloat(opts.letterSpacing, 0);
|
||||
letterSpacing = clamp(letterSpacing, MINIMUM_LETTER_SPACING, MAXIMUM_LETTER_SPACING);
|
||||
|
||||
let editorZoomLevelMultiplier = 1 + (EditorZoom.getZoomLevel() * 0.1);
|
||||
let editorZoomLevelMultiplier = 1 + (ignoreEditorZoom ? 0 : EditorZoom.getZoomLevel() * 0.1);
|
||||
fontSize *= editorZoomLevelMultiplier;
|
||||
lineHeight *= editorZoomLevelMultiplier;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import { AccessibilitySupport } from 'vs/platform/accessibility/common/accessibi
|
|||
export class TestConfiguration extends CommonEditorConfiguration {
|
||||
|
||||
constructor(opts: IEditorOptions) {
|
||||
super(opts);
|
||||
super(false, opts);
|
||||
this._recomputeOptions();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue