diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Editor.cxx | 9 | ||||
-rw-r--r-- | src/Editor.h | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 64e643b67..fd8a2d719 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -179,7 +179,13 @@ void LineLayoutCache::AllocateForLevel(int linesOnScreen, int linesInDoc) { } if (lengthForLevel > size) { Deallocate(); - } else if (lengthForLevel != length) { + } else { + if (lengthForLevel < length) { + for (int i=lengthForLevel; i<length; i++) { + delete cache[i]; + cache[i] = 0; + } + } Invalidate(LineLayout::llInvalid); } if (!cache) { @@ -3950,6 +3956,7 @@ void Editor::SetDocPointer(Document *document) { // Reset the contraction state to fully shown. cs.Clear(); cs.InsertLines(0, pdoc->LinesTotal() - 1); + llc.Deallocate(); NeedWrapping(); pdoc->AddWatcher(this, 0); diff --git a/src/Editor.h b/src/Editor.h index 35aea3fc3..d9719dc53 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -93,10 +93,10 @@ class LineLayoutCache { int styleClock; void Allocate(int length_); void AllocateForLevel(int linesOnScreen, int linesInDoc); - void Deallocate(); public: LineLayoutCache(); virtual ~LineLayoutCache(); + void Deallocate(); enum { llcNone=SC_CACHE_NONE, llcCaret=SC_CACHE_CARET, |