diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp
index d5b088396a53293f6ea855b07e58f6ea4be4f5e4..1d0d910a4c8b66895b1c00281796c9107731c328 100644
--- a/src/plugins/texteditor/basetexteditor.cpp
+++ b/src/plugins/texteditor/basetexteditor.cpp
@@ -3463,12 +3463,12 @@ void BaseTextEditor::unCollapseAll()
         if (TextBlockUserData::canCollapse(block))
             TextBlockUserData::doCollapse(block, makeVisible);
         block = block.next();
-
     }
 
     d->moveCursorVisible();
     documentLayout->requestUpdate();
     documentLayout->emitDocumentSizeChanged();
+    centerCursor();
 }
 
 void BaseTextEditor::setTextCodec(QTextCodec *codec)