#4645 SQL syntax coloring breaks on tab switch

Jeff Evans

I have found that, for a while now, SQL syntax highlighting breaks when I switch tabs (to another document) and then switch back (to the SQL file). I have included 2 screenshots, you can see in SQL_Incorrect.png that, after the first String2 occurrence, the rest of the file has been colored as the "SQL : STRING2" style after switching tabs.

I have just upgraded to v6.5.2 UNICODE, but this has been happening for at least a few versions prior.

Let me know if you need any further information.


Jeff Evans, Jr.

2 Attachments


  • There are two different problems here.

    1) Syntax coloring can change without any modification having been made to the file. I've been unable to find why it does this, maybe it's a bug in Scintilla.

    2) N++ treats backslashes as escape characters for SQL, so what you consider the "incorrent" coloring is in fact the "correct" coloring from N++'s point of view. But since backslashes are not escape characters in T-SQL (they are in MySQL though), I've submitted a patch with an option so this can be changed by the user: https://sourceforge.net/p/notepad-plus/patches/551/

    Last edit: Andreas Jonsson 2014-01-12
  • Jeff Evans
    Jeff Evans


    Thank you for explaining this. Since I only work with MS SQL, I had completely forgotten about the syntax rules of other SQL implementations in Notepad++. This is completely understandable.

    I think your suggested patch is a good workaround for the problem, and I really appreciate how quickly you responded to my ticket.

    Thanks again,

    Jeff Evans, Jr.

  • Don HO
    Don HO

    • status: open --> accepted
    • Priority: 5 --> 7