Even more trying to reason about the algorithm.
This commit is contained in:
parent
4f1ba0df84
commit
28ca02673b
|
@ -348,20 +348,13 @@ void attrlistInsertCharactersExtendingAttributes(struct attrlist *alist, size_t
|
||||||
if (start == 0)
|
if (start == 0)
|
||||||
from = 0;
|
from = 0;
|
||||||
/////////
|
/////////
|
||||||
if start == 0
|
|
||||||
for every attribute
|
for every attribute
|
||||||
if it doesn't start at 0
|
if TODO
|
||||||
move start up by count
|
adjust start by count
|
||||||
move end up by count
|
adjust end by count
|
||||||
return
|
else if TODO
|
||||||
for every attribute
|
adjust end by count
|
||||||
if the attribute ends at or after the insertion point
|
/////////
|
||||||
advance its end by count
|
|
||||||
continue
|
|
||||||
if the attribute starts at or after the insertion point
|
|
||||||
advance its start and end by count
|
|
||||||
continue
|
|
||||||
/////
|
|
||||||
abcdefghi (012345678 9)
|
abcdefghi (012345678 9)
|
||||||
red start 0 end 3
|
red start 0 end 3
|
||||||
bold start 2 end 6
|
bold start 2 end 6
|
||||||
|
@ -395,6 +388,16 @@ before 9 (keep all three)
|
||||||
red -> start 0 (no change) end 3 (no change)
|
red -> start 0 (no change) end 3 (no change)
|
||||||
bold -> start 2 (no change) end 6 (no change)
|
bold -> start 2 (no change) end 6 (no change)
|
||||||
underline -> start 5 (no change) end 8 (no change)
|
underline -> start 5 (no change) end 8 (no change)
|
||||||
|
result:
|
||||||
|
0 1 2 3 4 5 6 7 8 9
|
||||||
|
red E E E e n n n n n n
|
||||||
|
bold s s S E E E e n n n
|
||||||
|
underline s s s s s S E E e n
|
||||||
|
N = none
|
||||||
|
E = end only
|
||||||
|
S = start and end
|
||||||
|
uppercase = in original range, lowercase = not
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void attrlistRemoveAttribute(struct attrlist *alist, uiAttribute type, size_t start, size_t end)
|
void attrlistRemoveAttribute(struct attrlist *alist, uiAttribute type, size_t start, size_t end)
|
||||||
|
|
Loading…
Reference in New Issue