diff options
| author | nyamatongwe <devnull@localhost> | 2009-07-05 00:28:28 +0000 | 
|---|---|---|
| committer | nyamatongwe <devnull@localhost> | 2009-07-05 00:28:28 +0000 | 
| commit | d9e541b544e8af8da1e63aa495da5ff87958e2f8 (patch) | |
| tree | ef829e98b1c9adaf4f5a14b24e204fd026eeba21 /src/LexPython.cxx | |
| parent | 5974a19d6cb754e76b9293514ca6c4a21aafa495 (diff) | |
| download | scintilla-mirror-d9e541b544e8af8da1e63aa495da5ff87958e2f8.tar.gz | |
Python folding uses fold.compact to fix bug #210240 in more cases.
Diffstat (limited to 'src/LexPython.cxx')
| -rw-r--r-- | src/LexPython.cxx | 19 | 
1 files changed, 15 insertions, 4 deletions
| diff --git a/src/LexPython.cxx b/src/LexPython.cxx index 26b96e4db..7d31fd251 100644 --- a/src/LexPython.cxx +++ b/src/LexPython.cxx @@ -416,6 +416,8 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse  	//	This option enables folding multi-line quoted strings when using the Python lexer.  	const bool foldQuotes = styler.GetPropertyInt("fold.quotes.python") != 0; +	const bool foldCompact = styler.GetPropertyInt("fold.compact") != 0; +  	// Backtrack to previous non-blank line so we can determine indent level  	// for any white space lines (needed esp. within triple quoted strings)  	// and so we can fix any preceding fold level (which is why we go back @@ -514,12 +516,21 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse  		while (--skipLine > lineCurrent) {  			int skipLineIndent = styler.IndentAmount(skipLine, &spaceFlags, NULL); -			if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > levelAfterComments) -				skipLevel = levelBeforeComments; +			if (foldCompact) { +				if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > levelAfterComments) +					skipLevel = levelBeforeComments; + +				int whiteFlag = skipLineIndent & SC_FOLDLEVELWHITEFLAG; -			int whiteFlag = skipLineIndent & SC_FOLDLEVELWHITEFLAG; +				styler.SetLevel(skipLine, skipLevel | whiteFlag); +			} else { +				if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > levelAfterComments && +					!(skipLineIndent & SC_FOLDLEVELWHITEFLAG) && +					!IsCommentLine(skipLine, styler)) +					skipLevel = levelBeforeComments; -			styler.SetLevel(skipLine, skipLevel | whiteFlag); +				styler.SetLevel(skipLine, skipLevel); +			}  		}  		// Set fold header on non-quote/non-comment line | 
