aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lexlib/SubStyles.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/lexlib/SubStyles.h b/lexlib/SubStyles.h
index ee0edce96..961715c3c 100644
--- a/lexlib/SubStyles.h
+++ b/lexlib/SubStyles.h
@@ -62,10 +62,12 @@ public:
void SetIdentifiers(int style, const char *identifiers) {
while (*identifiers) {
const char *cpSpace = identifiers;
- while (*cpSpace && *cpSpace != ' ')
+ while (*cpSpace && !(*cpSpace == ' ' || *cpSpace == '\t' || *cpSpace == '\r' || *cpSpace == '\n'))
cpSpace++;
- std::string word(identifiers, cpSpace - identifiers);
- wordToStyle[word] = style;
+ if (cpSpace > identifiers) {
+ std::string word(identifiers, cpSpace - identifiers);
+ wordToStyle[word] = style;
+ }
identifiers = cpSpace;
if (*identifiers)
identifiers++;