Skip to content

Commit

Permalink
SCM - fix input flickering (#183440)
Browse files Browse the repository at this point in the history
  • Loading branch information
lszomoru authored May 25, 2023
1 parent 97762b5 commit 52e56ad
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/vs/workbench/contrib/scm/browser/scmViewPane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ class SCMTreeDragAndDrop implements ITreeDragAndDrop<TreeElement> {

interface InputTemplate {
readonly inputWidget: SCMInputWidget;
inputWidgetHeight: number;
readonly elementDisposables: DisposableStore;
readonly templateDisposable: IDisposable;
}
Expand Down Expand Up @@ -258,7 +259,7 @@ class InputRenderer implements ICompressibleTreeRenderer<ISCMInput, FuzzyScore,
const inputWidget = this.instantiationService.createInstance(SCMInputWidget, inputElement, this.overflowWidgetsDomNode);
templateDisposable.add(inputWidget);

return { inputWidget, elementDisposables: new DisposableStore(), templateDisposable };
return { inputWidget, inputWidgetHeight: InputRenderer.DEFAULT_HEIGHT, elementDisposables: new DisposableStore(), templateDisposable };
}

renderElement(node: ITreeNode<ISCMInput, FuzzyScore>, index: number, templateData: InputTemplate): void {
Expand All @@ -268,10 +269,7 @@ class InputRenderer implements ICompressibleTreeRenderer<ISCMInput, FuzzyScore,
// Remember widget
this.inputWidgets.set(input, templateData.inputWidget);
templateData.elementDisposables.add({
dispose: () => {
this.inputWidgets.delete(input);
this.contentHeights.delete(input);
}
dispose: () => this.inputWidgets.delete(input)
});

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

if (lastContentHeight !== contentHeight) {
if (templateData.inputWidgetHeight !== contentHeight) {
this.updateHeight(input, contentHeight + 10);
templateData.inputWidgetHeight = contentHeight;
templateData.inputWidget.layout();
}
};
Expand Down

0 comments on commit 52e56ad

Please sign in to comment.