Block edit events from happening during typeahead computation

This commit is contained in:
Jordan Sherer 2019-10-23 12:18:06 -04:00
parent 4c386248da
commit 5cbcb5b8a0

View File

@ -6321,13 +6321,19 @@ bool MainWindow::prepareNextMessageFrame()
// typeahead // typeahead
if(ui->extFreeTextMsgEdit->isDirty() && !ui->extFreeTextMsgEdit->isEmpty()){ if(ui->extFreeTextMsgEdit->isDirty() && !ui->extFreeTextMsgEdit->isEmpty()){
// block edit events while computing next frame
QString newText;
ui->extFreeTextMsgEdit->setReadOnly(true);
{
auto sent = ui->extFreeTextMsgEdit->sentText(); auto sent = ui->extFreeTextMsgEdit->sentText();
auto unsent = ui->extFreeTextMsgEdit->unsentText(); auto unsent = ui->extFreeTextMsgEdit->unsentText();
qDebug() << "text dirty for typeahead\n" << sent << "\n" << unsent; qDebug() << "text dirty for typeahead\n" << sent << "\n" << unsent;
m_txFrameQueue.clear(); m_txFrameQueue.clear();
m_txFrameCount = 0; m_txFrameCount = 0;
auto newText = appendMessage(unsent); newText = appendMessage(unsent);
qDebug () << "unsent replaced to" << "\n" << newText; qDebug () << "unsent replaced to" << "\n" << newText;
}
ui->extFreeTextMsgEdit->setReadOnly(false);
ui->extFreeTextMsgEdit->replaceUnsentText(newText); ui->extFreeTextMsgEdit->replaceUnsentText(newText);
ui->extFreeTextMsgEdit->setClean(); ui->extFreeTextMsgEdit->setClean();
} }