summaryrefslogtreecommitdiff
path: root/src/highlighter.cc
diff options
context:
space:
mode:
authorDon Bright <hugh.m.bright@gmail.com>2013-06-15 19:25:01 (GMT)
committerDon Bright <hugh.m.bright@gmail.com>2013-06-15 19:25:01 (GMT)
commit07729e5384f650a66e73f19b69756ad66e0e8b7b (patch)
treee0e0f7bc0fa80370c93b7aafb5c269b2d13909d3 /src/highlighter.cc
parent0b9861e7bd937c844f9d50099ea62ad95fd4e2bc (diff)
track \ inside "" with sub-state. fixes #407
Diffstat (limited to 'src/highlighter.cc')
-rw-r--r--src/highlighter.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/highlighter.cc b/src/highlighter.cc
index fc023a5..4b4aa30 100644
--- a/src/highlighter.cc
+++ b/src/highlighter.cc
@@ -288,6 +288,7 @@ void Highlighter::highlightBlock(const QString &text)
// Quoting and Comments.
state_e state = (state_e) previousBlockState();
+ int quote_esc_state = 0;
for (int n = 0; n < text.size(); ++n){
if (state == NORMAL){
if (text[n] == '"'){
@@ -304,7 +305,11 @@ void Highlighter::highlightBlock(const QString &text)
}
} else if (state == QUOTE){
setFormat(n,1,quoteFormat);
- if (text[n] == '"' && n-1 >=0 && text[n-1] != '\\')
+ if (quote_esc_state > 0)
+ quote_esc_state = 0;
+ else if (text[n] == '\\')
+ quote_esc_state = 1;
+ else if (text[n] == '"')
state = NORMAL;
} else if (state == COMMENT){
setFormat(n,1,commentFormat);
contact: Jan Huwald // Impressum