diff -r c5830bce1c23 -r e07425ac5834 src/main.cpp --- a/src/main.cpp Wed Jul 20 12:59:07 2022 +0300 +++ b/src/main.cpp Wed Jul 20 21:34:56 2022 +0300 @@ -471,19 +471,29 @@ const auto executeAction = [&]( Model* model, const ModelAction& action ) { - /* std::visit(overloaded{ [model](const AppendToModel& action){ - model->append(action.newElement); + QTextCursor cursor{model}; + cursor.movePosition(QTextCursor::End); + const QString newText = modelElementToString(action.newElement); + // Make sure we have an empty line + if (not model->lastBlock().text().isEmpty()) { + cursor.insertBlock(); + } + qDebug() << cursor.blockNumber(); + cursor.insertText(newText); }, - [model](const DeleteFromModel& action){ - model->remove(action.position); - }, + [](const DeleteFromModel&){}, [model](const ModifyModel& action){ - model->assignAt(action.position, action.newElement); + QTextBlock block = model->findBlockByLineNumber((int) action.position); + if (block.isValid()) { + QTextCursor cursor{block}; + cursor.select(QTextCursor::LineUnderCursor); + cursor.insertText(modelElementToString(action.newElement)); + } + //model->assignAt(action.position, action.newElement); }, }, action); - */ }; const auto restoreSettings = [&]{