Use only SC_IV_LOOKFORWARD for Python like folding.

Code folding block for Nim, VB and YAML includes tailing empty or whitespace only lines,
it's better for these lexers to use SC_IV_LOOKBOTH.

Close #5821
This commit is contained in:
zufuliu 2019-06-25 20:38:22 +08:00 committed by Don HO
parent 9539a892eb
commit 3f114a557a
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E

View File

@ -1235,8 +1235,11 @@ void ScintillaEditView::setLexer(int lexerID, LangType langType, int whichList)
if (svp._indentGuideLineShow) if (svp._indentGuideLineShow)
{ {
auto currentIndentMode = execute(SCI_GETINDENTATIONGUIDES); const auto currentIndentMode = execute(SCI_GETINDENTATIONGUIDES);
int docIndentMode = isFoldIndentationBased() ? SC_IV_LOOKFORWARD : SC_IV_LOOKBOTH; // Python like indentation, excludes lexers (Nim, VB, YAML, etc.)
// that includes tailing empty or whitespace only lines in folding block.
const bool pythonLike = (lexerID == SCLEX_PYTHON || lexerID == SCLEX_COFFEESCRIPT || lexerID == SCLEX_HASKELL);
const int docIndentMode = pythonLike ? SC_IV_LOOKFORWARD : SC_IV_LOOKBOTH;
if (currentIndentMode != docIndentMode) if (currentIndentMode != docIndentMode)
execute(SCI_SETINDENTATIONGUIDES, docIndentMode); execute(SCI_SETINDENTATIONGUIDES, docIndentMode);
} }