diff options
| author | nyamatongwe <unknown> | 2000-08-22 03:13:47 +0000 | 
|---|---|---|
| committer | nyamatongwe <unknown> | 2000-08-22 03:13:47 +0000 | 
| commit | 4e823c6cbf83bd552796e5da30d9728fd06b43ef (patch) | |
| tree | 179484a3ebba2fe05ba2ae635aa43f4935a6e901 /src | |
| parent | 6ed3892e53bbad8ac5af2bfacecb773337a501f3 (diff) | |
| download | scintilla-mirror-4e823c6cbf83bd552796e5da30d9728fd06b43ef.tar.gz | |
Added SCE_H_VALUE class for HTML for unquoted values.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Editor.cxx | 10 | ||||
| -rw-r--r-- | src/LexHTML.cxx | 40 | ||||
| -rw-r--r-- | src/ScintillaBase.cxx | 1 | 
3 files changed, 44 insertions, 7 deletions
| diff --git a/src/Editor.cxx b/src/Editor.cxx index 6969458d3..e6f44f5df 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -1230,12 +1230,14 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {  			if (line == lineCaret) {  				int offset = Platform::Minimum(posCaret - posLineStart, LineLayout::maxLineLength);  				int xposCaret = ll.positions[offset] + xStart; -				int widthOverstrikeCaret = -				    ll.positions[offset + 1] - ll.positions[offset]; -				if (posCaret == pdoc->Length())	// At end of document +				int widthOverstrikeCaret = 1; +                if (posCaret == pdoc->Length())	{   // At end of document  					widthOverstrikeCaret = vs.aveCharWidth; -				if ((posCaret - posLineStart) >= ll.numCharsInLine)	// At end of line +                } else if ((posCaret - posLineStart) >= ll.numCharsInLine) {	// At end of line  					widthOverstrikeCaret = vs.aveCharWidth; +                } else { +				    widthOverstrikeCaret = ll.positions[offset + 1] - ll.positions[offset]; +                }  				if (widthOverstrikeCaret < 3)	// Make sure its visible  					widthOverstrikeCaret = 3;  				if (((caret.active && caret.on) || (posDrag >= 0)) && xposCaret >= 0) { diff --git a/src/LexHTML.cxx b/src/LexHTML.cxx index 15f7ed3cb..54fac38e1 100644 --- a/src/LexHTML.cxx +++ b/src/LexHTML.cxx @@ -115,9 +115,13 @@ static int stateForPrintState(int StateToPrint) {  	return state;  } -static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { -	bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.') || +static inline bool IsNumber(unsigned int start, Accessor &styler) { +	return isdigit(styler[start]) || (styler[start] == '.') ||  	                    (styler[start] == '-') || (styler[start] == '#'); +} + +static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { +	bool wordIsNumber = IsNumber(start, styler);  	char chAttr = SCE_H_ATTRIBUTEUNKNOWN;  	if (wordIsNumber) {  		chAttr = SCE_H_NUMBER; @@ -603,6 +607,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty  					} else {  						state = SCE_H_DEFAULT;  					} +				} else if (ch == '=') { +					styler.ColourTo(i, SCE_H_OTHER); +					state = SCE_H_VALUE;  				} else {  					state = SCE_H_OTHER;  				} @@ -623,6 +630,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty  			} else if (ch == '\'') {  				styler.ColourTo(i - 1, StateToPrint);  				state = SCE_H_SINGLESTRING; +			} else if (ch == '=') { +				styler.ColourTo(i, StateToPrint); +				state = SCE_H_VALUE;  			} else if (ch == '/' && chNext == '>') {  				styler.ColourTo(i - 1, StateToPrint);  				styler.ColourTo(i + 1, SCE_H_TAGEND); @@ -658,6 +668,32 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty  				state = SCE_H_OTHER;  			}  			break; +		case SCE_H_VALUE: +			if (!ishtmlwordchar(ch)) { +				if (ch == '\"') { +					// Should really test for being first character +					state = SCE_H_DOUBLESTRING; +				} else if (ch == '\'') { +					state = SCE_H_SINGLESTRING; +				} else { +					if (IsNumber(styler.GetStartSegment(), styler)) { +						styler.ColourTo(i - 1, SCE_H_NUMBER); +					} else { +						styler.ColourTo(i - 1, StateToPrint); +					} +					if (ch == '>') { +						styler.ColourTo(i, SCE_H_TAG); +						if (inScriptType == eNonHtmlScript) { +							state = StateForScript(scriptLanguage); +						} else { +							state = SCE_H_DEFAULT; +						} +					} else { +						state = SCE_H_OTHER; +					} +				} +			} +			break;  		case SCE_HJ_DEFAULT:  		case SCE_HJ_START:  		case SCE_HJ_SYMBOLS: diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 70e890e1a..4f182850a 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -62,7 +62,6 @@ void ScintillaBase::AddCharUTF(char *s, unsigned int len) {  	bool acActiveBeforeCharAdded = ac.Active();  	if (!acActiveBeforeCharAdded || !ac.IsFillUpChar(*s))  		Editor::AddCharUTF(s, len); -	Editor::AddCharUTF(s, len);  	if (acActiveBeforeCharAdded)  		AutoCompleteChanged(s[0]);  } | 
