diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp
index 66bb2b7986d6aeb0b9895298dd34e3308b7f6997..10a3600b48312be42b075269500e88800f72577e 100644
--- a/src/plugins/cppeditor/cppeditor.cpp
+++ b/src/plugins/cppeditor/cppeditor.cpp
@@ -410,7 +410,6 @@ CPPEditor::CPPEditor(QWidget *parent)
     setParenthesesMatchingEnabled(true);
     setMarksVisible(true);
     setCodeFoldingSupported(true);
-    setCodeFoldingVisible(true);
     baseTextDocument()->setSyntaxHighlighter(new CppHighlighter);
 
     m_modelManager = CppTools::CppModelManagerInterface::instance();
diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp
index abbb818a117f8928bddc2a62804f213e49e32202..fccae1942d64a8c343e1b1fbb14b5f4b6d3cf348 100644
--- a/src/plugins/qmljseditor/qmljseditor.cpp
+++ b/src/plugins/qmljseditor/qmljseditor.cpp
@@ -689,7 +689,6 @@ QmlJSTextEditor::QmlJSTextEditor(QWidget *parent) :
     setParenthesesMatchingEnabled(true);
     setMarksVisible(true);
     setCodeFoldingSupported(true);
-    setCodeFoldingVisible(true);
 
     m_updateDocumentTimer = new QTimer(this);
     m_updateDocumentTimer->setInterval(UPDATE_DOCUMENT_DEFAULT_INTERVAL);
diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp
index eaa36330c72673317a0afa4482c6449ec22e3eea..deac6a1831115df7486b2aa9a4f035476c440a8f 100644
--- a/src/plugins/texteditor/basetexteditor.cpp
+++ b/src/plugins/texteditor/basetexteditor.cpp
@@ -1807,10 +1807,13 @@ bool BaseTextEditor::lineSeparatorsAllowed() const
     return d->m_lineSeparatorsAllowed;
 }
 
-void BaseTextEditor::setCodeFoldingVisible(bool b)
+void BaseTextEditor::updateCodeFoldingVisible()
 {
-    d->m_codeFoldingVisible = b && d->m_codeFoldingSupported;
-    slotUpdateExtraAreaWidth();
+    const bool visible = d->m_codeFoldingSupported && d->m_displaySettings.m_displayFoldingMarkers;
+    if (d->m_codeFoldingVisible != visible) {
+        d->m_codeFoldingVisible = visible;
+        slotUpdateExtraAreaWidth();
+    }
 }
 
 bool BaseTextEditor::codeFoldingVisible() const
@@ -1827,6 +1830,7 @@ bool BaseTextEditor::codeFoldingVisible() const
 void BaseTextEditor::setCodeFoldingSupported(bool b)
 {
     d->m_codeFoldingSupported = b;
+    updateCodeFoldingVisible();
 }
 
 bool BaseTextEditor::codeFoldingSupported() const
@@ -5124,7 +5128,6 @@ void BaseTextEditor::setDisplaySettings(const DisplaySettings &ds)
     setLineWrapMode(ds.m_textWrapping ? QPlainTextEdit::WidgetWidth : QPlainTextEdit::NoWrap);
     setLineNumbersVisible(ds.m_displayLineNumbers);
     setVisibleWrapColumn(ds.m_showWrapColumn ? ds.m_wrapColumn : 0);
-    setCodeFoldingVisible(ds.m_displayFoldingMarkers);
     setHighlightCurrentLine(ds.m_highlightCurrentLine);
     setRevisionsVisible(ds.m_markTextChanges);
     setCenterOnScroll(ds.m_centerCursorOnScroll);
@@ -5147,6 +5150,7 @@ void BaseTextEditor::setDisplaySettings(const DisplaySettings &ds)
         d->m_highlightBlocksInfo = BaseTextEditorPrivateHighlightBlocks();
     }
 
+    updateCodeFoldingVisible();
     updateHighlights();
     viewport()->update();
     extraArea()->update();
diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h
index aa19330753a611ed7f68a40a588b95332d733f8c..d17b69932338bee6f34010f6268af6a9ffab3f39 100644
--- a/src/plugins/texteditor/basetexteditor.h
+++ b/src/plugins/texteditor/basetexteditor.h
@@ -207,7 +207,7 @@ public:
     void setLineSeparatorsAllowed(bool b);
     bool lineSeparatorsAllowed() const;
 
-    void setCodeFoldingVisible(bool b);
+    void updateCodeFoldingVisible();
     bool codeFoldingVisible() const;
 
     void setCodeFoldingSupported(bool b);
diff --git a/src/plugins/texteditor/plaintexteditor.cpp b/src/plugins/texteditor/plaintexteditor.cpp
index ea1a0b0a2c22ff8439216c0aebdd782f547f3546..e3cb3fff56cde93b7b710ee31efa8b087505f647 100644
--- a/src/plugins/texteditor/plaintexteditor.cpp
+++ b/src/plugins/texteditor/plaintexteditor.cpp
@@ -164,7 +164,6 @@ void PlainTextEditor::configure(const Core::MimeType &mimeType)
     baseTextDocument()->setSyntaxHighlighter(highlighter);
 
     setCodeFoldingSupported(false);
-    setCodeFoldingVisible(false);
 
     if (!mimeType.isNull()) {
         m_isMissingSyntaxDefinition = true;
@@ -189,7 +188,6 @@ void PlainTextEditor::configure(const Core::MimeType &mimeType)
                 m_commentDefinition.setMultiLineEnd(definition->multiLineCommentEnd());
 
                 setCodeFoldingSupported(true);
-                setCodeFoldingVisible(true);
             }
         } else if (file()) {
             const QString &fileName = file()->fileName();