mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-02 14:31:31 +01:00
Added scm.inputMinLines configuration (#200551)
* added scm.inputMinLines * Update scm.contribution.ts Changed default to 1 per PR reject
This commit is contained in:
@@ -262,6 +262,13 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).regis
|
||||
maximum: 50,
|
||||
default: 10
|
||||
},
|
||||
'scm.inputMinLines': {
|
||||
type: 'number',
|
||||
markdownDescription: localize('inputMinLines', "Controls the minimum number of lines that the input will auto-grow from."),
|
||||
minimum: 1,
|
||||
maximum: 50,
|
||||
default: 1
|
||||
},
|
||||
'scm.alwaysShowRepositories': {
|
||||
type: 'boolean',
|
||||
markdownDescription: localize('alwaysShowRepository', "Controls whether repositories should always be visible in the Source Control view."),
|
||||
|
||||
@@ -2263,7 +2263,8 @@ class SCMInputWidget {
|
||||
}
|
||||
|
||||
getContentHeight(): number {
|
||||
const editorContentHeight = this.inputEditor.getContentHeight();
|
||||
const inputEditorMinHeight = this.getInputEditorMinHeight();
|
||||
const editorContentHeight = Math.max(this.inputEditor.getContentHeight(), inputEditorMinHeight);
|
||||
const editorContextHeightMax = this.getInputEditorMaxHeight();
|
||||
|
||||
return Math.min(editorContentHeight, editorContextHeightMax);
|
||||
@@ -2408,6 +2409,11 @@ class SCMInputWidget {
|
||||
return typeof inputMaxLines === 'number' ? clamp(inputMaxLines, 1, 50) : 10;
|
||||
}
|
||||
|
||||
private getInputEditorMinLines(): number {
|
||||
const inputMinLines = this.configurationService.getValue('scm.inputMinLines');
|
||||
return typeof inputMinLines === 'number' ? clamp(inputMinLines, 1, 50) : 1;
|
||||
}
|
||||
|
||||
private getInputEditorMaxHeight(): number {
|
||||
const maxLines = this.getInputEditorMaxLines();
|
||||
const fontSize = this.getInputEditorFontSize();
|
||||
@@ -2417,6 +2423,15 @@ class SCMInputWidget {
|
||||
return maxLines * lineHeight + top + bottom;
|
||||
}
|
||||
|
||||
private getInputEditorMinHeight(): number {
|
||||
const minLines = this.getInputEditorMinLines();
|
||||
const fontSize = this.getInputEditorFontSize();
|
||||
const lineHeight = this.computeLineHeight(fontSize);
|
||||
const { top, bottom } = this.inputEditor.getOption(EditorOption.padding);
|
||||
|
||||
return minLines * lineHeight + top + bottom;
|
||||
}
|
||||
|
||||
private getToolbarWidth(): number {
|
||||
const showInputActionButton = this.configurationService.getValue<boolean>('scm.showInputActionButton');
|
||||
if (!this.toolbar || !showInputActionButton || this.toolbar?.isEmpty() === true) {
|
||||
|
||||
Reference in New Issue
Block a user