@@ -164,14 +164,25 @@ define(function (require, exports, module) {
164
164
var deferred = new $ . Deferred ( ) ,
165
165
fileEntry = FileSystem . getFileForPath ( entry . file ) ;
166
166
167
- fileEntry . exists ( function ( err , exists ) {
168
- if ( ! err && exists ) {
169
- deferred . resolve ( ) ;
170
- } else {
167
+ if ( entry . inMem ) {
168
+ var indxInWS = MainViewManager . findInWorkingSet ( entry . paneId , entry . file ) ;
169
+ // Remove entry if InMemoryFile is not found in Working set
170
+ if ( indxInWS === - 1 ) {
171
171
_mrofList [ index ] = null ;
172
172
deferred . reject ( ) ;
173
+ } else {
174
+ deferred . resolve ( ) ;
173
175
}
174
- } ) ;
176
+ } else {
177
+ fileEntry . exists ( function ( err , exists ) {
178
+ if ( ! err && exists ) {
179
+ deferred . resolve ( ) ;
180
+ } else {
181
+ _mrofList [ index ] = null ;
182
+ deferred . reject ( ) ;
183
+ }
184
+ } ) ;
185
+ }
175
186
176
187
return deferred . promise ( ) ;
177
188
}
@@ -569,7 +580,9 @@ define(function (require, exports, module) {
569
580
* @private
570
581
* @param {Editor } editor - editor to extract file information
571
582
*/
572
- function _addToMROFList ( filePath , paneId , cursorPos ) {
583
+ function _addToMROFList ( file , paneId , cursorPos ) {
584
+
585
+ var filePath = file . fullPath ;
573
586
574
587
if ( ! paneId ) { // Don't handle this if not a full view/editor
575
588
return ;
@@ -591,6 +604,13 @@ define(function (require, exports, module) {
591
604
592
605
entry = _makeMROFListEntry ( filePath , paneId , cursorPos ) ;
593
606
607
+ // Check if the file is an InMemoryFile
608
+ if ( file . constructor . name === "InMemoryFile" ) {
609
+ // Mark the entry as inMem, so that we can knock it off from the list when removed from working set
610
+ entry . inMem = true ;
611
+ }
612
+
613
+
594
614
if ( index !== - 1 ) {
595
615
_mrofList . splice ( index , 1 ) ;
596
616
}
@@ -600,7 +620,6 @@ define(function (require, exports, module) {
600
620
601
621
PreferencesManager . setViewState ( OPEN_FILES_VIEW_STATE , _mrofList , _getPrefsContext ( ) , true ) ;
602
622
}
603
-
604
623
605
624
// To update existing entry if a move has happened
606
625
function _handleWorkingSetMove ( event , file , sourcePaneId , destinationPaneId ) {
@@ -755,7 +774,7 @@ define(function (require, exports, module) {
755
774
_initRecentFilesList ( ) ;
756
775
}
757
776
758
- _addToMROFList ( newFile . fullPath , newPaneId ) ;
777
+ _addToMROFList ( newFile , newPaneId ) ;
759
778
}
760
779
}
761
780
@@ -766,9 +785,9 @@ define(function (require, exports, module) {
766
785
_initRecentFilesList ( ) ;
767
786
}
768
787
769
- var filePath = current . document . file . fullPath ;
788
+ var file = current . document . file ;
770
789
var paneId = current . _paneId ;
771
- _addToMROFList ( filePath , paneId , current . getCursorPos ( true , "first" ) ) ;
790
+ _addToMROFList ( file , paneId , current . getCursorPos ( true , "first" ) ) ;
772
791
}
773
792
774
793
if ( previous ) { // Capture the last know cursor position
0 commit comments