Improve indent guidelines on non-brace control block languages
Fix #9137
This commit is contained in:
parent
f027e9271d
commit
b54b8ee54f
@ -1788,8 +1788,7 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
|
|||||||
const auto currentIndentMode = execute(SCI_GETINDENTATIONGUIDES);
|
const auto currentIndentMode = execute(SCI_GETINDENTATIONGUIDES);
|
||||||
// Python like indentation, excludes lexers (Nim, VB, YAML, etc.)
|
// Python like indentation, excludes lexers (Nim, VB, YAML, etc.)
|
||||||
// that includes tailing empty or whitespace only lines in folding block.
|
// 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 = isPythonStyleIndentation(typeDoc) ? SC_IV_LOOKFORWARD : SC_IV_LOOKBOTH;
|
||||||
const int docIndentMode = pythonLike ? SC_IV_LOOKFORWARD : SC_IV_LOOKBOTH;
|
|
||||||
if (currentIndentMode != docIndentMode)
|
if (currentIndentMode != docIndentMode)
|
||||||
execute(SCI_SETINDENTATIONGUIDES, docIndentMode);
|
execute(SCI_SETINDENTATIONGUIDES, docIndentMode);
|
||||||
}
|
}
|
||||||
@ -2683,8 +2682,7 @@ void ScintillaEditView::performGlobalStyles()
|
|||||||
void ScintillaEditView::showIndentGuideLine(bool willBeShowed)
|
void ScintillaEditView::showIndentGuideLine(bool willBeShowed)
|
||||||
{
|
{
|
||||||
auto typeDoc = _currentBuffer->getLangType();
|
auto typeDoc = _currentBuffer->getLangType();
|
||||||
const bool pythonLike = (typeDoc == L_PYTHON || typeDoc == L_COFFEESCRIPT || typeDoc == L_HASKELL);
|
const int docIndentMode = isPythonStyleIndentation(typeDoc) ? SC_IV_LOOKFORWARD : SC_IV_LOOKBOTH;
|
||||||
const int docIndentMode = pythonLike ? SC_IV_LOOKFORWARD : SC_IV_LOOKBOTH;
|
|
||||||
execute(SCI_SETINDENTATIONGUIDES, willBeShowed ? docIndentMode : SC_IV_NONE);
|
execute(SCI_SETINDENTATIONGUIDES, willBeShowed ? docIndentMode : SC_IV_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,6 +594,12 @@ public:
|
|||||||
return false;
|
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 defineDocType(LangType typeDoc); //setup stylers for active document
|
||||||
|
|
||||||
void addCustomWordChars();
|
void addCustomWordChars();
|
||||||
|
Loading…
Reference in New Issue
Block a user