diff --git a/mainwindow.cpp b/mainwindow.cpp index e9bfe2e..89f1e09 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -248,11 +248,15 @@ void MainWindow::onReplaceLast(QStringList newTextLines, QString suffix) { void MainWindow::onReplaceLast(QString text, QString suffix) { // Utils::printInfoMsg(QString("ON REPLACE LAST (TEXT) CALLED AT ") // + QDateTime::currentDateTime().toString(Qt::ISODateWithMs)); - QString editText = ui->updateStatus->toPlainText(); QStringList lines = editText.split('\n', QString::SplitBehavior::SkipEmptyParts); if (lines.size() > 0) { - lines.removeLast(); + // removing the last line is really meant for refreshing the last line + // with a string very similar than the original one, typically only + // followed by a suffix. + if (lines.last().contains(text)) { + lines.removeLast(); + } if (!suffix.isNull() && suffix.size() > 0 && suffix != "\n") { QString const add = text.leftJustified(m_width-10) + suffix; if (!add.isEmpty()) {