forked from qt-creator/qt-creator
Terminal: Improve paste performance
Pasting large amounts of data on macos would block the App indefinitely. The issue was a blocking call to ::write. The first fix for that was to set O_NONBLOCK on the tty stdout fd. The second fix was to pass the actual result of the write back to the caller so they can react to it. In the TerminalSurface we now check if the write was successful and if not we buffer the data and try again later. Change-Id: Ibc92cce57fad88b5e9aa325197b42e17bec5e746 Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -327,10 +327,12 @@ void TerminalWidget::closeTerminal()
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
void TerminalWidget::writeToPty(const QByteArray &data)
|
||||
qint64 TerminalWidget::writeToPty(const QByteArray &data)
|
||||
{
|
||||
if (m_process && m_process->isRunning())
|
||||
m_process->writeRaw(data);
|
||||
return m_process->writeRaw(data);
|
||||
|
||||
return data.size();
|
||||
}
|
||||
|
||||
void TerminalWidget::setupSurface()
|
||||
@@ -351,10 +353,8 @@ void TerminalWidget::setupSurface()
|
||||
}
|
||||
});
|
||||
|
||||
connect(m_surface.get(),
|
||||
&Internal::TerminalSurface::writeToPty,
|
||||
this,
|
||||
&TerminalWidget::writeToPty);
|
||||
m_surface->setWriteToPty([this](const QByteArray &data) { return writeToPty(data); });
|
||||
|
||||
connect(m_surface.get(), &Internal::TerminalSurface::fullSizeChanged, this, [this] {
|
||||
updateScrollBars();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user