OSDN Git Service

Fix PHP syntax highlighting. (#1055)
authorJun Tajima <56220423+tjmprm77@users.noreply.github.com>
Tue, 23 Nov 2021 22:32:05 +0000 (07:32 +0900)
committerGitHub <noreply@github.com>
Tue, 23 Nov 2021 22:32:05 +0000 (07:32 +0900)
- Fix an issue where text is not highlighted correctly if there is no space or symbol between a single line comment or variable and the end tag "?>".

Externals/crystaledit/editlib/parsers/html.cpp
Externals/crystaledit/editlib/parsers/php.cpp

index 77214a8..94d9097 100644 (file)
@@ -151,7 +151,10 @@ out:
                   AdjustCharPosInTextBlocks(pBuf, nActualItems, nActualItems + nActualItemsEmbedded - 1, I);
                   nActualItems += nActualItemsEmbedded;
                   if (!pszEnd)
-                    dwCookie |= COOKIE_EXT_USER1;
+                    {
+                      dwCookie |= COOKIE_EXT_USER1;
+                      nextI += 1;
+                    }
                   else if ((nEmbeddedLanguage == SRC_PHP) && (dwCookie & (COOKIE_EXT_COMMENT | COOKIE_STRING | COOKIE_CHAR)))
                     {
                       // A closing tag in a comment or string.
@@ -169,6 +172,8 @@ out:
                     }
                   else
                     {
+                      if (I > 0)
+                        nextI += 1;
                       dwCookie = 0;
                       bRedefineBlock = true;
                     }
index 6782c74..fe715a1 100644 (file)
@@ -476,6 +476,10 @@ out:
 
   if (nIdentBegin >= 0)
     {
+      if (dwCookie & COOKIE_USER2)
+        {
+          DEFINE_BLOCK(nIdentBegin, COLORINDEX_USER1);
+        }
       if (IsPhpKeyword (pszChars + nIdentBegin, I - nIdentBegin))
         {
           DEFINE_BLOCK (nIdentBegin, COLORINDEX_KEYWORD);