Skip to content

Commit 604f370

Browse files
authored
SCM - fix input box action button regression (microsoft#199739) (microsoft#199743)
1 parent 621d89f commit 604f370

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/vs/workbench/contrib/scm/browser/scmViewPane.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2088,9 +2088,6 @@ class SCMInputWidget {
20882088
this.actionBar.push(action, { icon: true, label: false });
20892089
}
20902090

2091-
const showInputActionButton = this.configurationService.getValue<boolean>('scm.showInputActionButton') === true;
2092-
this.actionBar.domNode.classList.toggle('hidden', !showInputActionButton || this.actionBar.isEmpty());
2093-
20942091
this.layout();
20952092
};
20962093

@@ -2330,7 +2327,7 @@ class SCMInputWidget {
23302327

23312328
layout(): void {
23322329
const editorHeight = this.getContentHeight();
2333-
const toolbarWidth = this.toolbarContainer.clientWidth;
2330+
const toolbarWidth = this.getToolbarWidth();
23342331
const dimension = new Dimension(this.element.clientWidth - toolbarWidth, editorHeight);
23352332

23362333
if (dimension.width < 0) {
@@ -2343,6 +2340,9 @@ class SCMInputWidget {
23432340
this.placeholderTextContainer.style.width = `${dimension.width}px`;
23442341
this.renderValidation();
23452342

2343+
this.actionBar.domNode.classList.toggle('hidden', this.actionBar.isEmpty());
2344+
this.toolbarContainer.classList.toggle('hidden', this.configurationService.getValue<boolean>('scm.showInputActionButton') === false);
2345+
23462346
if (this.shouldFocusAfterLayout) {
23472347
this.shouldFocusAfterLayout = false;
23482348
this.focus();
@@ -2473,6 +2473,17 @@ class SCMInputWidget {
24732473
return maxLines * lineHeight + top + bottom;
24742474
}
24752475

2476+
private getToolbarWidth(): number {
2477+
const showInputActionButton = this.configurationService.getValue<boolean>('scm.showInputActionButton');
2478+
const actionCount = this.toolbarContextKeyService.getContextKeyValue<number>(SCMInputContextKeys.ActionCount.key) ?? 0;
2479+
2480+
if (!showInputActionButton || (this.actionBar.isEmpty() && actionCount === 0)) {
2481+
return 0;
2482+
}
2483+
2484+
return 26; /* 22px action + 4px margin */
2485+
}
2486+
24762487
private computeLineHeight(fontSize: number): number {
24772488
return Math.round(fontSize * 1.5);
24782489
}

0 commit comments

Comments
 (0)