From 5cbcb5b8a05b400acbeb6b21196e2c75e4e7e754 Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Wed, 23 Oct 2019 12:18:06 -0400 Subject: [PATCH] Block edit events from happening during typeahead computation --- mainwindow.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 9c6fdea..d3d23ae 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -6321,13 +6321,19 @@ bool MainWindow::prepareNextMessageFrame() // typeahead if(ui->extFreeTextMsgEdit->isDirty() && !ui->extFreeTextMsgEdit->isEmpty()){ - auto sent = ui->extFreeTextMsgEdit->sentText(); - auto unsent = ui->extFreeTextMsgEdit->unsentText(); - qDebug() << "text dirty for typeahead\n" << sent << "\n" << unsent; - m_txFrameQueue.clear(); - m_txFrameCount = 0; - auto newText = appendMessage(unsent); - qDebug () << "unsent replaced to" << "\n" << newText; + // block edit events while computing next frame + QString newText; + ui->extFreeTextMsgEdit->setReadOnly(true); + { + auto sent = ui->extFreeTextMsgEdit->sentText(); + auto unsent = ui->extFreeTextMsgEdit->unsentText(); + qDebug() << "text dirty for typeahead\n" << sent << "\n" << unsent; + m_txFrameQueue.clear(); + m_txFrameCount = 0; + newText = appendMessage(unsent); + qDebug () << "unsent replaced to" << "\n" << newText; + } + ui->extFreeTextMsgEdit->setReadOnly(false); ui->extFreeTextMsgEdit->replaceUnsentText(newText); ui->extFreeTextMsgEdit->setClean(); }