[meld] meldbuffer: Fix splitlines hack for multiple line ends (bgo#743301)



commit b4d08cc200e17af55212f52a8278554d977625fc
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Jan 24 08:42:28 2015 +1000

    meldbuffer: Fix splitlines hack for multiple line ends (bgo#743301)
    
    The hack this fixes exists because Python's splitlines() splits on a
    few characters that GTK+'s text handling doesn't. The hack 'correctly'
    handles this case as long as there's only one of these characters in
    a line, but in files with e.g., multiple 0x0c characters on a single
    line, it broke.
    
    This change fixes the problem by not moving off a line until we go
    through without performing any of our 'fixes' to it.

 meld/meldbuffer.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/meld/meldbuffer.py b/meld/meldbuffer.py
index 087e49b..7eb941c 100644
--- a/meld/meldbuffer.py
+++ b/meld/meldbuffer.py
@@ -249,7 +249,11 @@ class BufferLines(object):
                         assert len(ends) >= i + 1
                         lines[i:i + 2] = [line + end[-1] + lines[i + 1]]
                         ends[i:i + 2] = [end + ends[i + 1]]
-                    i += 1
+                    else:
+                        # We only increment if we don't correct a line, to
+                        # handle the case of a single line having multiple
+                        # additional_breaks characters that need correcting.
+                        i += 1
 
             return lines
 


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