@@ -9,7 +9,6 @@ import {TPromise} from 'vs/base/common/winjs.base';
99import { EditorModel , IEncodingSupport } from 'vs/workbench/common/editor' ;
1010import { StringEditorModel } from 'vs/workbench/common/editor/stringEditorModel' ;
1111import URI from 'vs/base/common/uri' ;
12- import { IModelContentChangedEvent2 } from 'vs/editor/common/editorCommon' ;
1312import { EventType , EndOfLinePreference } from 'vs/editor/common/editorCommon' ;
1413import { EventType as WorkbenchEventType , ResourceEvent } from 'vs/workbench/common/events' ;
1514import { IFilesConfiguration } from 'vs/platform/files/common/files' ;
@@ -123,7 +122,7 @@ export class UntitledEditorModel extends StringEditorModel implements IEncodingS
123122 this . configuredEncoding = configuration && configuration . files && configuration . files . encoding ;
124123
125124 // Listen to content changes
126- this . textModelChangeListener = this . textEditorModel . onDidChangeContent ( e => this . onModelContentChanged ( e ) ) ;
125+ this . textModelChangeListener = this . textEditorModel . onDidChangeContent ( e => this . onModelContentChanged ( ) ) ;
127126
128127 // Emit initial dirty event if we are
129128 if ( this . dirty ) {
@@ -136,7 +135,7 @@ export class UntitledEditorModel extends StringEditorModel implements IEncodingS
136135 } ) ;
137136 }
138137
139- private onModelContentChanged ( e : IModelContentChangedEvent2 ) : void {
138+ private onModelContentChanged ( ) : void {
140139
141140 // turn dirty if we were not
142141 if ( ! this . dirty ) {
@@ -146,7 +145,7 @@ export class UntitledEditorModel extends StringEditorModel implements IEncodingS
146145
147146 // mark the untitled editor as non-dirty once its content becomes empty and we do
148147 // not have an associated path set
149- else if ( ! this . hasAssociatedFilePath && ! e . text && this . textEditorModel . getValueLength ( ) === 0 ) {
148+ else if ( ! this . hasAssociatedFilePath && this . textEditorModel . getLineCount ( ) === 1 && this . textEditorModel . getLineContent ( 1 ) === '' ) {
150149 this . dirty = false ;
151150 this . _onDidChangeDirty . fire ( ) ;
152151 }
0 commit comments