From 6cd2e6de0cd7fe62ba62e1448b7d3d0654acf77f Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Wed, 4 Oct 2023 14:31:35 +0200 Subject: [PATCH] Utils: Fix StringAspect TextEditDisplay Remove the unnecessary re-setting of the text edit content due to the undo => edit => undo => edit connection. Fixes: QTCREATORBUG-29688 Change-Id: I7838ed594ae3741df757fa5eb3cdd90506428be3 Reviewed-by: hjk --- src/libs/utils/aspects.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/libs/utils/aspects.cpp b/src/libs/utils/aspects.cpp index cf5dd311085..551e6ca1244 100644 --- a/src/libs/utils/aspects.cpp +++ b/src/libs/utils/aspects.cpp @@ -1229,14 +1229,19 @@ void StringAspect::addToLayout(LayoutItem &parent) &QTextEdit::setPlaceholderText); connect(textEditDisplay, &QTextEdit::textChanged, this, [this, textEditDisplay]() { - d->undoable.set(undoStack(), textEditDisplay->toPlainText()); - handleGuiChanged(); + if (textEditDisplay->toPlainText() != d->undoable.get()) { + d->undoable.set(undoStack(), textEditDisplay->toPlainText()); + handleGuiChanged(); + } }); connect(&d->undoable.m_signal, &UndoSignaller::changed, textEditDisplay, - [this, textEditDisplay] { textEditDisplay->setText(d->undoable.get()); }); + [this, textEditDisplay] { + if (textEditDisplay->toPlainText() != d->undoable.get()) + textEditDisplay->setText(d->undoable.get()); + }); break; } case LabelDisplay: {