This commit is contained in:
Benjamin Pasero
2016-11-02 10:18:15 +01:00
parent c5c0c39d9a
commit 43f86ea354
3 changed files with 10 additions and 8 deletions

View File

@@ -75,7 +75,11 @@ export class UntitledEditorInput extends AbstractUntitledEditorInput {
}
public isDirty(): boolean {
return this.cachedModel && this.cachedModel.isDirty();
if (this.cachedModel) {
return this.cachedModel.isDirty();
}
return this.hasAssociatedFilePath; // untitled files with associated path are always dirty
}
public confirmSave(): ConfirmResult {

View File

@@ -127,13 +127,6 @@ export class UntitledEditorModel extends StringEditorModel implements IEncodingS
// Listen to content changes
this.textModelChangeListener = this.textEditorModel.onDidChangeContent(e => this.onModelContentChanged());
// Emit initial dirty event if we are
if (this.dirty) {
setTimeout(() => {
this._onDidChangeDirty.fire();
}, 0 /* prevent race condition between creating model and emitting dirty event */);
}
return model;
});
}