Menu

Updates to CSS syntax highlighting

2008-10-01
2012-11-13
  • Jason Oster

    Jason Oster - 2008-10-01

    Hello everyone,

    I have been making some changes to Scintilla's CSS lexer, which may affect Notepad++ users in the future. I've been looking for comments and suggestions to these changes, but not having much luck. So if you use the CSS syntax highlighting feature in Notepad++ (or another editor which uses the Scintilla text editor control), you might want to join me in discussing the changes. A good place to start is the Scintilla mailing list: http://groups.google.com/group/scintilla-interest/t/8644bfeb32f6d629

    Most of the changes evolve around CSS3, and I'm looking for opinions and ideas on what can be done to improve the CSS lexer. Please respond on the Scintilla mailing list with any comments, questions, etc. Because I am really looking forward to getting some real user feedback before submitting the final patch to Scintilla. Thanks!

    Jay

     
    • Airdrik

      Airdrik - 2008-10-08

      Perhaps Some R&D should be dedicated to a refactor of the lexers to allow for stacked lexers, since this tends to be a sore spot in a lot of the code editors I've used (We have a lot of .asp files using javascript as the server-side scripting language, and the server-side javascript never gets highlighted correctly).  This would allow for cleaner highlighting of server-side javascript/vbscript/whatever-other-server-side-scripting-language-you-use highlighting, inline css highlighting (which is found frequently embedded in the html), and possibly sql highlighting inside of sql="<sql code>" statements in whatever language. 

       
      • Jason Oster

        Jason Oster - 2008-10-08

        airdrik: This would probably be a good discussion to start on the scintilla-interest mailing list. The ML is not very active currently, but I would be interested in providing some additional thoughts on that subject, and I believe other people might find it informative as well.

        Jay

         
    • Don HO

      Don HO - 2008-10-01

      Indeed, I have a crash problem due to lexer CSS (Scintilla 1.75).
      When I set Chinese Big5 encoding to Scintilla, then type any Chinese character make Scintilla and Notepad++ crash.

      I wonder if I'll move back to old CSS lexer in the future Notepad++ release.

      Do you have any idea about that?

      Don

       
    • Jason Oster

      Jason Oster - 2008-10-02

      Hi Don,

      It looks like this was fixed in the current [CVS] version of Scintilla: http://scintilla.cvs.sourceforge.net/viewvc/scintilla/scintilla/src/LexCSS.cxx?r1=1.11&r2=1.12 You can apply this patch to your local copy for Notepad++, or wait for Scintilla v1.77.

      Hope that helps you,
      Jay

       
      • Don HO

        Don HO - 2008-10-02

        No, the patch doesn't fix crash due to keyin Chinese character.

        Don

         
        • Don HO

          Don HO - 2008-10-02

          FYI, just took the latest revision here :
          http://scintilla.cvs.sourceforge.net/viewvc/scintilla/scintilla/src/LexCSS.cxx?revision=1.13&view=markup

          Build new Scintilla binary - still crash.

          Don

           
          • Jason Oster

            Jason Oster - 2008-10-08

            Don, please try this patch, it may help solve the problem you are seeing: https://sourceforge.net/tracker/index.php?func=detail&aid=2153429&group_id=2439&atid=102439

            Jay

             
          • Jason Oster

            Jason Oster - 2008-10-04

            Did you report the bug to the Scintilla bug tracker? Also, if you can paste (here maybe) the Chinese characters that crash, I can look into debugging it.

            Thanks

             
    • Airdrik

      Airdrik - 2008-10-02

      A nice addition, which may be just outside the scope of the CSS lexer, would be to enable CSS highlighting in html files' style tags/attributes (similar to java/vb script highlighting in html/asp pages). 

       
      • Jason Oster

        Jason Oster - 2008-10-07

        Because of the current lexer architectural design, lexers are not capable of being stacked. Any CSS support in HTML files would be the job of the HTML lexer. Unfortunately, lexers are [still] not 8-bit safe, and the number of styles used by the HTML lexer are nearly maxing out the 7-bits of style information that are safe.

        Not only that, but it would also add even more complexity to probably the most complex lexer available. The HTML lexer should probably be moved to the newer Styler class model before any extra work is done on it that adds to its complexity.

        But I agree it would be a nice feature to include.

         
      • Daniel Spawn

        Daniel Spawn - 2008-10-03

        Actually, I just have javascript highlighting in HTML files (and HTML in ASP too)
        But I couldnt make it recon the vbscript, how did u do it?