[Standards] Off-by-one error in XEP-372 "References"

Florian Schmaus flo at geekplace.eu
Fri Dec 4 13:56:57 UTC 2020


On 12/4/20 1:31 PM, JC Brand wrote:
> Hey folks
> 
> In XEP-0372 in section 3.1, there is the following text:
> 
>> An end attribute is similarly  used for the index of the last 
>> character of the reference
> 
> However, in the example in 3.2, the "end" attribute is set to 78, which 
> is the index of the space after the nickname "Juliet".

Yep, that should be 77 and the XEP should explicitly state that the end 
index is exclusive (while the start index is inclusive). Together with 
the numbering being zero-indexed, this would be similar to the behavior 
of APIs like Android's android.text.Spannable.

While at it, the textual <body/> content of the examples in the XEP 
should be way shorter. And it should be explicitly explained which part 
of the text is referenced, e.g.:

Text is spantastic!
         ^^^^
begin=8
   end=12

- Florian




-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://mail.jabber.org/pipermail/standards/attachments/20201204/3e7a2a2d/attachment.sig>


More information about the Standards mailing list