File tree 1 file changed +12
-2
lines changed
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 13
13
WRITE_TEMP_FILE_ERROR = "Failed to write to temp file! Error: {}"
14
14
CONNECTION_LOST = "Connection to {} is lost."
15
15
FILES = {}
16
+ LOST_FILES = {}
16
17
server = None
17
18
18
19
@@ -83,6 +84,12 @@ def get_temp_dir(self):
83
84
f .host and f .host == self .host :
84
85
return f .temp_dir
85
86
87
+ for vid , f in LOST_FILES .items ():
88
+ if f .env ["real-path" ] and f .env ["real-path" ] == self .env ["real-path" ] and \
89
+ f .host and f .host == self .host :
90
+ LOST_FILES .pop (vid )
91
+ return f .temp_dir
92
+
86
93
# Create a secure temporary directory, both for privacy and to allow
87
94
# multiple files with the same basename to be edited at once without
88
95
# overwriting each other.
@@ -228,8 +235,11 @@ def on_close(self, view):
228
235
base_name = view .settings ().get ('remote_subl.base_name' )
229
236
if base_name :
230
237
host = view .settings ().get ('remote_subl.host' , "remote server" )
238
+ vid = view .id ()
239
+ if vid in LOST_FILES :
240
+ LOST_FILES .pop (vid )
231
241
try :
232
- file = FILES .pop (view . id () )
242
+ file = FILES .pop (vid )
233
243
file .close ()
234
244
say ('Closed {} in {}.' .format (base_name , host ))
235
245
except Exception :
@@ -285,7 +295,7 @@ def cleanup(self, session):
285
295
vid_to_pop .append (vid )
286
296
287
297
for vid in vid_to_pop :
288
- FILES .pop (vid )
298
+ LOST_FILES [ vid ] = FILES .pop (vid )
289
299
sublime .View (vid ).run_command ("remote_subl_update_status_bar" )
290
300
291
301
You can’t perform that action at this time.
0 commit comments