android - What is the difference between SPAN_POINT_MARK and SPAN_MARK_POINT? -
i have been reading on docs spanned/spannable class project working on. have been puzzled definition , usage of spans contain mark
, point
.
a mark
seems defined in doc "attached" character's location while point
defined being "glued" character. mark
won't move when text changed , point
move character "glued" when text changed.
these definitions seem show mark
synonymous inclusive
, point
synonymous exclusive
.
however, not case neither span_mark_mark
nor span_point_point
synonymous either span_inclusive_inclusive
or span_exclusive_exclusive
. in fact, span_inclusive_inclusive
same span_mark_point
, span_point_mark
same span_exclusive_exclusive
.
my questions follows
why
span_point_mark
synonymousspan_exclusive_exclusive
? , whyspan_mark_point
synonymousspan_inclusive_inclusive
?why aren't
span_mark_mark
,span_point_point
synonymousspan_inclusive_inclusive
andspan_exclusive_exclusive
respectively?what true definitions of
mark
,point
in usage?
the way explain mark vs point representing them square brackets @ whatever offset exist in range of text. direction bracket pointing shows character mark or point "attached" to.
so point, use open bracket - it's attached character following it. , mark, use close bracket - it's attached character preceding it.
let's @ examples of each type:
span_mark_mark
inserting @ offset of 0-length span: marks remain fixed.
before: lorem ]]ipsum dolor sit. after: lorem ]]insertipsum dolor sit.
inserting @ start of non-0-length span: inserted text included in range of span.
before: lorem ]ipsum] dolor sit. after: lorem ]insertipsum] dolor sit.
inserting @ end of non-0-length span: inserted text excluded range of span.
before: lorem ]ipsum] dolor sit. after: lorem ]ipsum]insert dolor sit.
you can see last 2 examples, why span_mark_mark
flag synonymous span_inclusive_exclusive
flag. text inserted @ start of span included in range, while text inserted @ end excluded.
span_point_point
inserting @ offset of 0-length span: points pushed forward.
before: lorem [[ipsum dolor sit. after: lorem insert[[ipsum dolor sit.
inserting @ start of non-0-length span: inserted text excluded range of span.
before: lorem [ipsum[ dolor sit. after: lorem insert[ipsum[ dolor sit.
inserting @ end of non-0-length span: inserted text included in range of span.
before: lorem [ipsum[ dolor sit. after: lorem [ipsuminsert[ dolor sit.
again can see last 2 examples why span_point_point
flag synonymous span_exclusive_inclusive
flag. text inserted @ start of span excluded range, while text inserted @ end included.
span_mark_point
inserting @ start of span: inserted text included in range.
before: lorem ]ipsum[ dolor sit. after: lorem ]insertipsum[ dolor sit.
inserting @ end of span: inserted text still included in range.
before: lorem ]ipsum[ dolor sit. after: lorem ]ipsuminsert[ dolor sit.
and has synonym span_inclusive_inclusive
- inserted text included in range of span.
span_point_mark
inserting @ start of span: inserted text excluded range.
before: lorem [ipsum] dolor sit. after: lorem insert[ipsum] dolor sit.
inserting @ end of span: inserted text still excluded range.
before: lorem [ipsum] dolor sit. after: lorem [ipsum]insert dolor sit.
and has synonym span_exclusive_exclusive
- inserted text excluded range of span.
i think documentation confuses things splitting definitions of of synonyms. example, when describing span_mark_mark
, define usage in terms of 0-length span. when defining span_inclusive_exclusive
(which synonym) define usage in terms of non-0-length spans. think have been lot clearer if stated front synonyms, , had single definition shared both terms.
Comments
Post a Comment