[vte] lib: Fix switching encodings



commit c7be1cc69aab64c5cc255bcdada39baf1dab5ad3
Author: Christian Persch <chpe src gnome org>
Date:   Mon Jun 21 21:42:56 2021 +0200

    lib: Fix switching encodings
    
    When switching encodings, need to also set the current data syntax
    to the new data syntax.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1974182

 src/vte.cc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index aa1e9938..d04671e4 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -2069,6 +2069,7 @@ Terminal::set_encoding(char const* charset,
                        GError** error)
 {
         auto const to_utf8 = bool{charset == nullptr || g_ascii_strcasecmp(charset, "UTF-8") == 0};
+        auto const primary_is_current = (current_data_syntax() == primary_data_syntax());
 
 #ifdef WITH_ICU
         /* Note that if the current data syntax is not a primary one, the change
@@ -2113,9 +2114,12 @@ Terminal::set_encoding(char const* charset,
         if (pty())
                 pty()->set_utf8(primary_data_syntax() == DataSyntax::ECMA48_UTF8);
 
+        if (primary_is_current)
+                m_current_data_syntax = m_primary_data_syntax;
+
        _vte_debug_print(VTE_DEBUG_IO,
-                         "Set terminal encoding to `%s'.\n",
-                         encoding());
+                         "Set terminal encoding to \"%s\" data syntax %d\n",
+                         encoding(), int(primary_data_syntax()));
 
         return true;
 


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