Commit b7407565 authored by Kai Willadsen's avatar Kai Willadsen

Handle activating fake lines in directory comparison

We get fake lines in DirDiff when we have empty folders. This commit
introduces some sanity checking on path usage so that we don't get a
traceback when someone double-clicks one of these empty placeholder

In this case, 'handle' means 'do nothing', since there is no sensible
action to take.
parent 11d7d400
......@@ -751,17 +751,19 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
def on_treeview_row_activated(self, view, path, column):
pane = self.treeview.index(view)
allrows = self.model.value_paths(self.model.get_iter(path))
rows = self.model.value_paths(self.model.get_iter(path))
# Click a file: compare; click a directory: expand; click a missing
# entry: check the next neighbouring entry
pane_ordering = ((0, 1, 2), (1, 2, 0), (2, 1, 0))
for p in pane_ordering[pane]:
if p < self.num_panes and os.path.exists(allrows[p]):
if p < self.num_panes and rows[p] and os.path.exists(rows[p]):
pane = p
if os.path.isfile(allrows[pane]):
self.emit("create-diff", [r for r in allrows if os.path.isfile(r)])
elif os.path.isdir(allrows[pane]):
if not rows[pane]:
if os.path.isfile(rows[pane]):
self.emit("create-diff", [r for r in rows if os.path.isfile(r)])
elif os.path.isdir(rows[pane]):
if view.row_expanded(path):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment