[meld: 30/63] filediff: Fix some logic errors around pane counts



commit e7b8c413dbe0204badc8d2ad43848d7a79e6bfb5
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Wed Aug 12 07:58:58 2015 +1000

    filediff: Fix some logic errors around pane counts
    
    Apparently we assumed that we trimmed buffers and views lists, but
    we don't.

 meld/filediff.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 6058eef..9057b88 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -483,7 +483,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         if pane is None:
             pane = self._get_focused_pane()
             if pane == -1:
-                pane = 1 if len(self.textview) > 1 else 0
+                pane = 1 if self.num_panes > 1 else 0
 
         chunk = self.linediffer.get_chunk(target, pane)
         if not chunk:
@@ -965,13 +965,13 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         self.on_cursor_position_changed(view.get_buffer(), None, True)
 
     def set_labels(self, labels):
-        labels = labels[:len(self.textbuffer)]
+        labels = labels[:self.num_panes]
         for label, buf in zip(labels, self.textbuffer):
             if label:
                 buf.data.label = label
 
     def set_merge_output_file(self, filename):
-        if len(self.textbuffer) < 2:
+        if self.num_panes < 2:
             return
         buf = self.textbuffer[1]
         buf.data.savefile = os.path.abspath(filename)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]