summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Persch <chpe@src.gnome.org>2021-06-21 21:42:56 +0200
committerChristian Persch <chpe@src.gnome.org>2021-06-21 21:42:56 +0200
commitc7be1cc69aab64c5cc255bcdada39baf1dab5ad3 (patch)
treef7ee2c52c2fc0027ea480046683643fc596827d4
parent9eab17c8bc0f77faf3641e0d50083bb669b5656e (diff)
downloadvte-c7be1cc69aab64c5cc255bcdada39baf1dab5ad3.tar.gz
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
-rw-r--r--src/vte.cc8
1 files 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;