From cc177180c87a5104ce43c3c7165b8afea1eb02a4 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sat, 19 Jul 2008 10:54:30 +0000 Subject: Bug #2016218 from Jason Oster fixes problems caused by not backtracking far enough when start of lexing is within a PHP string. --- src/LexHTML.cxx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/LexHTML.cxx b/src/LexHTML.cxx index f63923d07..c0a47d9ed 100644 --- a/src/LexHTML.cxx +++ b/src/LexHTML.cxx @@ -542,11 +542,15 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty } state = SCE_H_DEFAULT; } - // String can be heredoc, must find a delimiter first - while (startPos > 0 && isPHPStringState(state)) { - startPos--; - length++; - state = styler.StyleAt(startPos); + // String can be heredoc, must find a delimiter first. Reread from beginning of line containing the string, to get the correct lineState + if (isPHPStringState(state)) { + while (startPos > 0 && (isPHPStringState(state) || !isLineEnd(styler[startPos - 1]))) { + startPos--; + length++; + state = styler.StyleAt(startPos); + } + if (startPos == 0) + state = SCE_H_DEFAULT; } styler.StartAt(startPos, static_cast(STYLE_MAX)); -- cgit v1.2.3