Skip to content

Commit 52e56ad

Browse files
authored
SCM - fix input flickering (microsoft#183440)
1 parent 97762b5 commit 52e56ad

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ class SCMTreeDragAndDrop implements ITreeDragAndDrop<TreeElement> {
224224

225225
interface InputTemplate {
226226
readonly inputWidget: SCMInputWidget;
227+
inputWidgetHeight: number;
227228
readonly elementDisposables: DisposableStore;
228229
readonly templateDisposable: IDisposable;
229230
}
@@ -258,7 +259,7 @@ class InputRenderer implements ICompressibleTreeRenderer<ISCMInput, FuzzyScore,
258259
const inputWidget = this.instantiationService.createInstance(SCMInputWidget, inputElement, this.overflowWidgetsDomNode);
259260
templateDisposable.add(inputWidget);
260261

261-
return { inputWidget, elementDisposables: new DisposableStore(), templateDisposable };
262+
return { inputWidget, inputWidgetHeight: InputRenderer.DEFAULT_HEIGHT, elementDisposables: new DisposableStore(), templateDisposable };
262263
}
263264

264265
renderElement(node: ITreeNode<ISCMInput, FuzzyScore>, index: number, templateData: InputTemplate): void {
@@ -268,10 +269,7 @@ class InputRenderer implements ICompressibleTreeRenderer<ISCMInput, FuzzyScore,
268269
// Remember widget
269270
this.inputWidgets.set(input, templateData.inputWidget);
270271
templateData.elementDisposables.add({
271-
dispose: () => {
272-
this.inputWidgets.delete(input);
273-
this.contentHeights.delete(input);
274-
}
272+
dispose: () => this.inputWidgets.delete(input)
275273
});
276274

277275
// Widget cursor selections
@@ -292,11 +290,11 @@ class InputRenderer implements ICompressibleTreeRenderer<ISCMInput, FuzzyScore,
292290
// Rerender the element whenever the editor content height changes
293291
const onDidChangeContentHeight = () => {
294292
const contentHeight = templateData.inputWidget.getContentHeight();
295-
const lastContentHeight = this.contentHeights.get(input)!;
296293
this.contentHeights.set(input, contentHeight);
297294

298-
if (lastContentHeight !== contentHeight) {
295+
if (templateData.inputWidgetHeight !== contentHeight) {
299296
this.updateHeight(input, contentHeight + 10);
297+
templateData.inputWidgetHeight = contentHeight;
300298
templateData.inputWidget.layout();
301299
}
302300
};

0 commit comments

Comments
 (0)