diff options
Diffstat (limited to 'src/Document.cxx')
| -rw-r--r-- | src/Document.cxx | 41 | 
1 files changed, 21 insertions, 20 deletions
| diff --git a/src/Document.cxx b/src/Document.cxx index 400769635..3750f99a8 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -55,7 +55,8 @@ Document::Document() {  	stylingMask = 0;  	endStyled = 0;  	styleClock = 0; -	enteredCount = 0; +	enteredModification = 0; +	enteredStyling = 0;  	enteredReadOnlyCount = 0;  	tabInChars = 8;  	indentInChars = 0; @@ -369,10 +370,10 @@ bool Document::DeleteChars(int pos, int len) {  	if ((pos + len) > Length())  		return false;  	CheckReadOnly(); -	if (enteredCount != 0) { +	if (enteredModification != 0) {  		return false;  	} else { -		enteredCount++; +		enteredModification++;  		if (!cb.IsReadOnly()) {  			NotifyModified(  			    DocModification( @@ -395,7 +396,7 @@ bool Document::DeleteChars(int pos, int len) {  			        pos, len,  			        LinesTotal() - prevLinesTotal, text));  		} -		enteredCount--; +		enteredModification--;  	}  	return !cb.IsReadOnly();  } @@ -408,10 +409,10 @@ bool Document::InsertString(int position, const char *s, int insertLength) {  		return false;  	}  	CheckReadOnly(); -	if (enteredCount != 0) { +	if (enteredModification != 0) {  		return false;  	} else { -		enteredCount++; +		enteredModification++;  		if (!cb.IsReadOnly()) {  			NotifyModified(  			    DocModification( @@ -431,7 +432,7 @@ bool Document::InsertString(int position, const char *s, int insertLength) {  			        position, insertLength,  			        LinesTotal() - prevLinesTotal, text));  		} -		enteredCount--; +		enteredModification--;  	}  	return !cb.IsReadOnly();  } @@ -439,8 +440,8 @@ bool Document::InsertString(int position, const char *s, int insertLength) {  int Document::Undo() {  	int newPos = -1;  	CheckReadOnly(); -	if (enteredCount == 0) { -		enteredCount++; +	if (enteredModification == 0) { +		enteredModification++;  		if (!cb.IsReadOnly()) {  			bool startSavePoint = cb.IsSavePoint();  			bool multiLine = false; @@ -487,7 +488,7 @@ int Document::Undo() {  			if (startSavePoint != endSavePoint)  				NotifySavePoint(endSavePoint);  		} -		enteredCount--; +		enteredModification--;  	}  	return newPos;  } @@ -495,8 +496,8 @@ int Document::Undo() {  int Document::Redo() {  	int newPos = -1;  	CheckReadOnly(); -	if (enteredCount == 0) { -		enteredCount++; +	if (enteredModification == 0) { +		enteredModification++;  		if (!cb.IsReadOnly()) {  			bool startSavePoint = cb.IsSavePoint();  			bool multiLine = false; @@ -541,7 +542,7 @@ int Document::Redo() {  			if (startSavePoint != endSavePoint)  				NotifySavePoint(endSavePoint);  		} -		enteredCount--; +		enteredModification--;  	}  	return newPos;  } @@ -1275,10 +1276,10 @@ void Document::StartStyling(int position, char mask) {  }  bool Document::SetStyleFor(int length, char style) { -	if (enteredCount != 0) { +	if (enteredStyling != 0) {  		return false;  	} else { -		enteredCount++; +		enteredStyling++;  		style &= stylingMask;  		int prevEndStyled = endStyled;  		if (cb.SetStyleFor(endStyled, length, style, stylingMask)) { @@ -1287,16 +1288,16 @@ bool Document::SetStyleFor(int length, char style) {  			NotifyModified(mh);  		}  		endStyled += length; -		enteredCount--; +		enteredStyling--;  		return true;  	}  }  bool Document::SetStyles(int length, char *styles) { -	if (enteredCount != 0) { +	if (enteredStyling != 0) {  		return false;  	} else { -		enteredCount++; +		enteredStyling++;  		bool didChange = false;  		int startMod = 0;  		int endMod = 0; @@ -1315,13 +1316,13 @@ bool Document::SetStyles(int length, char *styles) {  			                   startMod, endMod - startMod + 1);  			NotifyModified(mh);  		} -		enteredCount--; +		enteredStyling--;  		return true;  	}  }  void Document::EnsureStyledTo(int pos) { -	if ((enteredCount == 0) && (pos > GetEndStyled())) { +	if ((enteredStyling == 0) && (pos > GetEndStyled())) {  		IncrementStyleClock();  		// Ask the watchers to style, and stop as soon as one responds.  		for (int i = 0; pos > GetEndStyled() && i < lenWatchers; i++) { | 
