From 951a1102da2095604232a3efc76846f1f7de004a Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 25 Apr 2019 11:11:19 +1000 Subject: Backport: Fix bug where changing identifier sets in lexers preserved previous identifiers. Backport of changeset 7473:5d760343adde. --- doc/ScintillaHistory.html | 3 +++ lexlib/SubStyles.h | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index fcd972567..07f4b01be 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -549,6 +549,9 @@
  • Released 10 May 2019.
  • +
  • + Fix bug where changing identifier sets in lexers preserved previous identifiers. +
  • Release 3.10.5 diff --git a/lexlib/SubStyles.h b/lexlib/SubStyles.h index 3e99efe83..f9bdfe65c 100644 --- a/lexlib/SubStyles.h +++ b/lexlib/SubStyles.h @@ -61,7 +61,19 @@ public: return (style >= firstStyle) && (style < (firstStyle + lenStyles)); } + void RemoveStyle(int style) { + std::map::iterator it = wordToStyle.begin(); + while (it != wordToStyle.end()) { + if (it->second == style) { + it = wordToStyle.erase(it); + } else { + ++it; + } + } + } + void SetIdentifiers(int style, const char *identifiers) { + RemoveStyle(style); while (*identifiers) { const char *cpSpace = identifiers; while (*cpSpace && !(*cpSpace == ' ' || *cpSpace == '\t' || *cpSpace == '\r' || *cpSpace == '\n')) -- cgit v1.2.3