aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2000-04-03 14:20:25 +0000
committernyamatongwe <devnull@localhost>2000-04-03 14:20:25 +0000
commit943cf3a48da52953c1f2377d9e412ae81b79b5e0 (patch)
tree3b734fbcf4ecdc76f6f49dea3d89f9b72cf2f841 /src
parent0d64f2cfa2f14d8f7fe0694616bb7ff9ceff9a09 (diff)
downloadscintilla-mirror-943cf3a48da52953c1f2377d9e412ae81b79b5e0.tar.gz
Added Mark's change to support changing the document from within the
read-only notification.
Diffstat (limited to 'src')
-rw-r--r--src/Document.cxx15
-rw-r--r--src/Document.h1
2 files changed, 12 insertions, 4 deletions
diff --git a/src/Document.cxx b/src/Document.cxx
index 95107eb08..fb2650425 100644
--- a/src/Document.cxx
+++ b/src/Document.cxx
@@ -32,6 +32,7 @@ Document::Document() {
}
endStyled = 0;
enteredCount = 0;
+ enteredReadOnlyCount = 0;
tabInChars = 8;
watchers = 0;
lenWatchers = 0;
@@ -292,10 +293,13 @@ void Document::ModifiedAt(int pos) {
// Unlike Undo, Redo, and InsertStyledString, the pos argument is a cell number not a char number
void Document::DeleteChars(int pos, int len) {
+ if (cb.IsReadOnly() && enteredReadOnlyCount==0) {
+ enteredReadOnlyCount++;
+ NotifyModifyAttempt();
+ enteredReadOnlyCount--;
+ }
if (enteredCount == 0) {
enteredCount++;
- if (cb.IsReadOnly())
- NotifyModifyAttempt();
if (!cb.IsReadOnly()) {
int prevLinesTotal = LinesTotal();
bool startSavePoint = cb.IsSavePoint();
@@ -312,10 +316,13 @@ void Document::DeleteChars(int pos, int len) {
}
void Document::InsertStyledString(int position, char *s, int insertLength) {
+ if (cb.IsReadOnly() && enteredReadOnlyCount==0) {
+ enteredReadOnlyCount++;
+ NotifyModifyAttempt();
+ enteredReadOnlyCount--;
+ }
if (enteredCount == 0) {
enteredCount++;
- if (cb.IsReadOnly())
- NotifyModifyAttempt();
if (!cb.IsReadOnly()) {
int prevLinesTotal = LinesTotal();
bool startSavePoint = cb.IsSavePoint();
diff --git a/src/Document.h b/src/Document.h
index 4c212b7bd..7ab187573 100644
--- a/src/Document.h
+++ b/src/Document.h
@@ -77,6 +77,7 @@ private:
int stylingMask;
int endStyled;
int enteredCount;
+ int enteredReadOnlyCount;
WatcherWithUserData *watchers;
int lenWatchers;