[vte] icu: Add early return for no-change to set_encoding



commit 4fd7bd9b2fc07938ffe2840053c4834b5f2bdedb
Author: Christian Persch <chpe src gnome org>
Date:   Tue Apr 28 20:52:35 2020 +0200

    icu: Add early return for no-change to set_encoding
    
    Check if the new encoding is the same as the old one, and
    return early instead of creating a new converted for the same
    charset.  This also prevents losing the outgoing queue contents
    unnecessarily.

 src/vte.cc | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/src/vte.cc b/src/vte.cc
index a27a58da..ccd1a5dd 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -2028,6 +2028,10 @@ Terminal::set_encoding(char const* charset,
                 m_converter.reset();
                 m_data_syntax = DataSyntax::eECMA48_UTF8;
         } else {
+                if (data_syntax() == DataSyntax::eECMA48_PCTERM &&
+                    m_converter->charset() == charset)
+                        return true;
+
                 auto converter = vte::base::ICUConverter::make(charset, error);
                 if (!converter)
                         return false;


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