aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Document.cxx27
-rw-r--r--src/Document.h4
2 files changed, 21 insertions, 10 deletions
diff --git a/src/Document.cxx b/src/Document.cxx
index 22cb0c2b0..97ca97adc 100644
--- a/src/Document.cxx
+++ b/src/Document.cxx
@@ -354,7 +354,9 @@ bool Document::DeleteChars(int pos, int len) {
NotifyModifyAttempt();
enteredReadOnlyCount--;
}
- if (enteredCount == 0) {
+ if (enteredCount != 0) {
+ return false;
+ } else {
enteredCount++;
if (!cb.IsReadOnly()) {
NotifyModified(
@@ -388,7 +390,9 @@ bool Document::InsertStyledString(int position, char *s, int insertLength) {
NotifyModifyAttempt();
enteredReadOnlyCount--;
}
- if (enteredCount == 0) {
+ if (enteredCount != 0) {
+ return false;
+ } else {
enteredCount++;
if (!cb.IsReadOnly()) {
NotifyModified(
@@ -823,8 +827,9 @@ class DocumentIndexer : public CharacterIndexer {
Document *pdoc;
int end;
public:
-DocumentIndexer(Document *pdoc_, int end_) :
- pdoc(pdoc_), end(end_) {}
+ DocumentIndexer(Document *pdoc_, int end_) :
+ pdoc(pdoc_), end(end_) {
+ }
virtual char CharAt(int index) {
if (index < 0 || index >= end)
@@ -1082,8 +1087,10 @@ void Document::StartStyling(int position, char mask) {
endStyled = position;
}
-void Document::SetStyleFor(int length, char style) {
- if (enteredCount == 0) {
+bool Document::SetStyleFor(int length, char style) {
+ if (enteredCount != 0) {
+ return false;
+ } else {
enteredCount++;
int prevEndStyled = endStyled;
if (cb.SetStyleFor(endStyled, length, style, stylingMask)) {
@@ -1093,11 +1100,14 @@ void Document::SetStyleFor(int length, char style) {
}
endStyled += length;
enteredCount--;
+ return true;
}
}
-void Document::SetStyles(int length, char *styles) {
- if (enteredCount == 0) {
+bool Document::SetStyles(int length, char *styles) {
+ if (enteredCount != 0) {
+ return false;
+ } else {
enteredCount++;
int prevEndStyled = endStyled;
bool didChange = false;
@@ -1113,6 +1123,7 @@ void Document::SetStyles(int length, char *styles) {
NotifyModified(mh);
}
enteredCount--;
+ return true;
}
}
diff --git a/src/Document.h b/src/Document.h
index 34c49a5a6..82931207c 100644
--- a/src/Document.h
+++ b/src/Document.h
@@ -202,8 +202,8 @@ public:
void SetWordChars(unsigned char *chars);
void SetStylingBits(int bits);
void StartStyling(int position, char mask);
- void SetStyleFor(int length, char style);
- void SetStyles(int length, char *styles);
+ bool SetStyleFor(int length, char style);
+ bool SetStyles(int length, char *styles);
int GetEndStyled() { return endStyled; }
bool EnsureStyledTo(int pos);
int GetStyleClock() { return styleClock; }