summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/texteditor/generichighlighter/highlighter.cpp3
-rw-r--r--src/plugins/texteditor/generichighlighter/reuse.h4
-rw-r--r--src/plugins/texteditor/generichighlighter/specificrules.cpp14
3 files changed, 11 insertions, 10 deletions
diff --git a/src/plugins/texteditor/generichighlighter/highlighter.cpp b/src/plugins/texteditor/generichighlighter/highlighter.cpp
index 58936ac695..8b4df9a0a5 100644
--- a/src/plugins/texteditor/generichighlighter/highlighter.cpp
+++ b/src/plugins/texteditor/generichighlighter/highlighter.cpp
@@ -205,7 +205,6 @@ void Highlighter::iterateThroughRules(const QString &text,
if (progress->willContinueLine()) {
createWillContinueBlock();
progress->setWillContinueLine(false);
- progress->setOffset(length);
} else {
if (rule->hasChild())
iterateThroughRules(text, length, progress, true, rule->childs());
@@ -270,7 +269,7 @@ void Highlighter::changeContext(const QString &contextName,
m_contexts.pop_back();
if (currentBlockState() >= PersistentsStart) {
- // One or more persistent contexts were popped.
+ // One or more contexts were popped during during a persistent state.
const QString &currentSequence = currentContextSequence();
if (m_persistentStates.contains(currentSequence))
setCurrentBlockState(m_persistentStates.value(currentSequence));
diff --git a/src/plugins/texteditor/generichighlighter/reuse.h b/src/plugins/texteditor/generichighlighter/reuse.h
index 197e3042d9..e22a32cb33 100644
--- a/src/plugins/texteditor/generichighlighter/reuse.h
+++ b/src/plugins/texteditor/generichighlighter/reuse.h
@@ -88,10 +88,10 @@ inline bool isHexDigit(const QChar &c)
return false;
}
-inline void setStartCharacter(QChar &c, const QString &character)
+inline void setStartCharacter(QChar *c, const QString &character)
{
if (!character.isEmpty())
- c = character.at(0);
+ *c = character.at(0);
}
} // namespace Internal
diff --git a/src/plugins/texteditor/generichighlighter/specificrules.cpp b/src/plugins/texteditor/generichighlighter/specificrules.cpp
index 2c80d3ed82..86e6f4e7ec 100644
--- a/src/plugins/texteditor/generichighlighter/specificrules.cpp
+++ b/src/plugins/texteditor/generichighlighter/specificrules.cpp
@@ -45,7 +45,8 @@ void replaceByCaptures(QChar *c, const QStringList &captures)
int index = c->digitValue();
if (index > 0) {
const QString &capture = captures.at(index);
- *c = capture.at(0);
+ if (!capture.isEmpty())
+ *c = capture.at(0);
}
}
@@ -76,7 +77,7 @@ void replaceByCaptures(QString *s, const QStringList &captures)
// DetectChar
void DetectCharRule::setChar(const QString &character)
-{ setStartCharacter(m_char, character); }
+{ setStartCharacter(&m_char, character); }
void DetectCharRule::doReplaceExpressions(const QStringList &captures)
{ replaceByCaptures(&m_char, captures); }
@@ -90,10 +91,10 @@ bool DetectCharRule::doMatchSucceed(const QString &text,
// Detect2Chars
void Detect2CharsRule::setChar(const QString &character)
-{ setStartCharacter(m_char, character); }
+{ setStartCharacter(&m_char, character); }
void Detect2CharsRule::setChar1(const QString &character)
-{ setStartCharacter(m_char1, character); }
+{ setStartCharacter(&m_char1, character); }
void Detect2CharsRule::doReplaceExpressions(const QStringList &captures)
{
@@ -399,10 +400,10 @@ bool HlCCharRule::doMatchSucceed(const QString &text,
// RangeDetect
void RangeDetectRule::setChar(const QString &character)
-{ setStartCharacter(m_char, character); }
+{ setStartCharacter(&m_char, character); }
void RangeDetectRule::setChar1(const QString &character)
-{ setStartCharacter(m_char1, character); }
+{ setStartCharacter(&m_char1, character); }
bool RangeDetectRule::doMatchSucceed(const QString &text,
const int length,
@@ -429,6 +430,7 @@ bool LineContinueRule::doMatchSucceed(const QString &text,
return false;
if (text.at(progress->offset()) == kBackSlash) {
+ progress->incrementOffset();
progress->setWillContinueLine(true);
return true;
}