diff --git a/src/vs/workbench/contrib/scm/browser/scm.contribution.ts b/src/vs/workbench/contrib/scm/browser/scm.contribution.ts index a927038333b..58a66dda8a0 100644 --- a/src/vs/workbench/contrib/scm/browser/scm.contribution.ts +++ b/src/vs/workbench/contrib/scm/browser/scm.contribution.ts @@ -262,6 +262,13 @@ Registry.as(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."), diff --git a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts index 6228a4d4e4c..1280fc3ee9e 100644 --- a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts +++ b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts @@ -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('scm.showInputActionButton'); if (!this.toolbar || !showInputActionButton || this.toolbar?.isEmpty() === true) {