Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add settings for SCM input font family #97139

Merged
merged 5 commits into from May 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 19 additions & 2 deletions src/vs/workbench/contrib/scm/browser/repositoryPane.ts
Expand Up @@ -638,6 +638,7 @@ export class ToggleViewModeAction extends Action {
}

export class RepositoryPane extends ViewPane {
private readonly defaultInputFontFamily = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "Ubuntu", "Droid Sans", sans-serif';

private cachedHeight: number | undefined = undefined;
private cachedWidth: number | undefined = undefined;
Expand Down Expand Up @@ -766,13 +767,12 @@ export class RepositoryPane extends ViewPane {
cursorWidth: 1,
fontSize: 13,
lineHeight: 20,
fontFamily: ' system-ui, -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "Ubuntu", "Droid Sans", sans-serif',
fontFamily: this.getInputEditorFontFamily(),
wrappingStrategy: 'advanced',
wrappingIndent: 'none',
padding: { top: 3, bottom: 3 },
quickSuggestions: false
};

const codeEditorWidgetOptions: ICodeEditorWidgetOptions = {
isSimpleWidget: true,
contributions: EditorExtensionsRegistry.getSomeEditorContributions([
Expand All @@ -796,6 +796,9 @@ export class RepositoryPane extends ViewPane {
this._register(this.inputEditor.onDidFocusEditorText(() => addClass(editorContainer, 'synthetic-focus')));
this._register(this.inputEditor.onDidBlurEditorText(() => removeClass(editorContainer, 'synthetic-focus')));

const onInputFontFamilyChanged = Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('scm.inputFontFamily'));
this._register(onInputFontFamilyChanged(() => this.inputEditor.updateOptions({ fontFamily: this.getInputEditorFontFamily() })));

let query: string | undefined;

if (this.repository.provider.rootUri) {
Expand Down Expand Up @@ -1114,6 +1117,20 @@ export class RepositoryPane extends ViewPane {
this.layoutBody(this.cachedHeight);
}
}

private getInputEditorFontFamily(): string {
const inputFontFamily = this.configurationService.getValue<string>('scm.inputFontFamily');

if (inputFontFamily.toLowerCase() === 'inherit') {
return this.configurationService.getValue<string>('editor.fontFamily');
}

if (inputFontFamily.length !== 0 && inputFontFamily.toLowerCase() !== 'default') {
return inputFontFamily;
}

return this.defaultInputFontFamily;
}
}

export class RepositoryViewDescriptor implements IViewDescriptor {
Expand Down
5 changes: 5 additions & 0 deletions src/vs/workbench/contrib/scm/browser/scm.contribution.ts
Expand Up @@ -150,6 +150,11 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).regis
description: localize('autoReveal', "Controls whether the SCM view should automatically reveal and select files when opening them."),
default: true
},
'scm.inputFontFamily': {
type: 'string',
description: localize('inputFontFamily', "Controls the font for the input message."),
default: 'default'
}
}
});

Expand Down