diff --git a/src/blameActiveLineController.ts b/src/blameActiveLineController.ts index b81352e..dd257bf 100644 --- a/src/blameActiveLineController.ts +++ b/src/blameActiveLineController.ts @@ -157,10 +157,6 @@ export class BlameActiveLineController extends Disposable { // Make sure this is for the editor we are tracking if (!TextEditorComparer.equals(this._editor, e.editor)) return; - const line = this._editor.selection.active.line; - if (line === this._currentLine) return; - this._currentLine = line; - this._updateBlame(this._editor.selection.active.line, this._editor); } diff --git a/src/blameabilityTracker.ts b/src/blameabilityTracker.ts index 1ea89f6..f427ae8 100644 --- a/src/blameabilityTracker.ts +++ b/src/blameabilityTracker.ts @@ -62,15 +62,20 @@ export class BlameabilityTracker extends Disposable { private _onTextDocumentChanged(e: TextDocumentChangeEvent) { if (!TextDocumentComparer.equals(this._editor && this._editor.document, e && e.document)) return; - this._unsubscribeToDocumentChanges(); - this.updateBlameability(false); + // Can't unsubscribe here because undo doesn't trigger any other event + //this._unsubscribeToDocumentChanges(); + //this.updateBlameability(false); + + // We have to defer because isDirty is not reliable inside this event + setTimeout(() => this.updateBlameability(!e.document.isDirty), 1); } private _onTextDocumentSaved(e: TextDocument) { if (!TextDocumentComparer.equals(this._editor && this._editor.document, e)) return; - this._subscribeToDocumentChanges(); - this.updateBlameability(true); + // Don't need to resubscribe as we aren't unsubscribing on document changes anymore + //this._subscribeToDocumentChanges(); + this.updateBlameability(!e.isDirty); } private _subscribeToDocumentChanges() {