aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2020-04-29 15:38:02 +0200
committerChristian Stenger <christian.stenger@qt.io>2020-04-29 16:09:08 +0000
commit626807c94e3c1e3d947de2359f26e15dd82641f7 (patch)
treee655777d0a5693f1c1fb2da4161b70ccdaecc81e /src/libs
parent5feec21cbd19d81eb4be89a85760447b29610854 (diff)
QmlJS: Fix line number for string literals
When a string value's first line ends with an EOL the line number for the next line got wrong which in turn confused the syntax highlighter. Fixes: QTCREATORBUG-23777 Change-Id: I37eed839a2e63cf470b9bc2ac0596ab8bc8d373c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/qmljs/parser/qmljslexer.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libs/qmljs/parser/qmljslexer.cpp b/src/libs/qmljs/parser/qmljslexer.cpp
index a85280fbc2..0ae581724d 100644
--- a/src/libs/qmljs/parser/qmljslexer.cpp
+++ b/src/libs/qmljs/parser/qmljslexer.cpp
@@ -881,8 +881,10 @@ int Lexer::scanString(ScanStringMode mode)
if (_engine) {
while (_codePtr <= _endPtr) {
if (isLineTerminator()) {
- if ((quote == QLatin1Char('`') || qmlMode()))
+ if ((quote == QLatin1Char('`') || qmlMode())) {
+ --_currentLineNumber;
break;
+ }
_errorCode = IllegalCharacter;
_errorMessage = QCoreApplication::translate("QmlParser", "Stray newline in string literal");
return T_ERROR;