I'm working (or maybe daydreaming) toward a new back end design to support
folding. The description is pretty convoluted at this point, so rather than
present it, I want to ask some questions--after I get those clarified I can
(I hope) edit my description to be easier to understand (or impossible ;-).
So:
I need to have a way to mark text in the textBuf as being folded. (This is in
addition to the need to keep track of areas of text which can be folded--that
part I intend to do with rangesets or a variation of rangesets (although, in
this new approach, rangesets won't need to deal with zero length ranges).)
One way to mark currently folded text in the textBuf could be using the 32-bit
Style mask which, based on this line of code in textDisp.c:
textBuffer *styleBuf = textD->styleBuffer;
..., is like a parallel textBuf(fer) storing the style information for each
character of text in the textBuf?
(I guess that is one (or several) of my major questions--do I have some basic
misunderstandings about this styleBuf? As usual, I've skimmed or perused
some code, but I can't say (I'm sure you can tell) that I have much of an
understanding of that code.)
Assuming that is the case, I would consider using an additional bit (or 2,
more on that later) to add a "hidden for folding" flag to the 32-Bit Style
mask:
> /* If you use both 32-Bit Style mask layout:
> Bits
> +----------------+----------------+----------------+----------------+
> |1F1E1D1C1B1A1918|1716151413121110| F E D C B A 9 8| 7 6 5 4 3 2 1 0|
> |3130292827262524|2322212019181716|151413121110 9 8| 7 6 5 4 3 2 1 0|
> +----------------+----------------+----------------+----------------+
> | r r| r r r r b b b b| b b b b H 1 2 F| s s s s s s s s|
> +----------------+----------------+----------------+----------------+
The text display widget would then be modified so that if text was marked as
"hidden for folding", it would not be displayed. (I mean, not displayed at
all, not take up space, ... (trying to be more specific, it would not be
rendered white on white or whatever--it would not be rendered at all).)
Another thing that the styleBuf would then be used for is, generally speaking,
navigation. For example, when we needed to move the cursor, for example,
down one line, the navigation routines would be modified so that they checked
the styleBuf and ignored all characters that were flagged "hidden for
folding".
Hmm, I have another (to me) fairly large topic to discuss related to this, but
I think it will make sense to get feedback on this before getting into that
related topic. (It may become a moot point.)
Randy Kramer
--
NEdit Develop mailing list - [email protected]
http://www.nedit.org/mailman/listinfo/develop