diff options
| author | Neil <nyamatongwe@gmail.com> | 2017-05-10 14:15:16 +1000 |
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2017-05-10 14:15:16 +1000 |
| commit | 789644c36be4220ae0920ec3bc60115a3a05b160 (patch) | |
| tree | 8a6bcb68122a37b529665056cc9b346e50b192f6 /src/Decoration.h | |
| parent | 91c4a9ff07821dce93dab3ffd77df081893b723d (diff) | |
| download | scintilla-mirror-789644c36be4220ae0920ec3bc60115a3a05b160.tar.gz | |
Simplify DecorationList and its clients by using a vector instead of an
intrusive linked list. Restrict clients to a read-only view.
Diffstat (limited to 'src/Decoration.h')
| -rw-r--r-- | src/Decoration.h | 20 |
1 files changed, 10 insertions, 10 deletions
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<std::unique_ptr<Decoration>> decorationList; + std::vector<const Decoration*> 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<const Decoration*> &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); |
