Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraamunger <aamunger@microsoft.com>2022-04-12 22:46:09 +0300
committeraamunger <aamunger@microsoft.com>2022-04-13 19:12:35 +0300
commitfe38a7b3bd41d5f7fe0e29579308f625d68ea170 (patch)
tree97d568f5a1b1df6cb0c392e289886a5ee3aedd2b /src/vs/workbench/contrib/notebook/common
parent51ab78f535d8537e031e1ae77cac678ae22b0249 (diff)
line height as ratio when < 8
Diffstat (limited to 'src/vs/workbench/contrib/notebook/common')
-rw-r--r--src/vs/workbench/contrib/notebook/common/notebookCommon.ts2
-rw-r--r--src/vs/workbench/contrib/notebook/common/notebookOptions.ts42
2 files changed, 28 insertions, 16 deletions
diff --git a/src/vs/workbench/contrib/notebook/common/notebookCommon.ts b/src/vs/workbench/contrib/notebook/common/notebookCommon.ts
index 121ac0689da..5f70d558da1 100644
--- a/src/vs/workbench/contrib/notebook/common/notebookCommon.ts
+++ b/src/vs/workbench/contrib/notebook/common/notebookCommon.ts
@@ -916,7 +916,7 @@ export const NotebookSetting = {
interactiveWindowCollapseCodeCells: 'interactiveWindow.collapseCellInputCode',
outputLineHeight: 'notebook.outputLineHeight',
outputFontSize: 'notebook.outputFontSize',
- outputFontFamily: 'notebook.fontFamily'
+ outputFontFamily: 'notebook.outputFontFamily'
} as const;
export const enum CellStatusbarAlignment {
diff --git a/src/vs/workbench/contrib/notebook/common/notebookOptions.ts b/src/vs/workbench/contrib/notebook/common/notebookOptions.ts
index b7c9b89a926..2964a52df79 100644
--- a/src/vs/workbench/contrib/notebook/common/notebookOptions.ts
+++ b/src/vs/workbench/contrib/notebook/common/notebookOptions.ts
@@ -88,8 +88,6 @@ export interface NotebookOptionsChangeEvent {
readonly dragAndDropEnabled?: boolean;
readonly fontSize?: boolean;
readonly outputFontSize?: boolean;
- readonly fontFamily?: boolean;
- readonly outputFontFamily?: boolean;
readonly markupFontSize?: boolean;
readonly editorOptionsCustomizations?: boolean;
readonly interactiveWindowCollapseCodeCells?: boolean;
@@ -146,7 +144,7 @@ export class NotebookOptions extends Disposable {
const markupFontSize = this.configurationService.getValue<number>(NotebookSetting.markupFontSize);
const editorOptionsCustomizations = this.configurationService.getValue(NotebookSetting.cellEditorOptionsCustomizations);
const interactiveWindowCollapseCodeCells: InteractiveWindowCollapseCodeCells = this.configurationService.getValue(NotebookSetting.interactiveWindowCollapseCodeCells);
- const outputLineHeight = this.configurationService.getValue<number>(NotebookSetting.outputLineHeight);
+ const outputLineHeight = this._computeOutputLineHeight();
this._layoutConfiguration = {
...(compactView ? compactConfigConstants : defaultConfigConstants),
@@ -198,6 +196,29 @@ export class NotebookOptions extends Disposable {
}));
}
+ private _computeOutputLineHeight(): number {
+ const minimumLineHeight = 8;
+ let lineHeight = this.configurationService.getValue<number>(NotebookSetting.outputLineHeight);
+
+ if (lineHeight < minimumLineHeight) {
+ // Values too small to be line heights in pixels are in ems.
+ let fontSize = this.configurationService.getValue<number>(NotebookSetting.outputFontSize);
+ if (fontSize === 0) {
+ fontSize = this.configurationService.getValue<number>('editor.fontSize');
+ }
+
+ lineHeight = lineHeight * fontSize;
+ }
+
+ // Enforce integer, minimum constraints
+ lineHeight = Math.round(lineHeight);
+ if (lineHeight < minimumLineHeight) {
+ lineHeight = minimumLineHeight;
+ }
+
+ return lineHeight;
+ }
+
private _updateConfiguration(e: IConfigurationChangeEvent) {
const cellStatusBarVisibility = e.affectsConfiguration(NotebookSetting.showCellStatusBar);
const cellToolbarLocation = e.affectsConfiguration(NotebookSetting.cellToolbarLocation);
@@ -213,8 +234,6 @@ export class NotebookOptions extends Disposable {
const dragAndDropEnabled = e.affectsConfiguration(NotebookSetting.dragAndDropEnabled);
const fontSize = e.affectsConfiguration('editor.fontSize');
const outputFontSize = e.affectsConfiguration(NotebookSetting.outputFontSize);
- const fontFamily = e.affectsConfiguration('editor.fontFamily');
- const outputFontFamily = e.affectsConfiguration(NotebookSetting.outputFontFamily);
const markupFontSize = e.affectsConfiguration(NotebookSetting.markupFontSize);
const editorOptionsCustomizations = e.affectsConfiguration(NotebookSetting.cellEditorOptionsCustomizations);
const interactiveWindowCollapseCodeCells = e.affectsConfiguration(NotebookSetting.interactiveWindowCollapseCodeCells);
@@ -236,8 +255,6 @@ export class NotebookOptions extends Disposable {
&& !dragAndDropEnabled
&& !fontSize
&& !outputFontSize
- && !fontFamily
- && !outputFontFamily
&& !markupFontSize
&& !editorOptionsCustomizations
&& !interactiveWindowCollapseCodeCells
@@ -304,11 +321,7 @@ export class NotebookOptions extends Disposable {
}
if (outputFontSize) {
- configuration.outputFontSize = this.configurationService.getValue<number>(NotebookSetting.outputFontSize);
- }
-
- if (outputFontFamily) {
- configuration.outputFontFamily = this.configurationService.getValue<string>(NotebookSetting.outputFontFamily);
+ configuration.outputFontSize = this.configurationService.getValue<number>(NotebookSetting.outputFontSize) ?? configuration.fontSize;
}
if (markupFontSize) {
@@ -323,8 +336,8 @@ export class NotebookOptions extends Disposable {
configuration.interactiveWindowCollapseCodeCells = this.configurationService.getValue(NotebookSetting.interactiveWindowCollapseCodeCells);
}
- if (outputLineHeight) {
- configuration.outputLineHeight = this.configurationService.getValue<number>(NotebookSetting.outputLineHeight);
+ if (outputLineHeight || fontSize || outputFontSize) {
+ configuration.outputLineHeight = this._computeOutputLineHeight();
}
this._layoutConfiguration = Object.freeze(configuration);
@@ -346,7 +359,6 @@ export class NotebookOptions extends Disposable {
dragAndDropEnabled,
fontSize,
outputFontSize,
- outputFontFamily,
markupFontSize,
editorOptionsCustomizations,
interactiveWindowCollapseCodeCells,