diff --git a/src/vs/base/browser/ui/inputbox/inputBox.ts b/src/vs/base/browser/ui/inputbox/inputBox.ts index c8e68ec4320..77c198e4600 100644 --- a/src/vs/base/browser/ui/inputbox/inputBox.ts +++ b/src/vs/base/browser/ui/inputbox/inputBox.ts @@ -131,7 +131,7 @@ export class InputBox extends ee.EventEmitter { } } - setTimeout(() =>this.adjustHeight(), 0); + setTimeout(() =>this.layout(), 0); // Support actions if (this.options.actions) { @@ -324,19 +324,22 @@ export class InputBox extends ee.EventEmitter { var lastCharCode = this.value.charCodeAt(this.value.length - 1); var suffix = lastCharCode === 10 ? ' ' : ''; this.mirror.textContent = this.value + suffix; - this.adjustHeight(); + this.layout(); } } - private adjustHeight(): void { + public layout(): void { if (!this.mirror) { return; } + const previousHeight = this.cachedHeight; this.cachedHeight = dom.getTotalHeight(this.mirror); - this.input.style.height = this.cachedHeight + 'px'; - this.emit('heightchange', this.cachedHeight); + if (previousHeight !== this.cachedHeight) { + this.input.style.height = this.cachedHeight + 'px'; + this.emit('heightchange', this.cachedHeight); + } } public dispose(): void { diff --git a/src/vs/workbench/parts/git/browser/views/changes/changesView.ts b/src/vs/workbench/parts/git/browser/views/changes/changesView.ts index a2778356629..bcb9a31521c 100644 --- a/src/vs/workbench/parts/git/browser/views/changes/changesView.ts +++ b/src/vs/workbench/parts/git/browser/views/changes/changesView.ts @@ -197,6 +197,7 @@ export class ChangesView extends EventEmitter.EventEmitter implements GitView.IV this.currentDimension = dimension; + this.commitInputBox.layout(); var statusViewHeight = dimension.height - (this.commitInputBox.height + 10 /* margin */); this.$statusView.size(dimension.width, statusViewHeight); this.tree.layout(statusViewHeight);