[meld] Fix saving of text created in blank comparison (bgo#771498)



commit 440f7479ba6f7a18df7c01e928113d3daf08bd8e
Author: Vasily Galkin <galkin-vv ya ru>
Date:   Sat Sep 17 12:08:33 2016 +0300

    Fix saving of text created in blank comparison (bgo#771498)

 meld/filediff.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index d52752c..01bebc7 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -1507,6 +1507,10 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         text = buf.get_text(start, end, False)
 
         source_encoding = bufdata.sourcefile.get_encoding()
+        if not source_encoding:
+            # no encoding for new blank comparison
+            source_encoding = GtkSource.Encoding.get_utf8()
+
         while isinstance(text, str):
             try:
                 encoding = source_encoding.get_charset()


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