aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2009-06-10 10:54:57 +0000
committernyamatongwe <devnull@localhost>2009-06-10 10:54:57 +0000
commit8b064ce4521a34da81beefe5c7b7743825a90b45 (patch)
tree36aad6126ec7825e48a4387c1dae29bbd53ec86c
parent1dbec24d4f23053d0efa1c10ebb7fcafacea5ca4 (diff)
downloadscintilla-mirror-8b064ce4521a34da81beefe5c7b7743825a90b45.tar.gz
Clear out per-line data when all contents removed.
-rw-r--r--src/CellBuffer.cxx5
-rw-r--r--src/CellBuffer.h1
-rw-r--r--src/Document.cxx7
-rw-r--r--src/Document.h1
-rw-r--r--src/PerLine.cxx16
-rw-r--r--src/PerLine.h4
6 files changed, 33 insertions, 1 deletions
diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx
index 1db0d7d0a..7134d3188 100644
--- a/src/CellBuffer.cxx
+++ b/src/CellBuffer.cxx
@@ -21,7 +21,7 @@
using namespace Scintilla;
#endif
-LineVector::LineVector() : starts(256) {
+LineVector::LineVector() : starts(256), perLine(0) {
Init();
}
@@ -31,6 +31,9 @@ LineVector::~LineVector() {
void LineVector::Init() {
starts.DeleteAll();
+ if (perLine) {
+ perLine->Init();
+ }
}
void LineVector::SetPerLine(PerLine *pl) {
diff --git a/src/CellBuffer.h b/src/CellBuffer.h
index 5af135736..336dfb4df 100644
--- a/src/CellBuffer.h
+++ b/src/CellBuffer.h
@@ -16,6 +16,7 @@ namespace Scintilla {
class PerLine {
public:
virtual ~PerLine() {}
+ virtual void Init()=0;
virtual void InsertLine(int)=0;
virtual void RemoveLine(int)=0;
};
diff --git a/src/Document.cxx b/src/Document.cxx
index ac37215b2..c71f840b6 100644
--- a/src/Document.cxx
+++ b/src/Document.cxx
@@ -100,6 +100,13 @@ Document::~Document() {
regex = 0;
}
+void Document::Init() {
+ for (int j=0; j<ldSize; j++) {
+ if (perLineData[j])
+ perLineData[j]->Init();
+ }
+}
+
void Document::InsertLine(int line) {
for (int j=0; j<ldSize; j++) {
if (perLineData[j])
diff --git a/src/Document.h b/src/Document.h
index 6ff6c2d71..19840315c 100644
--- a/src/Document.h
+++ b/src/Document.h
@@ -175,6 +175,7 @@ public:
int AddRef();
int Release();
+ virtual void Init();
virtual void InsertLine(int line);
virtual void RemoveLine(int line);
diff --git a/src/PerLine.cxx b/src/PerLine.cxx
index 466d2fb31..5408c0258 100644
--- a/src/PerLine.cxx
+++ b/src/PerLine.cxx
@@ -125,6 +125,10 @@ void MarkerHandleSet::CombineWith(MarkerHandleSet *other) {
}
LineMarkers::~LineMarkers() {
+ Init();
+}
+
+void LineMarkers::Init() {
for (int line = 0; line < markers.Length(); line++) {
delete markers[line];
markers[line] = 0;
@@ -227,6 +231,10 @@ void LineMarkers::DeleteMarkFromHandle(int markerHandle) {
LineLevels::~LineLevels() {
}
+void LineLevels::Init() {
+ levels.DeleteAll();
+}
+
void LineLevels::InsertLine(int line) {
if (levels.Length()) {
int level = SC_FOLDLEVELBASE;
@@ -281,6 +289,10 @@ int LineLevels::GetLevel(int line) {
LineState::~LineState() {
}
+void LineState::Init() {
+ lineStates.DeleteAll();
+}
+
void LineState::InsertLine(int line) {
if (lineStates.Length()) {
lineStates.EnsureLength(line);
@@ -339,6 +351,10 @@ LineAnnotation::~LineAnnotation() {
ClearAll();
}
+void LineAnnotation::Init() {
+ ClearAll();
+}
+
void LineAnnotation::InsertLine(int line) {
if (annotations.Length()) {
annotations.Insert(line, 0);
diff --git a/src/PerLine.h b/src/PerLine.h
index 8f3368b82..ab34c46fe 100644
--- a/src/PerLine.h
+++ b/src/PerLine.h
@@ -49,6 +49,7 @@ public:
LineMarkers() : handleCurrent(0) {
}
virtual ~LineMarkers();
+ virtual void Init();
virtual void InsertLine(int line);
virtual void RemoveLine(int line);
@@ -64,6 +65,7 @@ class LineLevels : public PerLine {
SplitVector<int> levels;
public:
virtual ~LineLevels();
+ virtual void Init();
virtual void InsertLine(int line);
virtual void RemoveLine(int line);
@@ -79,6 +81,7 @@ public:
LineState() {
}
virtual ~LineState();
+ virtual void Init();
virtual void InsertLine(int line);
virtual void RemoveLine(int line);
@@ -93,6 +96,7 @@ public:
LineAnnotation() {
}
virtual ~LineAnnotation();
+ virtual void Init();
virtual void InsertLine(int line);
virtual void RemoveLine(int line);