When using the OCaml lexer as part of my mini-IDE, I would like to
have it use some "extra" styles that would not appear when used by,
say, SciTE.
More specifically, I want to be able to have specially-formatted OCaml
comments that will have "magic" properties (turn on/off markers and be
non-deletable). The control/behavior from "style_set_changeable"
seems adequate.
More specifically still, since the lexer now uses only 4 bits, I could
just define versions of my comment styles with the 5th bit set to mean
"same style as low bits but with changeable attribute set to false".
So, great - I can define the styles when I initialize Scintilla from
my particular [container] application... but in SciTE, these would not
get defined, and the lexer only has to know to ignore the high bit.
But how do I *set* these "read-only" styles? I would be happy if my
application could just do a SCI_ADDSTYLEDTEXT using these styles and
the text would then stay that way until I reset "normal" styles by
using SCI_ADDSTYLEDTEXT again... but presumably any later request for
styling could have the lexer overwrite the magic styles with normal
styles, right?
Although I would rather keep "funny" changes like this out of the
lexer, I *could* have the lexer itself recognize the special comment
sequences and set the magic styles, but this seems like a Bad
Idea(tm). Now the lexer needs to know if it is being used in my
special application (and should act differently), or is being used
from SciTE or any other app (and should act normally) - and now the
lexer needs to get updated if I want modify this new behavior.
Comments? Suggestions? Would I be better off just watching for
SC_MOD_CHANGESTYLE notifications in my app and re-writing my magic
styles if they change? Is this last reliable AND non-recursive? :)
A nit: shouldn't Document::ConvertLineEnds use InsertChar instead of
InsertString for adding in the *single* line-end chars? InsertString
is relatively expensive because of always doing a heap allocation to
add style info...
A related nit: assuming that alloca is available on the platforms
Scintilla is intended to reach, shouldn't it be used - at least
through, say, a conditionally defined macro for temp char array
allocation?
Robert Roessler
[EMAIL PROTECTED]
http://www.rftp.com
_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest