From 3f114a557a6bcba42643d2beb04255b85152aa3a Mon Sep 17 00:00:00 2001 From: zufuliu Date: Tue, 25 Jun 2019 20:38:22 +0800 Subject: [PATCH] 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 --- PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 4c719e2d..bc2d48fd 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -1235,8 +1235,11 @@ void ScintillaEditView::setLexer(int lexerID, LangType langType, int whichList) if (svp._indentGuideLineShow) { - auto currentIndentMode = execute(SCI_GETINDENTATIONGUIDES); - int docIndentMode = isFoldIndentationBased() ? SC_IV_LOOKFORWARD : SC_IV_LOOKBOTH; + 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 = (lexerID == SCLEX_PYTHON || lexerID == SCLEX_COFFEESCRIPT || lexerID == SCLEX_HASKELL); + const int docIndentMode = pythonLike ? SC_IV_LOOKFORWARD : SC_IV_LOOKBOTH; if (currentIndentMode != docIndentMode) execute(SCI_SETINDENTATIONGUIDES, docIndentMode); }