Patch from Iago Rubio to fix problem with end of script detection. Extracted into a function some common code for copying from document into a string for checking and changed to use safer lower casing.
Patch from Iago Rubio to fix problem with end of script detection.
Extracted into a function some common code for copying from document into
a string for checking and changed to use safer lower casing.

rhaberkorn/scintilla-mirror,rhaberkorn/scintilla-mirror,rhaberkorn/scintilla-mirror,rhaberkorn/scintilla-mirror,rhaberkorn/scintilla-mirror,rhaberkorn/scintilla-mirror,rhaberkorn/scintilla-mirror,rhaberkorn/scintilla-mirror