aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexlib/SubStyles.h
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2019-04-25 11:11:19 +1000
committerNeil <nyamatongwe@gmail.com>2019-04-25 11:11:19 +1000
commit951a1102da2095604232a3efc76846f1f7de004a (patch)
tree0c8fdb7bea6ac86a96308daf6a0cd883ae4678fe /lexlib/SubStyles.h
parent89b349be026a6fa7f0c34c8277dcb18593007763 (diff)
downloadscintilla-mirror-951a1102da2095604232a3efc76846f1f7de004a.tar.gz
Backport: Fix bug where changing identifier sets in lexers preserved previous identifiers.
Backport of changeset 7473:5d760343adde.
Diffstat (limited to 'lexlib/SubStyles.h')
-rw-r--r--lexlib/SubStyles.h12
1 files changed, 12 insertions, 0 deletions
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<std::string, int>::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'))