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_inclusiveor span_exclusive_exclusive. in fact, span_inclusive_inclusive same span_mark_point , span_point_mark same span_exclusive_exclusive.

my questions follows

  1. why span_point_mark synonymous span_exclusive_exclusive? , why span_mark_point synonymous span_inclusive_inclusive?

  2. why aren't span_mark_mark , span_point_point synonymous span_inclusive_inclusiveand span_exclusive_exclusive respectively?

  3. 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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -