[PATCH] Rework supply_newline handling



I think the code is simpler that way, less code,
at least as easy to understand...

I think the ordering change in the conditional
is harmless

-- 
Vincent Legoll
Index: filediff.py
===================================================================
--- filediff.py	(revision 1312)
+++ filediff.py	(working copy)
@@ -596,12 +596,10 @@
                         if hasattr(t.file, "newlines"):
                             self.bufferdata[t.pane].newlines = t.file.newlines
                         tasks.remove(t)
+                        if (self.prefs.supply_newline and t.text and not t.text[-1].endswith("\n")):
+                            t.buf.insert(t.buf.get_end_iter(), "\n")
+                            t.text.append("\n")
                         panetext[t.pane] = "".join(t.text)
-                        if len(panetext[t.pane]) and \
-                            panetext[t.pane][-1] != "\n" and \
-                            self.prefs.supply_newline:
-                                t.buf.insert( t.buf.get_end_iter(), "\n")
-                                panetext[t.pane] += "\n"
             yield 1
         self.undosequence.clear()
         yield _("[%s] Computing differences") % self.label_text


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