forked from qt-creator/qt-creator
Don't show code folding margin when it isn't supported
Introduce setCodeFoldingSupported to the BaseTextEditor, and only enabled it for the C++ and QtScript editors. This removes the useless margin meant for code folding markers from the plain text editor and .pro file editor.
This commit is contained in:
@@ -1198,7 +1198,7 @@ bool BaseTextEditor::lineSeparatorsAllowed() const
|
||||
|
||||
void BaseTextEditor::setCodeFoldingVisible(bool b)
|
||||
{
|
||||
d->m_codeFoldingVisible = b;
|
||||
d->m_codeFoldingVisible = b && d->m_codeFoldingSupported;
|
||||
slotUpdateExtraAreaWidth();
|
||||
}
|
||||
|
||||
@@ -1207,6 +1207,22 @@ bool BaseTextEditor::codeFoldingVisible() const
|
||||
return d->m_codeFoldingVisible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether code folding is supported by the syntax highlighter. When not
|
||||
* supported (the default), this makes sure the code folding is not shown.
|
||||
*
|
||||
* Needs to be called before calling setCodeFoldingVisible.
|
||||
*/
|
||||
void BaseTextEditor::setCodeFoldingSupported(bool b)
|
||||
{
|
||||
d->m_codeFoldingSupported = b;
|
||||
}
|
||||
|
||||
bool BaseTextEditor::codeFoldingSupported() const
|
||||
{
|
||||
return d->m_codeFoldingSupported;
|
||||
}
|
||||
|
||||
void BaseTextEditor::setRevisionsVisible(bool b)
|
||||
{
|
||||
d->m_revisionsVisible = b;
|
||||
@@ -1294,6 +1310,7 @@ BaseTextEditorPrivate::BaseTextEditorPrivate()
|
||||
m_extraArea(0),
|
||||
m_marksVisible(false),
|
||||
m_codeFoldingVisible(false),
|
||||
m_codeFoldingSupported(false),
|
||||
m_revisionsVisible(false),
|
||||
m_lineNumbersVisible(true),
|
||||
m_highlightCurrentLine(true),
|
||||
|
||||
Reference in New Issue
Block a user