aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Editor.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2002-03-04 10:40:57 +0000
committernyamatongwe <unknown>2002-03-04 10:40:57 +0000
commit5ce76fcabf1db1051f544165752d23fe501b02c0 (patch)
treebb179ed11cb26f7b298015a3c5d7578ad8f68a57 /src/Editor.cxx
parentc960863c145ab775cc745ccb6b526d5bffcdd11e (diff)
downloadscintilla-mirror-5ce76fcabf1db1051f544165752d23fe501b02c0.tar.gz
Fixed bug when switching buffers led to stale line layout cache entries
by deallocating the cache when switching buffers. When number of lines decreases, line layout cache entries for extra lines are deleted.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r--src/Editor.cxx9
1 files changed, 8 insertions, 1 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);