diff options
| -rw-r--r-- | src/LexOthers.cxx | 19 | 
1 files changed, 14 insertions, 5 deletions
| diff --git a/src/LexOthers.cxx b/src/LexOthers.cxx index 6f500a06e..f5382bfdc 100644 --- a/src/LexOthers.cxx +++ b/src/LexOthers.cxx @@ -649,11 +649,18 @@ static void ColourisePropsLine(      unsigned int lengthLine,      unsigned int startLine,      unsigned int endPos, -    Accessor &styler) { +    Accessor &styler, +    bool allowInitialSpaces) {  	unsigned int i = 0; -	while ((i < lengthLine) && isspacechar(lineBuffer[i]))	// Skip initial spaces -		i++; +	if (allowInitialSpaces) { +		while ((i < lengthLine) && isspacechar(lineBuffer[i]))	// Skip initial spaces +			i++; +	} else { +		if (isspacechar(lineBuffer[i])) // don't allow initial spaces +			i = lengthLine; +	} +  	if (i < lengthLine) {  		if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') {  			styler.ColourTo(endPos, SCE_PROPS_COMMENT); @@ -687,18 +694,20 @@ static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList *  	styler.StartSegment(startPos);  	unsigned int linePos = 0;  	unsigned int startLine = startPos; +	bool allowInitialSpaces = styler.GetPropertyInt("lexer.props.allow.initial.spaces", 1) != 0; +  	for (unsigned int i = startPos; i < startPos + length; i++) {  		lineBuffer[linePos++] = styler[i];  		if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {  			// End of line (or of line buffer) met, colourise it  			lineBuffer[linePos] = '\0'; -			ColourisePropsLine(lineBuffer, linePos, startLine, i, styler); +			ColourisePropsLine(lineBuffer, linePos, startLine, i, styler, allowInitialSpaces);  			linePos = 0;  			startLine = i + 1;  		}  	}  	if (linePos > 0) {	// Last line does not have ending characters -		ColourisePropsLine(lineBuffer, linePos, startLine, startPos + length - 1, styler); +		ColourisePropsLine(lineBuffer, linePos, startLine, startPos + length - 1, styler, allowInitialSpaces);  	}  } | 
