Skip to content

Commit 5a5433b

Browse files
committed
Merge branch 'st3'
2 parents d9337eb + 1ba7bbc commit 5a5433b

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

file_diffs.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ class FileDiffCommand(sublime_plugin.TextCommand):
5656
def diff_content(self):
5757
content = ''
5858

59-
regions = [region for region in self.view.sel()]
60-
for region in regions:
59+
for region in self.view.sel():
6160
if region.empty():
6261
continue
6362
content += self.view.substr(region)
@@ -131,16 +130,19 @@ def diff_with_external(self, a, b, from_file=None, to_file=None):
131130
self.view.window().run_command("exec", {"cmd": command})
132131
except Exception as e:
133132
# some basic logging here, since we are cluttering the /tmp folder
134-
print repr(e)
135133
sublime.status_message(str(e))
136134

137135
def diff_in_sublime(self, diffs):
136+
diffs = ''.join(diffs)
138137
scratch = self.view.window().new_file()
139138
scratch.set_scratch(True)
140139
scratch.set_syntax_file('Packages/Diff/Diff.tmLanguage')
141-
scratch_edit = scratch.begin_edit('file_diffs')
142-
scratch.insert(scratch_edit, 0, ''.join(diffs))
143-
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)
144146

145147

146148
class FileDiffClipboardCommand(FileDiffCommand):
@@ -198,8 +200,7 @@ def run(self, edit, **kwargs):
198200
class FileDiffSavedCommand(FileDiffCommand):
199201
def run(self, edit, **kwargs):
200202
content = ''
201-
regions = [region for region in self.view.sel()]
202-
for region in regions:
203+
for region in self.view.sel():
203204
if region.empty():
204205
continue
205206
content += self.view.substr(region)
@@ -235,7 +236,7 @@ def on_done(index):
235236
if index > -1:
236237
self.run_diff(self.diff_content(), files[index],
237238
from_file=self.view.file_name())
238-
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)
239240

240241
def find_files(self, folders):
241242
# Cannot access these settings!! WHY!?
@@ -291,4 +292,4 @@ def on_done(index):
291292
on_done(0)
292293
else:
293294
menu_items = [os.path.basename(f) for f in files]
294-
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)

package.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
{
2-
"repo": "SublimeFileDiffs",
32
"name": "FileDiffs",
43
"description": "Shows diffs - also in an external diff tool - between the current file, or selection(s) in the current file, and clipboard, another file, or unsaved changes.",
5-
"author": "Colin Thomas-Arnold (colinta), Sebastian Pape (spape), Jiri Urban (jiriurban)",
6-
"homepage": "https://github.com/spape/SublimeFileDiffs"
4+
"author": "Colin T.A. Gray (colinta), Sebastian Pape (spape), Jiri Urban (jiriurban)",
5+
"details": "https://github.com/colinta/SublimeFileDiffs",
6+
"labels": ["diff/merge"],
7+
"releases": [
8+
{
9+
"details": "https://github.com/colinta/SublimeFileDiffs/tree/master",
10+
"sublime_text": "<3000"
11+
},
12+
{
13+
"details": "https://github.com/colinta/SublimeFileDiffs/tags",
14+
"sublime_text": ">=3000"
15+
}
16+
]
717
}

0 commit comments

Comments
 (0)