Carsten:

> I wanted to extend scintilla to recognize hyperlinks like http:, ftp:,
> mailto: etc. My idea was to have a post lexer which find hyperlinks and
> mark them.

   This feature is in SinkWorld where there can be multiple lexers
each controlling a styling buffer with separate style valid ranges. On
the output side, multi-layer drawing can combine the styling buffers
into a composite image.
http://scintilla.sourceforge.net/url.png URL lexer
http://scintilla.sourceforge.net/urlrec.png Combined with ASP lexer
   I just fixed up the URL recognizer a bit for that picture as the
current download wasn't allowing some characters in URLs. This current
version doesn't change as you hover over the URL.

> I wanted to have hyperlinks in every lexer but I didn't want
> to extend each lexer. 
> ...
> The hotspots should be lexer/language independent. So hyperlinks should
> be an indicator than a style. Then it will be possible to mark
> hyperlinks independently from styles. 

   You should think about issues where other pieces of code want to
work with the indicators and so may need to vary the indicator bit
used. If this is for a private build then it is OK but many
applications use indicators for showing information such as syntax
warnings.

   Hooking this into the normal lexing means that you are dependent on
the existing state for determining the range to style. You can lex the
same range as the main lexer is being asked to lex although lexers may
ignore the range given and lex more or less if they want to. If they
lex more then your lexer may never be called for the extra piece. You
could lex from the beginning of the asked range to the end of the
range that was styled by the main lexer (GetEndStyled()). This is one
of the reasons SinkWorld has separate valid ranges for each styling
buffer, the other being that some stylers may run very slowly such as
a compiler or URL verifier and so be performed in idle time.

> What about a new indicator
> INDIC_HOTSPOT or INDIC_HYPERLINK? The look is same like INDIC_PLAIN. But
> the mouse behaviour is similar to hotspot style. I know there are three
> indicators only. So hyperlinks will be an option.

   If the amount of code isn't too large then it could go in. You
should start with a recent download from CVS or
http://scintilla.sourceforge.net/scite.zip as there have been changes
to indicator drawing recently.

   Neil

_______________________________________________
Scintilla-interest mailing list
Scintilla-interest@lyra.org
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to