From e5cf36fcacaf92b4a1ef598cfd0e1dda6d39088a Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sun, 10 Aug 2008 11:32:44 +0000 Subject: Changed ClearDocumentStyle to only act on decorators that exist. --- src/Editor.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Editor.cxx b/src/Editor.cxx index e28275917..1c08b7cc9 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -3493,9 +3493,15 @@ void Editor::ClearAll() { } void Editor::ClearDocumentStyle() { - for (int i=0; i < INDIC_CONTAINER; i++) { - pdoc->decorations.SetCurrentIndicator(i); - pdoc->DecorationFillRange(0, 0, pdoc->Length()); + Decoration *deco = pdoc->decorations.root; + while (deco) { + // Save next in case deco deleted + Decoration *decoNext = deco->next; + if (deco->indicator < INDIC_CONTAINER) { + pdoc->decorations.SetCurrentIndicator(deco->indicator); + pdoc->DecorationFillRange(0, 0, pdoc->Length()); + } + deco = decoNext; } pdoc->StartStyling(0, '\377'); pdoc->SetStyleFor(pdoc->Length(), 0); -- cgit v1.2.3