[meld] Check whether the inserted bit is a sole CR (closes bgo#650726)



commit 8c5a45f4308d05c74b2d54c4ca936b6f09fad5da
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Tue May 31 18:07:31 2011 +1000

    Check whether the inserted bit is a sole CR (closes bgo#650726)
    
    If a file ends in a sole CR, the handling for inserting split CR/LF
    pairs results in an infinite loop. This commit fixes this by checking
    to see whether we're inserting a single CR; this should only happen
    at the end of a file, and so shouldn't affect other cases.

 meld/filediff.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 1842810..f0df08e 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -1033,7 +1033,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
                         nextbit = "\r" + nextbit
                         t.was_cr = False
                     if len(nextbit):
-                        if (nextbit[-1] == "\r"):
+                        if nextbit[-1] == "\r" and len(nextbit) > 1:
                             t.was_cr = True
                             nextbit = nextbit[0:-1]
                         t.buf.insert( t.buf.get_end_iter(), nextbit )



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