Skip to content

Commit

Permalink
fixed region checking for 'diff selections' command
Browse files Browse the repository at this point in the history
  • Loading branch information
colinta committed Jan 16, 2012
1 parent 25eef42 commit 0ee50f1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions file_diffs.py
Expand Up @@ -23,12 +23,12 @@ class FileDiffMenuCommand(sublime_plugin.TextCommand):
def run(self, edit):
menu_items = FILE_DIFFS[:]
saved = SAVED
regions = self.view.sel()
if len([region for region in regions if not region.empty()]):
non_empty_regions = [region for region in self.view.sel() if not region.empty()]
if len(non_empty_regions) == 2:
menu_items.insert(1, SELECTIONS)
elif len(non_empty_regions):
menu_items = [f.replace(u'Diff file', u'Diff selection') for f in menu_items]
saved = saved.replace(u'Diff file', u'Diff selection')
elif len(regions) == 2:
menu_items.insert(1, SELECTIONS)

if not self.view.file_name():
menu_items.remove(saved)
Expand Down

0 comments on commit 0ee50f1

Please sign in to comment.