Skip to content

Commit b248644

Browse files
committed
better varnames and use common code
1 parent 34504be commit b248644

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

file_diffs.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ def run(self, edit, content):
152152

153153
class FileDiffClipboardCommand(FileDiffCommand):
154154
def run(self, edit, **kwargs):
155-
current = sublime.get_clipboard()
156-
self.run_diff(self.diff_content(), current,
155+
clipboard = sublime.get_clipboard()
156+
self.run_diff(self.diff_content(), clipboard,
157157
from_file=self.view.file_name(),
158158
to_file='(clipboard)',
159159
external_diff_tool=kwargs.get('cmd', None))
@@ -204,15 +204,7 @@ def run(self, edit, **kwargs):
204204

205205
class FileDiffSavedCommand(FileDiffCommand):
206206
def run(self, edit, **kwargs):
207-
content = ''
208-
for region in self.view.sel():
209-
if region.empty():
210-
continue
211-
content += self.view.substr(region)
212-
if not content:
213-
content = self.view.substr(sublime.Region(0, self.view.size()))
214-
215-
self.run_diff(self.read_file(self.view.file_name()), content,
207+
self.run_diff(self.read_file(self.view.file_name()), self.diff_content(),
216208
from_file=self.view.file_name(),
217209
to_file=self.view.file_name() + u' (Unsaved)',
218210
external_diff_tool=kwargs.get('cmd', None))

0 commit comments

Comments
 (0)