Quoting Randy Kramer <[EMAIL PROTECTED]>:

> As part of my ongoing campaign to avoid really understanding the nedit
> code, I
> ask the following questions.  Obviously, I could test these items and find
> out for myself, but if somebody can answer them, it will make it that much
> easier for me.
>
> 1. Does a range of zero length "disappear"?  (I'm hoping not.)

It does disappear. A rangeset is really a set of character positions.
The ranges within are conceptually just fully filled subsets between
two positions, the ends of each range. A zero length range cannot
contain any positions.

> 2. Can a given piece of text be part of more than one range as long as each
> of those ranges is in a different rangeset?

Yes it can. Different rangesets may include character positions in common.

> My guess as to the answer to the 2nd question would have been yes, but then
> I found this data structure for styles in textDisp.c:
>
> /* 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|
> +----------------+----------------+----------------+----------------+
>    where: s - style lookup value (8 bits)
>         F - fill (1 bit)
>         2 - secondary selection  (1 bit)
>         1 - primary selection (1 bit)
>         H - highlight (1 bit)
>         b - backlighting index (8 bits)
>         r - rangeset index (6 bits)
>    This leaves 6 "unused" bits */
>
> Which, without understanding at all its use in nedit, could almost lead me
> to guess that a given piece of text can be part of only one rangeset. (I'm
> hoping I'm wrong.)

You are. This is the layout of the style word which tells the text widget
how to draw a string where all graphic properties are the same. It is built
in part by finding which colored rangeset is topmost at the position of the
start of the string.

(I first drew this picture when I wrote the backlight/rangeset code. At the
time, I only allowed 26 RSs (5 bits used), identified by letters.)

Tony

-- 
NEdit Develop mailing list - [email protected]
http://www.nedit.org/mailman/listinfo/develop

Reply via email to