@@ -133,12 +133,16 @@ def diff_with_external(self, a, b, from_file=None, to_file=None):
133133 sublime .status_message (str (e ))
134134
135135 def diff_in_sublime (self , diffs ):
136+ diffs = '' .join (diffs )
136137 scratch = self .view .window ().new_file ()
137138 scratch .set_scratch (True )
138139 scratch .set_syntax_file ('Packages/Diff/Diff.tmLanguage' )
139- scratch_edit = scratch .begin_edit ('file_diffs' )
140- scratch .insert (scratch_edit , 0 , '' .join (diffs ))
141- scratch .end_edit (scratch_edit )
140+ scratch .run_command ('file_diff_dummy1' , {'content' : diffs })
141+
142+
143+ class FileDiffDummy1Command (sublime_plugin .TextCommand ):
144+ def run (self , edit , content ):
145+ self .view .insert (edit , 0 , content )
142146
143147
144148class FileDiffClipboardCommand (FileDiffCommand ):
@@ -232,7 +236,7 @@ def on_done(index):
232236 if index > - 1 :
233237 self .run_diff (self .diff_content (), files [index ],
234238 from_file = self .view .file_name ())
235- self .view .window ().show_quick_panel (file_picker , on_done )
239+ sublime . set_timeout ( lambda : self .view .window ().show_quick_panel (file_picker , on_done ), 1 )
236240
237241 def find_files (self , folders ):
238242 # Cannot access these settings!! WHY!?
@@ -288,4 +292,4 @@ def on_done(index):
288292 on_done (0 )
289293 else :
290294 menu_items = [os .path .basename (f ) for f in files ]
291- self .view .window ().show_quick_panel (menu_items , on_done )
295+ sublime . set_timeout ( lambda : self .view .window ().show_quick_panel (menu_items , on_done ), 1 )
0 commit comments