Trick to try and get shell program to redraw the prompt after 'Clear Scrollback and Reset' is selected from the menu. Resize the tty window slightly larger and then back to the original size again. If anyone knows of a more correct solution, please speak up.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=708825
This commit is contained in:
Robert Knight
2007-09-05 19:17:20 +00:00
parent 37304d50ab
commit d346a2ccad
6 changed files with 44 additions and 1 deletions

View File

@@ -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)
{

View File

@@ -27,6 +27,7 @@
#include <QtCore/QStringList>
#include <QtCore/QVector>
#include <QtCore/QList>
#include <QtCore/QSize>
// KDE
#include <K3Process>
@@ -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);

View File

@@ -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);

View File

@@ -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; }

View File

@@ -641,6 +641,7 @@ void SessionController::clearAndReset()
Emulation* emulation = _session->emulation();
emulation->reset();
_session->refresh();
}
void SessionController::searchClosed()
{

View File

@@ -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