Skip to content

Commit

Permalink
diff: hide "Launch Editor" action for removed files
Browse files Browse the repository at this point in the history
Tune the diff editor context menu in the spirit of git-cola#238.

Signed-off-by: David Aguilar <davvid@gmail.com>
  • Loading branch information
davvid committed Mar 16, 2014
1 parent 0d3f6e9 commit 956b717
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cola/widgets/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def contextMenuEvent(self, event):
"""Create the context menu for the diff display."""
menu = QtGui.QMenu(self)
s = selection.selection()
filename = selection.filename()

if self.model.stageable():
if s.modified and s.modified[0] in main.model().submodules:
Expand Down Expand Up @@ -186,8 +187,13 @@ def contextMenuEvent(self, event):
menu.addAction(self.action_unstage_selection)

if self.model.stageable() or self.model.unstageable():
menu.addSeparator()
menu.addAction(self.launch_editor)
# Do not show the "edit" action when the file does not exist.
# Untracked files exist by definition.
if filename and core.exists(filename):
menu.addSeparator()
menu.addAction(self.launch_editor)

# Removed files can still be diffed.
menu.addAction(self.launch_difftool)

menu.addSeparator()
Expand Down

0 comments on commit 956b717

Please sign in to comment.