diff options
-rw-r--r-- | src/LexOthers.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/LexOthers.cxx b/src/LexOthers.cxx index 205e0e14a..c8f6ca977 100644 --- a/src/LexOthers.cxx +++ b/src/LexOthers.cxx @@ -37,6 +37,10 @@ static bool Is1To9(char ch) { return (ch >= '1') && (ch <= '9'); } +static bool IsAlphabetic(int ch) { + return isascii(ch) && isalpha(ch); +} + static inline bool AtEOL(Accessor &styler, unsigned int i) { return (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); @@ -101,7 +105,7 @@ static void ColouriseBatchLine( } return; // Check for Drive Change (Drive Change is internal command) - return if found - } else if ((isalpha(lineBuffer[offset])) && + } else if ((IsAlphabetic(lineBuffer[offset])) && (lineBuffer[offset + 1] == ':') && ((isspacechar(lineBuffer[offset + 2])) || (((lineBuffer[offset + 2] == '\\')) && @@ -1065,7 +1069,7 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin numstep = 1; // ch was ' ', handle as if it's a delphi errorline, only add 1 to i. else numstep = 2; // otherwise add 2. - for (j = i + numstep; j < lengthLine && isalpha(lineBuffer[j]) && chPos < sizeof(word) - 1; j++) + for (j = i + numstep; j < lengthLine && IsAlphabetic(lineBuffer[j]) && chPos < sizeof(word) - 1; j++) word[chPos++] = lineBuffer[j]; word[chPos] = 0; if (!CompareCaseInsensitive(word, "error") || !CompareCaseInsensitive(word, "warning") || |