diff options
| author | nyamatongwe <unknown> | 2006-01-04 02:29:36 +0000 | 
|---|---|---|
| committer | nyamatongwe <unknown> | 2006-01-04 02:29:36 +0000 | 
| commit | 174613f63212412440c3367dfd0dd4b7036e2d5e (patch) | |
| tree | 8bcc9ecb8ec84d230c7d2fa3c13ec24383142b83 | |
| parent | 3ed782fd0f1279fa298d00c0bd5506141eef9d6d (diff) | |
| download | scintilla-mirror-174613f63212412440c3367dfd0dd4b7036e2d5e.tar.gz | |
Patch from Carsten Sperber improves folding with code copied from LexCPP.
| -rw-r--r-- | src/LexSQL.cxx | 23 | 
1 files changed, 10 insertions, 13 deletions
| diff --git a/src/LexSQL.cxx b/src/LexSQL.cxx index 75a958cb6..19d81ebcb 100644 --- a/src/LexSQL.cxx +++ b/src/LexSQL.cxx @@ -43,7 +43,6 @@ static inline bool IsANumberChar(int ch) {               ch == '.' || ch == '-' || ch == '+');  } -  static void ColouriseSQLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],                              Accessor &styler) { @@ -60,7 +59,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, int initStyle, Wo  	bool sqlBackslashEscapes = styler.GetPropertyInt("sql.backslash.escapes", 0) != 0;  	bool sqlBackticksIdentifier = styler.GetPropertyInt("lexer.sql.backticks.identifier", 0) != 0; -	int styleBeforeDCKeyword = SCE_C_DEFAULT; +	int styleBeforeDCKeyword = SCE_SQL_DEFAULT;  	bool fold = styler.GetPropertyInt("fold") != 0;  	int lineCurrent = styler.GetLine(startPos); @@ -248,7 +247,7 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,  	int lineCurrent = styler.GetLine(startPos);  	int levelCurrent = SC_FOLDLEVELBASE;  	if (lineCurrent > 0) { -		levelCurrent = styler.LevelAt(lineCurrent - 1) & SC_FOLDLEVELNUMBERMASK; +		levelCurrent = styler.LevelAt(lineCurrent - 1) >> 16;  	}  	int levelNext = levelCurrent;  	char chNext = styler[startPos]; @@ -326,16 +325,14 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,  			}  		}  		if (atEOL) { -			int level = levelCurrent; -			if (visibleChars == 0 && foldCompact) { -				// Empty line -				level |= SC_FOLDLEVELWHITEFLAG; -			} -			if (visibleChars > 0 && levelNext > levelCurrent) { -				level |= SC_FOLDLEVELHEADERFLAG; -			} -			if (level != styler.LevelAt(lineCurrent)) { -				styler.SetLevel(lineCurrent, level); +			int levelUse = levelCurrent; +			int lev = levelUse | levelNext << 16; +			if (visibleChars == 0 && foldCompact) +				lev |= SC_FOLDLEVELWHITEFLAG; +			if (levelUse < levelNext) +				lev |= SC_FOLDLEVELHEADERFLAG; +			if (lev != styler.LevelAt(lineCurrent)) { +				styler.SetLevel(lineCurrent, lev);  			}  			lineCurrent++;  			levelCurrent = levelNext; | 
