[meld] gutterrendererchunk: Simplify logic around gutter action sanitising



commit b7dc9659f4ee530519c26d418412cb9985836da8
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Mon Oct 3 07:55:45 2016 +1000

    gutterrendererchunk: Simplify logic around gutter action sanitising

 meld/gutterrendererchunk.py |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)
---
diff --git a/meld/gutterrendererchunk.py b/meld/gutterrendererchunk.py
index b4e9502..7411e0f 100644
--- a/meld/gutterrendererchunk.py
+++ b/meld/gutterrendererchunk.py
@@ -259,21 +259,16 @@ class GutterRendererChunkAction(
             else:
                 change_type = "replace"
 
-        action = None
-        if change_type == "delete":
-            if (editable and (self.mode == MODE_DELETE or not other_editable)):
-                action = MODE_DELETE
-            elif other_editable and self.mode != MODE_DELETE:
-                action = MODE_REPLACE
-        elif change_type == "replace":
-            if not editable:
-                if self.mode in (MODE_INSERT, MODE_REPLACE):
-                    action = self.mode
-            elif not other_editable:
-                action = MODE_DELETE
-            else:
-                action = self.mode
+        if change_type == 'insert':
+            return None
 
+        action = self.mode
+        if action == MODE_DELETE and not editable:
+            action = None
+        elif action == MODE_INSERT and change_type == 'delete':
+            action = MODE_REPLACE
+        if not other_editable:
+            action = MODE_DELETE
         return action
 
 


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