diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/CellBuffer.cxx | 13 | ||||
| -rw-r--r-- | src/CellBuffer.h | 4 | ||||
| -rw-r--r-- | src/Document.cxx | 22 | ||||
| -rw-r--r-- | src/Document.h | 5 | ||||
| -rw-r--r-- | src/Editor.cxx | 78 | ||||
| -rw-r--r-- | src/PositionCache.cxx | 5 | ||||
| -rw-r--r-- | src/PositionCache.h | 2 | ||||
| -rw-r--r-- | src/ScintillaBase.cxx | 10 | ||||
| -rw-r--r-- | src/ViewStyle.h | 2 | 
9 files changed, 34 insertions, 107 deletions
| diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index c05060865..0c56c9e92 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -413,25 +413,24 @@ const char *CellBuffer::InsertString(int position, const char *s, int insertLeng  	return data;  } -bool CellBuffer::SetStyleAt(int position, char styleValue, char mask) { -	styleValue &= mask; +bool CellBuffer::SetStyleAt(int position, char styleValue) {  	char curVal = style.ValueAt(position); -	if ((curVal & mask) != styleValue) { -		style.SetValueAt(position, static_cast<char>((curVal & ~mask) | styleValue)); +	if (curVal != styleValue) { +		style.SetValueAt(position, styleValue);  		return true;  	} else {  		return false;  	}  } -bool CellBuffer::SetStyleFor(int position, int lengthStyle, char styleValue, char mask) { +bool CellBuffer::SetStyleFor(int position, int lengthStyle, char styleValue) {  	bool changed = false;  	PLATFORM_ASSERT(lengthStyle == 0 ||  		(lengthStyle > 0 && lengthStyle + position <= style.Length()));  	while (lengthStyle--) {  		char curVal = style.ValueAt(position); -		if ((curVal & mask) != styleValue) { -			style.SetValueAt(position, static_cast<char>((curVal & ~mask) | styleValue)); +		if (curVal != styleValue) { +			style.SetValueAt(position, styleValue);  			changed = true;  		}  		position++; diff --git a/src/CellBuffer.h b/src/CellBuffer.h index 6b719de27..f07b45983 100644 --- a/src/CellBuffer.h +++ b/src/CellBuffer.h @@ -180,8 +180,8 @@ public:  	/// Setting styles for positions outside the range of the buffer is safe and has no effect.  	/// @return true if the style of a character is changed. -	bool SetStyleAt(int position, char styleValue, char mask='\377'); -	bool SetStyleFor(int position, int length, char styleValue, char mask); +	bool SetStyleAt(int position, char styleValue); +	bool SetStyleFor(int position, int length, char styleValue);  	const char *DeleteChars(int position, int deleteLength, bool &startSequence); diff --git a/src/Document.cxx b/src/Document.cxx index 0108669c2..b986a1cfd 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -58,7 +58,7 @@ void LexInterface::Colourise(int start, int end) {  		int styleStart = 0;  		if (start > 0) -			styleStart = pdoc->StyleAt(start - 1) & pdoc->stylingBitsMask; +			styleStart = pdoc->StyleAt(start - 1);  		if (len > 0) {  			instance->Lex(start, len, styleStart, pdoc); @@ -90,9 +90,6 @@ Document::Document() {  #endif  	dbcsCodePage = 0;  	lineEndBitSet = SC_LINE_END_TYPE_DEFAULT; -	stylingBits = 5; -	stylingBitsMask = 0x1F; -	stylingMask = 0;  	endStyled = 0;  	styleClock = 0;  	enteredModification = 0; @@ -1712,13 +1709,7 @@ int Document::GetCharsOfClass(CharClassify::cc characterClass, unsigned char *bu      return charClass.GetCharsOfClass(characterClass, buffer);  } -void Document::SetStylingBits(int bits) { -	stylingBits = bits; -	stylingBitsMask = (1 << stylingBits) - 1; -} - -void SCI_METHOD Document::StartStyling(int position, char mask) { -	stylingMask = mask; +void SCI_METHOD Document::StartStyling(int position, char) {  	endStyled = position;  } @@ -1727,9 +1718,8 @@ bool SCI_METHOD Document::SetStyleFor(int length, char style) {  		return false;  	} else {  		enteredStyling++; -		style &= stylingMask;  		int prevEndStyled = endStyled; -		if (cb.SetStyleFor(endStyled, length, style, stylingMask)) { +		if (cb.SetStyleFor(endStyled, length, style)) {  			DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,  			                   prevEndStyled, length);  			NotifyModified(mh); @@ -1750,7 +1740,7 @@ bool SCI_METHOD Document::SetStyles(int length, const char *styles) {  		int endMod = 0;  		for (int iPos = 0; iPos < length; iPos++, endStyled++) {  			PLATFORM_ASSERT(endStyled < Length()); -			if (cb.SetStyleAt(endStyled, styles[iPos], stylingMask)) { +			if (cb.SetStyleAt(endStyled, styles[iPos])) {  				if (!didChange) {  					startMod = endStyled;  				} @@ -2080,7 +2070,7 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) {  	char chSeek = BraceOpposite(chBrace);  	if (chSeek == '\0')  		return - 1; -	char styBrace = static_cast<char>(StyleAt(position) & stylingBitsMask); +	char styBrace = static_cast<char>(StyleAt(position));  	int direction = -1;  	if (chBrace == '(' || chBrace == '[' || chBrace == '{' || chBrace == '<')  		direction = 1; @@ -2088,7 +2078,7 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) {  	position = NextPosition(position, direction);  	while ((position >= 0) && (position < Length())) {  		char chAtPos = CharAt(position); -		char styAtPos = static_cast<char>(StyleAt(position) & stylingBitsMask); +		char styAtPos = static_cast<char>(StyleAt(position));  		if ((position > GetEndStyled()) || (styAtPos == styBrace)) {  			if (chAtPos == chBrace)  				depth++; diff --git a/src/Document.h b/src/Document.h index e2414bd36..8212db674 100644 --- a/src/Document.h +++ b/src/Document.h @@ -206,7 +206,6 @@ private:  	CellBuffer cb;  	CharClassify charClass;  	CaseFolder *pcf; -	char stylingMask;  	int endStyled;  	int styleClock;  	int enteredModification; @@ -229,9 +228,6 @@ public:  	LexInterface *pli; -	int stylingBits; -	int stylingBitsMask; -  	int eolMode;  	/// Can also be SC_CP_UTF8 to enable UTF-8 mode  	int dbcsCodePage; @@ -369,7 +365,6 @@ public:  	void SetDefaultCharClasses(bool includeWordClass);  	void SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass);  	int GetCharsOfClass(CharClassify::cc charClass, unsigned char *buffer); -	void SetStylingBits(int bits);  	void SCI_METHOD StartStyling(int position, char mask);  	bool SCI_METHOD SetStyleFor(int length, char style);  	bool SCI_METHOD SetStyles(int length, const char *styles); diff --git a/src/Editor.cxx b/src/Editor.cxx index 4966d8efd..7fbe39c38 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -885,9 +885,8 @@ bool Editor::RangeContainsProtected(int start, int end) const {  			start = end;  			end = t;  		} -		int mask = pdoc->stylingBitsMask;  		for (int pos = start; pos < end; pos++) { -			if (vs.styles[pdoc->StyleAt(pos) & mask].IsProtected()) +			if (vs.styles[pdoc->StyleAt(pos)].IsProtected())  				return true;  		}  	} @@ -916,17 +915,16 @@ SelectionPosition Editor::MovePositionOutsideChar(SelectionPosition pos, int mov  	if (posMoved != pos.Position())  		pos.SetPosition(posMoved);  	if (vs.ProtectionActive()) { -		int mask = pdoc->stylingBitsMask;  		if (moveDir > 0) { -			if ((pos.Position() > 0) && vs.styles[pdoc->StyleAt(pos.Position() - 1) & mask].IsProtected()) { +			if ((pos.Position() > 0) && vs.styles[pdoc->StyleAt(pos.Position() - 1)].IsProtected()) {  				while ((pos.Position() < pdoc->Length()) && -				        (vs.styles[pdoc->StyleAt(pos.Position()) & mask].IsProtected())) +				        (vs.styles[pdoc->StyleAt(pos.Position())].IsProtected()))  					pos.Add(1);  			}  		} else if (moveDir < 0) { -			if (vs.styles[pdoc->StyleAt(pos.Position()) & mask].IsProtected()) { +			if (vs.styles[pdoc->StyleAt(pos.Position())].IsProtected()) {  				while ((pos.Position() > 0) && -				        (vs.styles[pdoc->StyleAt(pos.Position() - 1) & mask].IsProtected())) +				        (vs.styles[pdoc->StyleAt(pos.Position() - 1)].IsProtected()))  					pos.Add(-1);  			}  		} @@ -2178,7 +2176,6 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou  		if (lineLength == ll->numCharsInLine) {  			// See if chars, styles, indicators, are all the same  			bool allSame = true; -			const int styleMask = pdoc->stylingBitsMask;  			// Check base line layout  			char styleByte = 0;  			int numCharsInLine = 0; @@ -2187,9 +2184,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou  				char chDoc = pdoc->CharAt(charInDoc);  				styleByte = pdoc->StyleAt(charInDoc);  				allSame = allSame && -				        (ll->styles[numCharsInLine] == static_cast<unsigned char>(styleByte & styleMask)); -				allSame = allSame && -				        (ll->indicators[numCharsInLine] == static_cast<char>(styleByte & ~styleMask)); +				        (ll->styles[numCharsInLine] == static_cast<unsigned char>(styleByte));  				if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseMixed)  					allSame = allSame &&  					        (ll->chars[numCharsInLine] == chDoc); @@ -2223,8 +2218,6 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou  			ll->edgeColumn = -1;  		} -		const int styleMask = pdoc->stylingBitsMask; -		ll->styleBitsSet = 0;  		// Fill base line layout  		const int lineLength = posLineEnd - posLineStart;  		pdoc->GetCharRange(ll->chars, posLineStart, lineLength); @@ -2233,11 +2226,9 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou  		const int numCharsInLine = (vstyle.viewEOL) ? lineLength : numCharsBeforeEOL;  		for (int styleInLine = 0; styleInLine < numCharsInLine; styleInLine++) {  			const unsigned char styleByte = ll->styles[styleInLine]; -			ll->styleBitsSet |= styleByte; -			ll->styles[styleInLine] = styleByte & styleMask; -			ll->indicators[styleInLine] = static_cast<char>(styleByte & ~styleMask); +			ll->styles[styleInLine] = styleByte;  		} -		const unsigned char styleByteLast = ((lineLength > 0) ? ll->styles[lineLength-1] : 0) & styleMask; +		const unsigned char styleByteLast = (lineLength > 0) ? ll->styles[lineLength-1] : 0;  		if (vstyle.someStylesForceCase) {  			for (int charInLine = 0; charInLine<lineLength; charInLine++) {  				char chDoc = ll->chars[charInLine]; @@ -2251,7 +2242,6 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou  		// Extra element at the end of the line to hold end x position and act as  		ll->chars[numCharsInLine] = 0;   // Also triggers processing in the loops as this is a control character  		ll->styles[numCharsInLine] = styleByteLast;	// For eolFilled -		ll->indicators[numCharsInLine] = 0;  		// Layout the line, determining the position of each character,  		// with an extra element at the end for the end of the line. @@ -2508,7 +2498,6 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin          bool drawWrapMarkEnd, ColourDesired wrapColour) {  	const int posLineStart = pdoc->LineStart(line); -	const int styleMask = pdoc->stylingBitsMask;  	PRectangle rcSegment = rcLine;  	const bool lastSubLine = subLine == (ll->lines - 1); @@ -2523,7 +2512,7 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin  	if (virtualSpace) {  		rcSegment.left = xEol + xStart;  		rcSegment.right = xEol + xStart + virtualSpace; -		surface->FillRectangle(rcSegment, overrideBackground ? background : vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back); +		surface->FillRectangle(rcSegment, overrideBackground ? background : vsDraw.styles[ll->styles[ll->numCharsInLine]].back);  		if (!hideSelection && ((vsDraw.selAlpha == SC_ALPHA_NOALPHA) || (vsDraw.selAdditionalAlpha == SC_ALPHA_NOALPHA))) {  			SelectionSegment virtualSpaceRange(SelectionPosition(pdoc->LineEnd(line)), SelectionPosition(pdoc->LineEnd(line), sel.VirtualSpaceFor(pdoc->LineEnd(line))));  			for (size_t r=0; r<sel.Count(); r++) { @@ -2607,9 +2596,9 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin  		if (overrideBackground) {  			surface->FillRectangle(rcSegment, background);  		} else if (line < pdoc->LinesTotal() - 1) { -			surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back); -		} else if (vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].eolFilled) { -			surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back); +			surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine]].back); +		} else if (vsDraw.styles[ll->styles[ll->numCharsInLine]].eolFilled) { +			surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine]].back);  		} else {  			surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back);  		} @@ -2629,8 +2618,8 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin  	} else {  		if (overrideBackground) {  			surface->FillRectangle(rcSegment, background); -		} else if (vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].eolFilled) { -			surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back); +		} else if (vsDraw.styles[ll->styles[ll->numCharsInLine]].eolFilled) { +			surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine]].back);  		} else {  			surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back);  		} @@ -2672,38 +2661,6 @@ void Editor::DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int x  	const int lineStart = ll->LineStart(subLine);  	const int posLineEnd = posLineStart + lineEnd; -	if (!under) { -		// Draw indicators -		// foreach indicator... -		for (int indicnum = 0, mask = 1 << pdoc->stylingBits; mask < 0x100; indicnum++) { -			if (!(mask & ll->styleBitsSet)) { -				mask <<= 1; -				continue; -			} -			int startPos = -1; -			// foreach style pos in line... -			for (int indicPos = lineStart; indicPos <= lineEnd; indicPos++) { -				// look for starts... -				if (startPos < 0) { -					// NOT in indicator run, looking for START -					if (indicPos < lineEnd && (ll->indicators[indicPos] & mask)) -						startPos = indicPos; -				} -				// ... or ends -				if (startPos >= 0) { -					// IN indicator run, looking for END -					if (indicPos >= lineEnd || !(ll->indicators[indicPos] & mask)) { -						// AT end of indicator run, DRAW it! -						DrawIndicator(indicnum, startPos, indicPos, surface, vsDraw, xStart, rcLine, ll, subLine); -						// RESET control var -						startPos = -1; -					} -				} -			} -			mask <<= 1; -		} -	} -  	for (Decoration *deco = pdoc->decorations.root; deco; deco = deco->next) {  		if (under == vsDraw.indicators[deco->indicator].under) {  			int startPos = posLineStart + lineStart; @@ -6536,7 +6493,7 @@ void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, b  }  bool Editor::PositionIsHotspot(int position) const { -	return vs.styles[pdoc->StyleAt(position) & pdoc->stylingBitsMask].hotspot; +	return vs.styles[pdoc->StyleAt(position)].hotspot;  }  bool Editor::PointIsHotspot(Point pt) { @@ -8647,12 +8604,11 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  		InvalidateStyleRedraw();  		break;  	case SCI_SETSTYLEBITS: -		vs.EnsureStyle((1 << wParam) - 1); -		pdoc->SetStylingBits(static_cast<int>(wParam)); +		vs.EnsureStyle(0xff);  		break;  	case SCI_GETSTYLEBITS: -		return pdoc->stylingBits; +		return 8;  	case SCI_SETLINESTATE:  		return pdoc->SetLineState(static_cast<int>(wParam), static_cast<int>(lParam)); diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 2a120c1cf..e425ebe69 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -59,8 +59,6 @@ LineLayout::LineLayout(int maxLineLength_) :  	edgeColumn(0),  	chars(0),  	styles(0), -	styleBitsSet(0), -	indicators(0),  	positions(0),  	hsStart(0),  	hsEnd(0), @@ -81,7 +79,6 @@ void LineLayout::Resize(int maxLineLength_) {  		Free();  		chars = new char[maxLineLength_ + 1];  		styles = new unsigned char[maxLineLength_ + 1]; -		indicators = new char[maxLineLength_ + 1];  		// Extra position allocated as sometimes the Windows  		// GetTextExtentExPoint API writes an extra element.  		positions = new XYPOSITION[maxLineLength_ + 1 + 1]; @@ -94,8 +91,6 @@ void LineLayout::Free() {  	chars = 0;  	delete []styles;  	styles = 0; -	delete []indicators; -	indicators = 0;  	delete []positions;  	positions = 0;  	delete []lineStarts; diff --git a/src/PositionCache.h b/src/PositionCache.h index d8ea0119d..614c81d38 100644 --- a/src/PositionCache.h +++ b/src/PositionCache.h @@ -39,8 +39,6 @@ public:  	int edgeColumn;  	char *chars;  	unsigned char *styles; -	int styleBitsSet; -	char *indicators;  	XYPOSITION *positions;  	char bracePreviousStyles[2]; diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 9736c52f0..32ad962e8 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -492,7 +492,6 @@ public:  	void SetLexerLanguage(const char *languageName);  	const char *DescribeWordListSets();  	void SetWordList(int n, const char *wl); -	int GetStyleBitsNeeded() const;  	const char *GetName() const;  	void *PrivateCall(int operation, void *pointer);  	const char *PropertyNames(); @@ -594,10 +593,6 @@ void LexState::SetWordList(int n, const char *wl) {  	}  } -int LexState::GetStyleBitsNeeded() const { -	return lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5; -} -  const char *LexState::GetName() const {  	return lexCurrent ? lexCurrent->languageName : "";  } @@ -740,8 +735,7 @@ void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) {  void ScintillaBase::NotifyLexerChanged(Document *, void *) {  #ifdef SCI_LEXER -	int bits = DocumentLexState()->GetStyleBitsNeeded(); -	vs.EnsureStyle((1 << bits) - 1); +	vs.EnsureStyle(0xff);  #endif  } @@ -982,7 +976,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara  			DocumentLexState()->PrivateCall(wParam, reinterpret_cast<void *>(lParam)));  	case SCI_GETSTYLEBITSNEEDED: -		return DocumentLexState()->GetStyleBitsNeeded(); +		return 8;  	case SCI_PROPERTYNAMES:  		return StringResult(lParam, DocumentLexState()->PropertyNames()); diff --git a/src/ViewStyle.h b/src/ViewStyle.h index be9d8abfc..4dfb14a33 100644 --- a/src/ViewStyle.h +++ b/src/ViewStyle.h @@ -157,7 +157,7 @@ public:  	ViewStyle();  	ViewStyle(const ViewStyle &source);  	~ViewStyle(); -	void Init(size_t stylesSize_=64); +	void Init(size_t stylesSize_=256);  	void Refresh(Surface &surface, int tabInChars);  	void ReleaseAllExtendedStyles();  	int AllocateExtendedStyles(int numberStyles); | 
