diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp
index 9f145bc08018fcb7caaea3bd69e63828e8c46392..f3d1ab07566d3cf9d63d3052a2a39e54f5cabe82 100644
--- a/src/plugins/texteditor/basetexteditor.cpp
+++ b/src/plugins/texteditor/basetexteditor.cpp
@@ -3370,9 +3370,9 @@ void BaseTextEditor::setIfdefedOutBlocks(const QList<BaseTextEditor::BlockRange>
             const BlockRange &range = blocks.at(rangeNumber);
 
             if (block.position() >= range.first && (block.position() <= range.last || !range.last)) {
-                needUpdate += TextEditDocumentLayout::setIfdefedOut(block);
+                needUpdate |= TextEditDocumentLayout::setIfdefedOut(block);
             } else {
-                needUpdate += TextEditDocumentLayout::clearIfdefedOut(block);
+                needUpdate |= TextEditDocumentLayout::clearIfdefedOut(block);
             }
             if (block.contains(range.last))
                 ++rangeNumber;