Skip to content

Commit

Permalink
+ fix highlighting of words with numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Apr 10, 2015
1 parent 1c79112 commit 64b8313
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/Mod/Fem/Gui/AbaqusHighlighter.cpp
Expand Up @@ -49,7 +49,7 @@ void AbaqusHighlighter::highlightBlock(const QString &text)
// Find a syntax file for the Abaqus format here
// http://notepad-plus.sourceforge.net/commun/userDefinedLang/userDefineLang_Abaqus.xml
//
enum { NormalState = -1, Definition, BeforeKey, InideKey, BeforeValue, InsideValue, Number };
enum { NormalState = -1, Definition, BeforeKey, InideKey, BeforeValue, InsideValue, Text, Number };

int state = NormalState;
int start = 0;
Expand Down Expand Up @@ -112,7 +112,7 @@ void AbaqusHighlighter::highlightBlock(const QString &text)
}
// Number
else if (state == Number) {
if (!text[i].isNumber()) {
if (!text[i].isNumber() && text[i] != QLatin1Char('.')) {
QTextCharFormat numberFormat;
numberFormat.setForeground(numberColor);
setFormat(start, i - start, numberFormat);
Expand All @@ -121,7 +121,7 @@ void AbaqusHighlighter::highlightBlock(const QString &text)
state = NormalState;
}
}
else if (text[i].isNumber()) {
else if (text[i].isNumber() || text[i] == QLatin1Char('-')) {
if (state == NormalState) {
start = i;
state = Number;
Expand All @@ -140,6 +140,15 @@ void AbaqusHighlighter::highlightBlock(const QString &text)
start = i;
state = Definition;
}
else if (text[i].isLetterOrNumber()) {
if (state == NormalState) {
start = i;
state = Text;
}
}
else {
state = NormalState;
}
}

if (state == Definition) {
Expand Down

0 comments on commit 64b8313

Please sign in to comment.