Re: [scintilla] [ scintilla-Bugs-1476445 ] Highlighting problem
On Tue, 2006-04-25 at 15:33 -0700, SourceForge.net wrote:
> Bugs item #1476445, was opened at 2006-04-25 18:33
> https://sourceforge.net/tracker/?func=detail&atid=102439&aid=1476445&group_id=2439
> Category: Scintilla
> Submitted By: legege (legege)
> Summary: Highlighting problem <!-- <script src=<?...
> 
> Initial Comment:
> Hello,
> 
> There is a highliting problem with this code (Hypertext)
> <!--
> <script language="javascript" src="<?php $e; ?>"
> type="text/javascript"></script>
> -->
> 
> If we change the "src", it's ok.

Yes, it looks like at LexHTML.cxx:661 'segIsScriptingIndicator()' is
taking the whole line before the <script opening tag.

Then the check 'if (strstr(s, "src"))' at the start of the function is
returning eScriptNone instead of eScriptPHP, so the next call to
StateForScript at line 672 returns the default case SCE_HJ_START,
fooling the lexer to think javascript follows.

It only happens onto a comment as the parameter "start" is computed as
'styler.GetStartSegment() + 2' that returns the whole line only when the
state is comment.

The call at line 661 reads this way:
scriptLanguage = 
    segIsScriptingIndicator(styler,
                            styler.GetStartSegment() + 2,
                            i + 10,
                            eScriptPHP);

Now, I don't know if this failure is about not updating the start
segment on the comment, or it's just this call is bogus and should take
the current position instead of the start segment.

I've been also wrestling the - damm slow - sorceforge CVS web interface
looking for this function's cahnges, to check if a comment clarifies it,
but found nothing.

It looked to me as this call was trying to "get the start segment at the
<?php tag plus two more characters to avoid  the open tag <?".

If it's it, just the current position plus two chars will do the job:

scriptLanguage = 
    segIsScriptingIndicator(styler, 
                            i + 2,
                            i + 10,
                            eScriptPHP);

Or .. may be the start segment should be updated to pass those comment
characters ?

In the case of comments - in this lexer - the start segment is only
updated on the close tag '-->'.

I'm not sure about what could be the correct fix.

The bug will be triggered by the use of any of the strings on
segIsScriptingIndicator, onto a comment, followed by a php tag. As
example:

<!-- looks like vbs <?php $e ?>"> 
<!-- load javascript <?php $e ?>">

-- 
Iago Rubio
-- 
Iago Rubio

_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to