diff options
| author | Neil <nyamatongwe@gmail.com> | 2014-05-31 09:27:48 +1000 | 
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2014-05-31 09:27:48 +1000 | 
| commit | 9bc61b338dfe63d2e6fcc66bc0933a0de6bcd31b (patch) | |
| tree | 64c541e9dcb42c9999759ab7dd40d67c72749b9a /src | |
| parent | 8326c658b392ba13e92918dd89deebd60bcd195f (diff) | |
| parent | 8b447b76bbc110e055a0637657f5f00c65cc98dd (diff) | |
| download | scintilla-mirror-9bc61b338dfe63d2e6fcc66bc0933a0de6bcd31b.tar.gz | |
Merge 343-Win32-Fix which fixes hangs and crashes at shutdown on Windows.
Diffstat (limited to 'src')
| -rw-r--r-- | src/CaseFolder.cxx | 2 | ||||
| -rw-r--r-- | src/Catalogue.cxx | 2 | ||||
| -rw-r--r-- | src/CellBuffer.cxx | 13 | ||||
| -rw-r--r-- | src/CellBuffer.h | 4 | ||||
| -rw-r--r-- | src/Document.cxx | 26 | ||||
| -rw-r--r-- | src/Document.h | 5 | ||||
| -rw-r--r-- | src/Editor.cxx | 80 | ||||
| -rw-r--r-- | src/ExternalLexer.cxx | 2 | ||||
| -rw-r--r-- | src/Indicator.cxx | 2 | ||||
| -rw-r--r-- | src/PositionCache.cxx | 7 | ||||
| -rw-r--r-- | src/PositionCache.h | 2 | ||||
| -rw-r--r-- | src/ScintillaBase.cxx | 56 | ||||
| -rw-r--r-- | src/ScintillaBase.h | 1 | ||||
| -rw-r--r-- | src/ViewStyle.h | 2 | 
14 files changed, 83 insertions, 121 deletions
| diff --git a/src/CaseFolder.cxx b/src/CaseFolder.cxx index 44a94da6f..200ac99b8 100644 --- a/src/CaseFolder.cxx +++ b/src/CaseFolder.cxx @@ -8,9 +8,9 @@  #include <vector>  #include <algorithm> +#include "CaseFolder.h"  #include "CaseConvert.h"  #include "UniConversion.h" -#include "CaseFolder.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/src/Catalogue.cxx b/src/Catalogue.cxx index c507296d2..ac1fc3818 100644 --- a/src/Catalogue.cxx +++ b/src/Catalogue.cxx @@ -8,9 +8,9 @@  #include <stdlib.h>  #include <string.h>  #include <stdio.h> -#include <ctype.h>  #include <stdarg.h>  #include <assert.h> +#include <ctype.h>  #include <vector> 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..32d5f1896 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -8,8 +8,8 @@  #include <stdlib.h>  #include <string.h>  #include <stdio.h> -#include <ctype.h>  #include <assert.h> +#include <ctype.h>  #include <string>  #include <vector> @@ -20,13 +20,13 @@  #include "ILexer.h"  #include "Scintilla.h" +#include "CharacterSet.h"  #include "SplitVector.h"  #include "Partitioning.h"  #include "RunStyles.h"  #include "CellBuffer.h"  #include "PerLine.h"  #include "CharClassify.h" -#include "CharacterSet.h"  #include "Decoration.h"  #include "CaseFolder.h"  #include "Document.h" @@ -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..63d45158b 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -8,9 +8,9 @@  #include <stdlib.h>  #include <string.h>  #include <stdio.h> -#include <ctype.h>  #include <math.h>  #include <assert.h> +#include <ctype.h>  #include <string>  #include <vector> @@ -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/ExternalLexer.cxx b/src/ExternalLexer.cxx index 682320889..25d83ceb8 100644 --- a/src/ExternalLexer.cxx +++ b/src/ExternalLexer.cxx @@ -8,8 +8,8 @@  #include <stdlib.h>  #include <string.h>  #include <stdio.h> -#include <ctype.h>  #include <assert.h> +#include <ctype.h>  #include <string> diff --git a/src/Indicator.cxx b/src/Indicator.cxx index 63735d480..e51067a38 100644 --- a/src/Indicator.cxx +++ b/src/Indicator.cxx @@ -11,8 +11,8 @@  #include "Platform.h"  #include "Scintilla.h" -#include "XPM.h"  #include "Indicator.h" +#include "XPM.h"  #ifdef SCI_NAMESPACE  using namespace Scintilla; diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 2a120c1cf..0d2033bb9 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -17,6 +17,7 @@  #include "Platform.h" +#include "ILexer.h"  #include "Scintilla.h"  #include "SplitVector.h" @@ -32,7 +33,6 @@  #include "ViewStyle.h"  #include "CharClassify.h"  #include "Decoration.h" -#include "ILexer.h"  #include "CaseFolder.h"  #include "Document.h"  #include "UniConversion.h" @@ -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..d42dfc7ff 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -8,8 +8,8 @@  #include <stdlib.h>  #include <string.h>  #include <stdio.h> -#include <ctype.h>  #include <assert.h> +#include <ctype.h>  #include <string>  #include <vector> @@ -21,12 +21,17 @@  #include "ILexer.h"  #include "Scintilla.h" -#include "PropSetSimple.h"  #ifdef SCI_LEXER  #include "SciLexer.h" +#endif + +#include "PropSetSimple.h" + +#ifdef SCI_LEXER  #include "LexerModule.h"  #include "Catalogue.h"  #endif +  #include "SplitVector.h"  #include "Partitioning.h"  #include "RunStyles.h" @@ -39,7 +44,6 @@  #include "LineMarker.h"  #include "Style.h"  #include "ViewStyle.h" -#include "AutoComplete.h"  #include "CharClassify.h"  #include "Decoration.h"  #include "CaseFolder.h" @@ -47,6 +51,7 @@  #include "Selection.h"  #include "PositionCache.h"  #include "Editor.h" +#include "AutoComplete.h"  #include "ScintillaBase.h"  #ifdef SCI_NAMESPACE @@ -57,6 +62,7 @@ ScintillaBase::ScintillaBase() {  	displayPopupMenu = true;  	listType = 0;  	maxListWidth = 0; +	multiAutoCMode = SC_MULTIAUTOC_ONCE;  }  ScintillaBase::~ScintillaBase() { @@ -197,9 +203,30 @@ void ScintillaBase::AutoCompleteDoubleClick(void *p) {  void ScintillaBase::AutoCompleteInsert(Position startPos, int removeLen, const char *text, int textLen) {  	UndoGroup ug(pdoc); -	pdoc->DeleteChars(startPos, removeLen); -	const int lengthInserted = pdoc->InsertString(startPos, text, textLen); -	SetEmptySelection(startPos + lengthInserted); +	if (multiAutoCMode == SC_MULTIAUTOC_ONCE) { +		pdoc->DeleteChars(startPos, removeLen); +		const int lengthInserted = pdoc->InsertString(startPos, text, textLen); +		SetEmptySelection(startPos + lengthInserted); +	} else { +		// SC_MULTIAUTOC_EACH +		for (size_t r=0; r<sel.Count(); r++) { +			if (!RangeContainsProtected(sel.Range(r).Start().Position(), +				sel.Range(r).End().Position())) { +				int positionInsert = sel.Range(r).Start().Position(); +				positionInsert = InsertSpace(positionInsert, sel.Range(r).caret.VirtualSpace()); +				if (positionInsert - removeLen >= 0) { +					positionInsert -= removeLen; +					pdoc->DeleteChars(positionInsert, removeLen); +				} +				const int lengthInserted = pdoc->InsertString(positionInsert, text, textLen); +				if (lengthInserted > 0) { +					sel.Range(r).caret.SetPosition(positionInsert + lengthInserted); +					sel.Range(r).anchor.SetPosition(positionInsert + lengthInserted); +				} +				sel.Range(r).ClearVirtualSpace(); +			} +		} +	}  }  void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { @@ -492,7 +519,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 +620,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 +762,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  } @@ -819,6 +840,13 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara  	case SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR:  		return ac.ignoreCaseBehaviour; +	case SCI_AUTOCSETMULTI: +		multiAutoCMode = static_cast<int>(wParam); +		break; + +	case SCI_AUTOCGETMULTI: +		return multiAutoCMode; +  	case SCI_AUTOCSETORDER:  		ac.autoSort = static_cast<int>(wParam);  		break; @@ -982,7 +1010,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/ScintillaBase.h b/src/ScintillaBase.h index 59ffea41e..8440ebecc 100644 --- a/src/ScintillaBase.h +++ b/src/ScintillaBase.h @@ -46,6 +46,7 @@ protected:  	int listType;			///< 0 is an autocomplete list  	int maxListWidth;		/// Maximum width of list, in average character widths +	int multiAutoCMode; /// Mode for autocompleting when multiple selections are present  #ifdef SCI_LEXER  	LexState *DocumentLexState(); 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); | 
