Hello, this error has been bothering me for a while, so I started to investigate it and posted my solution already for NotePad++ In Summary: The only thing necessary to avoid this error is that the fold level should not be incremented on an "elseif"-token. Please see my changed in the attached file based on https://sourceforge.net/projects/scintilla/files/lexilla/5.1.5/lexilla515.tgz/download With regards