[vte/vte-0-64] lib: Fix switching encodings



commit 9b9e0c407b1907fa882c247975821e52ceabc2db
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
    (cherry picked from commit c7be1cc69aab64c5cc255bcdada39baf1dab5ad3)

 src/vte.cc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 4ea466bd..68c1d44b 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -2127,6 +2127,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
@@ -2171,9 +2172,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]