#define new DEBUG_NEW
#endif
+static void AdjustCharPosInTextBlocks(CrystalLineParser::TEXTBLOCK* pBuf, int startBlock, int endBlock, int offset)
+{
+ for (int i = startBlock; i <= endBlock; ++i)
+ pBuf[i].m_nCharPos += offset;
+}
+
unsigned
CrystalLineParser::ParseLineHtmlEx (unsigned dwCookie, const TCHAR *pszChars, int nLength, TEXTBLOCK * pBuf, int &nActualItems, int nEmbeddedLanguage)
{
{
const TCHAR *pszEnd = _tcsstr(pszChars + I, _T("</script>"));
int nextI = pszEnd ? static_cast<int>(pszEnd - pszChars) : nLength;
- dwCookie = ParseLineJava(dwCookie & ~COOKIE_BLOCK_SCRIPT, pszChars + I, nextI - I, pBuf, nActualItems);
+ int nActualItemsEmbedded = 0;
+ dwCookie = ParseLineJavaScript(dwCookie & ~COOKIE_BLOCK_SCRIPT, pszChars + I, nextI - I, pBuf + nActualItems, nActualItemsEmbedded);
+ AdjustCharPosInTextBlocks(pBuf, nActualItems, nActualItems + nActualItemsEmbedded - 1, I);
+ nActualItems += nActualItemsEmbedded;
if (!pszEnd)
dwCookie |= COOKIE_BLOCK_SCRIPT;
else
{
const TCHAR *pszEnd = _tcsstr(pszChars + I, _T("</style>"));
int nextI = pszEnd ? static_cast<int>(pszEnd - pszChars) : nLength;
- dwCookie = ParseLineCss(dwCookie & ~COOKIE_BLOCK_STYLE, pszChars + I, nextI - I, pBuf, nActualItems);
+ int nActualItemsEmbedded = 0;
+ dwCookie = ParseLineCss(dwCookie & ~COOKIE_BLOCK_STYLE, pszChars + I, nextI - I, pBuf + nActualItems, nActualItemsEmbedded);
+ AdjustCharPosInTextBlocks(pBuf, nActualItems, nActualItems + nActualItemsEmbedded - 1, I);
+ nActualItems += nActualItemsEmbedded;
if (!pszEnd)
dwCookie |= COOKIE_BLOCK_STYLE;
else
{
case SRC_BASIC: pParseLineFunc = ParseLineBasic; break;
case SRC_PHP: pParseLineFunc = ParseLinePhpLanguage; break;
- default: pParseLineFunc = ParseLineJava; break;
+ default: pParseLineFunc = ParseLineJavaScript; break;
}
- dwCookie = pParseLineFunc(dwCookie & ~COOKIE_EXT_USER1, pszChars + I, nextI - I, pBuf, nActualItems);
+ int nActualItemsEmbedded = 0;
+ dwCookie = pParseLineFunc(dwCookie & ~COOKIE_EXT_USER1, pszChars + I, nextI - I, pBuf + nActualItems, nActualItemsEmbedded);
+ AdjustCharPosInTextBlocks(pBuf, nActualItems, nActualItems + nActualItemsEmbedded - 1, I);
+ nActualItems += nActualItemsEmbedded;
if (!pszEnd)
dwCookie |= COOKIE_EXT_USER1;
else
if (IsHtmlKeyword (pszChars + nIdentBegin, I - nIdentBegin) && (pszChars[nIdentBegin - 1] == _T ('<') || pszChars[nIdentBegin - 1] == _T ('/')))
{
DEFINE_BLOCK (nIdentBegin, COLORINDEX_KEYWORD);
- if (nIdentBegin > 0 && _tcsnicmp(pszChars + nIdentBegin - 1, _T("<script"), sizeof(_T("<script") - 1)) == 0)
+ if (nIdentBegin > 0 && _tcsnicmp(pszChars + nIdentBegin - 1, _T("<script"), sizeof("<script") - 1) == 0)
dwCookie |= COOKIE_BLOCK_SCRIPT;
- else if (nIdentBegin > 0 && _tcsnicmp(pszChars + nIdentBegin - 1, _T("<style"), sizeof(_T("<style") - 1)) == 0)
+ else if (nIdentBegin > 0 && _tcsnicmp(pszChars + nIdentBegin - 1, _T("<style"), sizeof("<style") - 1) == 0)
dwCookie |= COOKIE_BLOCK_STYLE;
}
else if (IsHtmlUser1Keyword (pszChars + nIdentBegin, I - nIdentBegin))