Terminal: Ignore "height = 0" resize events

ConPTY on windows will send "clear line" characters in response
to resizing the PTY.

During re-showing the terminal pane the widget receives a "height=0"
resize event. We have to ignore this otherwise the conpty might try to
clear the screen.

Another issue was that we are calling resize on the pty even thought the
process has ended and won't be able to respond to the clear attempty by
the pty anymore.

Fixes: QTCREATORBUG-30523
Change-Id: I24caeaffb31d255a0640952e2d35bda23fd16280
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Marcus Tillmanns
2024-03-18 10:40:07 +01:00
parent 10858b1f68
commit 3d8d85b5b9
2 changed files with 5 additions and 2 deletions

View File

@@ -958,11 +958,14 @@ void TerminalView::applySizeChange()
};
if (newLiveSize.height() <= 0)
newLiveSize.setHeight(1);
return;
if (newLiveSize.width() <= 0)
newLiveSize.setWidth(1);
if (d->m_surface->liveSize() == newLiveSize)
return;
resizePty(newLiveSize);
d->m_surface->resize(newLiveSize);
flushVTerm(true);

View File

@@ -336,7 +336,7 @@ qint64 TerminalWidget::writeToPty(const QByteArray &data)
void TerminalWidget::resizePty(QSize newSize)
{
if (m_process && m_process->ptyData())
if (m_process && m_process->ptyData() && m_process->isRunning())
m_process->ptyData()->resize(newSize);
}