[meld] Add additional Python/Gtk line break disagreements (closes bgo#654978)



commit 1c999e778783e440afc0964bdabb52c09e8c6918
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Jul 23 10:13:11 2011 +1000

    Add additional Python/Gtk line break disagreements (closes bgo#654978)
    
    This extends the fix for bug 652996 in commit 0a2a56 to cover multiple
    line break disagreements. Specifically, this adds NEL (next line) as a
    character split by Python but not GtkTextStore.

 meld/filediff.py |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index dc54a7f..526011a 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -120,16 +120,18 @@ class BufferLines(object):
 
         hi = self.buf.get_line_count() if hi == sys.maxint else hi
         if hi - lo != len(lines):
-            # Form feed character
-            FF = u'\x0c'
+            # These codepoints are considered line breaks by Python, but not
+            # by GtkTextStore.
+            additional_breaks = set((u'\x0c', u'\x85'))
             i = 0
             while i < len(ends):
                 line, end = lines[i], ends[i]
                 # It's possible that the last line in a file would end in a
-                # FF character, which requires no joining.
-                if end and end[-1] == FF and line and line[-1] != FF:
+                # line break character, which requires no joining.
+                if end and end[-1] in additional_breaks and \
+                   line and line[-1] not in additional_breaks:
                     assert len(ends) >= i + 1
-                    lines[i:i + 2] = [line + FF + lines[i + 1]]
+                    lines[i:i + 2] = [line + end[-1] + lines[i + 1]]
                     ends[i:i + 2] = [end + ends[i + 1]]
                 i += 1
 



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