diff --git a/src/Pty.cpp b/src/Pty.cpp index 929fa904..22e7dcb7 100644 --- a/src/Pty.cpp +++ b/src/Pty.cpp @@ -52,6 +52,10 @@ void Pty::setWindowSize(int lines, int cols) if (pty()->masterFd() >= 0) pty()->setWinSize(lines, cols); } +QSize Pty::windowSize() const +{ + return QSize(_windowColumns,_windowLines); +} void Pty::setXonXoff(bool enable) { diff --git a/src/Pty.h b/src/Pty.h index f5426e12..16ae8f8a 100644 --- a/src/Pty.h +++ b/src/Pty.h @@ -27,6 +27,7 @@ #include #include #include +#include // KDE #include @@ -107,6 +108,9 @@ Q_OBJECT * used by this teletype. */ void setWindowSize(int lines, int cols); + + /** Returns the size of the window used by this teletype. See setWindowSize() */ + QSize windowSize() const; /** TODO Document me */ void setErase(char erase); diff --git a/src/Session.cpp b/src/Session.cpp index b49aee0b..bc8bf942 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -501,6 +501,27 @@ void Session::updateTerminalSize() } } +void Session::refresh() +{ + // attempt to get the shell process to redraw the display + // + // this requires the program running in the shell + // to cooperate by sending an update in response to + // a window size change + // + // the window size is changed twice, first made slightly larger and then + // resized back to its normal size so that there is actually a change + // in the window size (some shells do nothing if the + // new and old sizes are the same) + // + // if there is a more 'correct' way to do this, please + // send an email with method or patches to konsole-devel@kde.org + + const QSize existingSize = _shellProcess->windowSize(); + _shellProcess->setWindowSize(existingSize.height(),existingSize.width()+1); + _shellProcess->setWindowSize(existingSize.height(),existingSize.width()); +} + bool Session::sendSignal(int signal) { return _shellProcess->kill(signal); diff --git a/src/Session.h b/src/Session.h index 55a2e17f..438b7cc1 100644 --- a/src/Session.h +++ b/src/Session.h @@ -345,6 +345,13 @@ public: */ bool hasDarkBackground() const; + /** + * Attempts to get the shell program to redraw the current display area. + * This can be used after clearing the screen, for example, to get the + * shell to redraw the prompt line. + */ + void refresh(); + void startZModem(const QString &rz, const QString &dir, const QStringList &list); void cancelZModem(); bool isZModemBusy() { return _zmodemBusy; } diff --git a/src/SessionController.cpp b/src/SessionController.cpp index b0eb1835..89772b33 100644 --- a/src/SessionController.cpp +++ b/src/SessionController.cpp @@ -641,6 +641,7 @@ void SessionController::clearAndReset() Emulation* emulation = _session->emulation(); emulation->reset(); + _session->refresh(); } void SessionController::searchClosed() { diff --git a/src/ViewContainer.cpp b/src/ViewContainer.cpp index 1ae56100..a92034b0 100644 --- a/src/ViewContainer.cpp +++ b/src/ViewContainer.cpp @@ -60,6 +60,11 @@ ViewContainer::ViewContainer(NavigationPosition position , QObject* parent) } ViewContainer::~ViewContainer() { + foreach( QWidget* view , _views ) + { + disconnect(view,SIGNAL(destroyed(QObject*)),this,SLOT(viewDestroyed(QObject*))); + } + emit destroyed(this); } void ViewContainer::moveViewWidget( int , int ) {} @@ -143,7 +148,8 @@ void ViewContainer::viewDestroyed(QObject* object) _navigation.remove(widget); // FIXME This can result in ViewContainerSubClass::removeViewWidget() being - // called after the ViewContainerSubClass instance's destructor has been called + // called after the the widget's parent has been deleted or partially deleted + // in the ViewContainerSubClass instance's destructor. // // Currently deleteLater() is used to remove child widgets in the subclass // constructors to get around the problem, but this is a hack and needs