Utils: Create a reusable AnsiEscapeCodeHandler::setTextInEditor

Change-Id: Ic8ebe57287b08870e36e0a5cadbf3d322d14b2fe
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
Orgad Shaneh
2024-08-06 09:39:51 +03:00
committed by Orgad Shaneh
parent 35df237df2
commit 6471572135
3 changed files with 22 additions and 11 deletions

View File

@@ -186,17 +186,7 @@ void GitEditorWidget::setPlainText(const QString &text)
switch (contentType())
{
case LogOutput: {
AnsiEscapeCodeHandler handler;
const QList<FormattedText> formattedTextList = handler.parseText(FormattedText(text));
clear();
QTextCursor cursor = textCursor();
cursor.beginEditBlock();
for (const auto &formattedChunk : formattedTextList)
cursor.insertText(formattedChunk.text, formattedChunk.format);
cursor.endEditBlock();
document()->setModified(false);
AnsiEscapeCodeHandler::setTextInEditor(this, text);
return;
}
case AnnotateOutput: