This commit is contained in:
rebornix 2021-11-15 17:04:24 -08:00
parent e38fbdae27
commit c775da5f0f
No known key found for this signature in database
GPG key ID: 0299D52A1BBA52AB

View file

@ -408,11 +408,14 @@ export class NotebookTextDiffEditor extends EditorPane implements INotebookTextD
const diffResult = await this.notebookEditorWorkerService.computeDiff(this._model.original.resource, this._model.modified.resource);
NotebookTextDiffEditor.prettyChanges(this._model, diffResult.cellsDiff);
const { viewModels, firstChangeIndex } = NotebookTextDiffEditor.computeDiff(this.instantiationService, this.configurationService, this._model, this._eventDispatcher!, diffResult);
const isSame = this._isViewModelTheSame(viewModels);
this._originalWebview?.removeInsets([...this._originalWebview?.insetMapping.keys()]);
this._modifiedWebview?.removeInsets([...this._modifiedWebview?.insetMapping.keys()]);
if (!isSame) {
this._originalWebview?.removeInsets([...this._originalWebview?.insetMapping.keys()]);
this._modifiedWebview?.removeInsets([...this._modifiedWebview?.insetMapping.keys()]);
this._setViewModel(viewModels);
}
this._setViewModel(viewModels);
// this._diffElementViewModels = viewModels;
// this._list.splice(0, this._list.length, this._diffElementViewModels);
@ -423,7 +426,7 @@ export class NotebookTextDiffEditor extends EditorPane implements INotebookTextD
}
}
private _setViewModel(viewModels: DiffElementViewModelBase[]) {
private _isViewModelTheSame(viewModels: DiffElementViewModelBase[]) {
let isSame = true;
if (this._diffElementViewModels.length === viewModels.length) {
for (let i = 0; i < viewModels.length; i++) {
@ -440,13 +443,12 @@ export class NotebookTextDiffEditor extends EditorPane implements INotebookTextD
isSame = false;
}
if (isSame) {
return;
}
return isSame;
}
private _setViewModel(viewModels: DiffElementViewModelBase[]) {
this._diffElementViewModels = viewModels;
this._list.splice(0, this._list.length, this._diffElementViewModels);
}
/**