From c7be1cc69aab64c5cc255bcdada39baf1dab5ad3 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Mon, 21 Jun 2021 21:42:56 +0200 Subject: 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; -- cgit v1.2.1