Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 18014c75 authored by Ahmad Samir's avatar Ahmad Samir Committed by Kurt Hindenburg

Restore zoom fonts after changing profile with ESC sequences

Summary:
When a profile property is changed via the command line or an ESC sequence
a new temp profile is created and applied, this resets the zoom values in
the views connected to the session.
Save zoom font sizes and restore them after the new profile is applied.

BUG: 386643
FIXED-IN: 18.04

Reviewers: hindenburg

Reviewed By: hindenburg

Subscribers: ngraham, #konsole

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D10650
parent 5345bbb0
......@@ -37,6 +37,7 @@
#include "ProfileManager.h"
#include "History.h"
#include "Enumeration.h"
#include "TerminalDisplay.h"
using namespace Konsole;
......@@ -263,6 +264,17 @@ void SessionManager::sessionProfileCommandReceived(const QString &text)
Session *session = qobject_cast<Session *>(sender());
Q_ASSERT(session);
// store the font for each view if zoom was applied so that they can
// be restored after applying the new profile
QHash<TerminalDisplay *, QFont> zoomFontSizes;
foreach (TerminalDisplay *view, session->views()) {
const QFont &viewCurFont = view->getVTFont();
if (viewCurFont != _sessionProfiles[session]->font()) {
zoomFontSizes.insert(view, viewCurFont);
}
}
ProfileCommandParser parser;
QHash<Profile::Property, QVariant> changes = parser.parse(text);
......@@ -283,6 +295,14 @@ void SessionManager::sessionProfileCommandReceived(const QString &text)
_sessionProfiles[session] = newProfile;
applyProfile(newProfile, true);
emit sessionUpdated(session);
if (!zoomFontSizes.isEmpty()) {
QHashIterator<TerminalDisplay *, QFont> it(zoomFontSizes);
while (it.hasNext()) {
it.next();
it.key()->setVTFont(it.value());
}
}
}
void SessionManager::saveSessions(KConfig *config)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment