summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Hindenburg <kurt.hindenburg@gmail.com>2011-06-25 04:26:09 (GMT)
committerKurt Hindenburg <kurt.hindenburg@gmail.com>2011-08-25 13:42:29 (GMT)
commit4c4b686a30a849af450cce7d140c8eafbf467627 (patch)
treec76c655469387c8ae45e004406b7ae1418feb6c8
parent1b2ba0ae777f520e024cce78fc14790d35b1e167 (diff)
Restore codec to profile setting or previous codec upon reset.
Previously, after typing in 'reset' or using 'Clear Scrollback & Reset', the current codec is lost. With this patch, typing in 'reset' will cause the codec to stay what it was before the reset. Using the 'Clear Scrollback & Reset' will cause the codec to be set to the Profile setting. This may get backported to 4.6.x BUG: 123866 BUG: 273959 FIXED-IN: 4.7 REVIEW: 101565 (cherry picked from commit 27182ebbadb8bcf406cba74be1888125e54fe63f)
-rw-r--r--src/SessionController.cpp4
-rw-r--r--src/Vt102Emulation.cpp10
2 files changed, 13 insertions, 1 deletions
diff --git a/src/SessionController.cpp b/src/SessionController.cpp
index 60639e8..b6fa82b 100644
--- a/src/SessionController.cpp
+++ b/src/SessionController.cpp
@@ -1006,9 +1006,13 @@ void SessionController::clearHistory()
void SessionController::clearHistoryAndReset()
{
+ Profile::Ptr profile = SessionManager::instance()->sessionProfile(_session);
+ QByteArray name = profile->property<QString>(Profile::DefaultEncoding).toUtf8();
+
Emulation* emulation = _session->emulation();
emulation->reset();
_session->refresh();
+ _session->setCodec(QTextCodec::codecForName(name));
clearHistory();
}
diff --git a/src/Vt102Emulation.cpp b/src/Vt102Emulation.cpp
index ce3816c..c0c2a8b 100644
--- a/src/Vt102Emulation.cpp
+++ b/src/Vt102Emulation.cpp
@@ -81,13 +81,21 @@ void Vt102Emulation::clearEntireScreen()
void Vt102Emulation::reset()
{
+ // Save the current codec so we can set it later.
+ // Ideally we would want to use the profile setting
+ const QTextCodec* currentCodec = codec();
+
resetTokenizer();
resetModes();
resetCharset(0);
_screen[0]->reset();
resetCharset(1);
_screen[1]->reset();
- setCodec(LocaleCodec);
+
+ if (currentCodec)
+ setCodec(currentCodec);
+ else
+ setCodec(LocaleCodec);
bufferedUpdate();
}