diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index d1957de0..98ef5fe2 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -1788,8 +1788,7 @@ void ScintillaEditView::defineDocType(LangType typeDoc) const auto currentIndentMode = execute(SCI_GETINDENTATIONGUIDES); // Python like indentation, excludes lexers (Nim, VB, YAML, etc.) // that includes tailing empty or whitespace only lines in folding block. - const bool pythonLike = (typeDoc == L_PYTHON || typeDoc == L_COFFEESCRIPT || typeDoc == L_HASKELL); - const int docIndentMode = pythonLike ? SC_IV_LOOKFORWARD : SC_IV_LOOKBOTH; + const int docIndentMode = isPythonStyleIndentation(typeDoc) ? SC_IV_LOOKFORWARD : SC_IV_LOOKBOTH; if (currentIndentMode != docIndentMode) execute(SCI_SETINDENTATIONGUIDES, docIndentMode); } @@ -2683,8 +2682,7 @@ void ScintillaEditView::performGlobalStyles() void ScintillaEditView::showIndentGuideLine(bool willBeShowed) { auto typeDoc = _currentBuffer->getLangType(); - const bool pythonLike = (typeDoc == L_PYTHON || typeDoc == L_COFFEESCRIPT || typeDoc == L_HASKELL); - const int docIndentMode = pythonLike ? SC_IV_LOOKFORWARD : SC_IV_LOOKBOTH; + const int docIndentMode = isPythonStyleIndentation(typeDoc) ? SC_IV_LOOKFORWARD : SC_IV_LOOKBOTH; execute(SCI_SETINDENTATIONGUIDES, willBeShowed ? docIndentMode : SC_IV_NONE); } diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index bc76f452..1c203574 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -594,6 +594,12 @@ public: return false; }; + bool isPythonStyleIndentation(LangType typeDoc) const{ + return (typeDoc == L_PYTHON || typeDoc == L_COFFEESCRIPT || typeDoc == L_HASKELL ||\ + typeDoc == L_C || typeDoc == L_CPP || typeDoc == L_OBJC || typeDoc == L_CS || typeDoc == L_JAVA ||\ + typeDoc == L_PHP || typeDoc == L_JS || typeDoc == L_JAVASCRIPT || typeDoc == L_MAKEFILE || typeDoc == L_ASN1); + }; + void defineDocType(LangType typeDoc); //setup stylers for active document void addCustomWordChars();