From 789644c36be4220ae0920ec3bc60115a3a05b160 Mon Sep 17 00:00:00 2001 From: Neil Date: Wed, 10 May 2017 14:15:16 +1000 Subject: Simplify DecorationList and its clients by using a vector instead of an intrusive linked list. Restrict clients to a read-only view. --- src/Decoration.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/Decoration.h') diff --git a/src/Decoration.h b/src/Decoration.h index 881bd1ff5..d096da385 100644 --- a/src/Decoration.h +++ b/src/Decoration.h @@ -14,16 +14,12 @@ namespace Scintilla { class Decoration { int indicator; public: - Decoration *next; RunStyles rs; explicit Decoration(int indicator_); ~Decoration(); bool Empty() const; - Decoration *Next() const { - return next; - } int Indicator() const { return indicator; } @@ -32,22 +28,24 @@ public: class DecorationList { int currentIndicator; int currentValue; - Decoration *current; + Decoration *current; // Cached so FillRange doesn't have to search for each call. int lengthDocument; + // Ordered by indicator + std::vector> decorationList; + std::vector decorationView; // Read-only view of decorationList + bool clickNotified; + Decoration *DecorationFromIndicator(int indicator); Decoration *Create(int indicator, int length); void Delete(int indicator); void DeleteAnyEmpty(); - Decoration *root; - bool clickNotified; + void SetView(); public: DecorationList(); ~DecorationList(); - Decoration *Root() const { - return root; - } + const std::vector &View() const { return decorationView; } void SetCurrentIndicator(int indicator); int GetCurrentIndicator() const { return currentIndicator; } @@ -61,6 +59,8 @@ public: void InsertSpace(int position, int insertLength); void DeleteRange(int position, int deleteLength); + void DeleteLexerDecorations(); + int AllOnFor(int position) const; int ValueAt(int indicator, int position); int Start(int indicator, int position); -- cgit v1.2.3