diff options
author | Marcus Tillmanns <[email protected]> | 2023-07-25 08:17:13 +0200 |
---|---|---|
committer | Marcus Tillmanns <[email protected]> | 2023-07-26 09:48:17 +0000 |
commit | def291f2600bfa6530541b01e6d756260c735c58 (patch) | |
tree | d46df781d02ec818090e6cdada9b699c28bad547 /src/plugins/terminal/terminalwidget.cpp | |
parent | 5e5b90a9a1664ca262b4016d27f5f639e81e2457 (diff) |
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 <[email protected]>
Reviewed-by: Christian Stenger <[email protected]>
Diffstat (limited to 'src/plugins/terminal/terminalwidget.cpp')
-rw-r--r-- | src/plugins/terminal/terminalwidget.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/plugins/terminal/terminalwidget.cpp b/src/plugins/terminal/terminalwidget.cpp index 4b6442753e1..dd105223536 100644 --- a/src/plugins/terminal/terminalwidget.cpp +++ b/src/plugins/terminal/terminalwidget.cpp @@ -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(); }); |