mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 19:18:59 +01:00
fixes #14835
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user