[meld] Fix Push/Pull actions sensitivity in auto-merge mode



commit 4bd501f7f6775bbfb0e799552b1ba753c316af93
Author: Piotr Piastucki <leech miranda gmail com>
Date:   Wed Mar 3 13:33:07 2010 +0100

    Fix Push/Pull actions sensitivity in auto-merge mode
    
    Push change and Pull change actions should depend on the editable flag of
    the respective text view.

 meld/filediff.py |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 294a644..53b630a 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -282,15 +282,18 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
                 chunk = self.linediffer.get_chunk(chunk_id, pane)
                 push_left = pane == 2 and not chunk[1] == chunk[2]
                 push_right = pane == 0 and not chunk[1] == chunk[2]
-                pull_left = pane == 2 and not chunk[3] == chunk[4]
-                pull_right = pane == 0 and not chunk[3] == chunk[4]
+                editable = self.textview[pane].get_editable()
+                pull_left = pane == 2 and not chunk[3] == chunk[4] and editable
+                pull_right = pane == 0 and not chunk[3] == chunk[4] and editable
             elif pane == 1:
                 chunk0 = self.linediffer.get_chunk(chunk_id, pane, 0)
                 chunk2 = None
                 if self.num_panes == 3:
                     chunk2 = self.linediffer.get_chunk(chunk_id, pane, 2)
-                push_left = chunk0 is not None and chunk0[1] != chunk0[2]
-                push_right = chunk2 is not None and chunk2[1] != chunk2[2]
+                push_left = chunk0 is not None and chunk0[1] != chunk0[2] and \
+                            self.textview[pane - 1].get_editable()
+                push_right = chunk2 is not None and chunk2[1] != chunk2[2] and \
+                             self.textview[pane + 1].get_editable()
                 pull_left = chunk0 is not None and not chunk0[3] == chunk0[4]
                 pull_right = chunk2 is not None and not chunk2[3] == chunk2[4]
             delete = push_left or push_right



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