[Geany-Devel] Move question from Scintilla list

Jiří Techet techet at xxxxx
Fri Jun 26 11:21:45 UTC 2015


On Fri, Jun 26, 2015 at 11:40 AM, Lex Trotman <elextr at gmail.com> wrote:

> Jiri,
>
> I have pasted the questions and Neils answers below with my comments
> and I'm sure others may have more info.
>
> > Jiří Techet:
> >
> > > I have a question regarding the use of SCI_COLOURISE. It is used in
> Geany at several places and it's call is rather expensive so I'd like to
> avoid it as much as possible.
> >
> >     Most of the time all of the buffer you see should be styled
> automatically by Scintilla in a lazy way. That means that Scintilla does
> not normally style much beyond the portion currently visible. There are
> times when you want the whole file to be styled, such as when exporting the
> file as HTML/PDF/RTF. There may also be workarounds to problems in
> Scintilla and its possible some of these workarounds are no longer needed.
> >
> > > 1. After SCI_SETKEYWORDS - this basically happens after every
> keystroke because we colorize typenames using keywords (we've already
> talked about that if you remember).
> >
> >    Possibly Geany wants the document styled up to some point immediately
> so it can use the style information.
>
> As best I can tell this one is extraneous, it would just change names
> from/to type colourising which AFAICT doesn't affect anything else,
> they are both code type styles etc.  So long as the visible area is
> colorised by Scintilla so when a newly typed name matches a keyword it
> will highlight, then it doesn't look like doing it manually is useful.
>

This is the main use of SCI_SETTEXT I was interested in and yes, I also
think this one can be (safely) removed. It isn't called already by
languages not highlighting typenames like e.g. python so there's very
little risk that anything breaks by removing it because it would have
already been broken for all the scripting languages.


>
> >
> > > 2. Immediately after SCI_SETTEXT when loading (or reloading) file.
> >
> >    This may or may not be needed depending on Geany’s features. One
> reason for doing this is if you want to perform a global fold operation
> since folding depends on fold information and thus on styling.
>
> This one is more likely useful, since lots of features need to know
> the styles of things outside the visible area, for example to avoid
> considering characters in comments and strings when counting braces
> for scopes.
>

Yes, this one should probably stay. But I would delay it's call until the
document is actually shown to improve Geany start time with many tabs open.

For completeness, there was also another case in my original email:

3. When reloading configuration files which can change various aspects of
Scintilla (keywords, style coloring, etc.)

but since this one is called only when changing config files, it's not
worth worrying about.

(plus one more use in brace_match() but it's a single-character one and
doesn't matter either)

Cheers,

Jiri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20150626/188538f3/attachment.html>


More information about the Devel mailing list