diminish7 / rave

A Google Wave robot client framework for Ruby
http://github.com/diminish7/rave
MIT License
62 stars 8 forks source link

Inconsistency with text indices #40

Closed bil-bas closed 14 years ago

bil-bas commented 14 years ago

I have assumed regular Ruby text indexes (so "frog" is 0..4; indexes refer to letters), whereas Wave actually seems to use non-standard indexes (so "frog" is 0..5; indexes refer to gaps between letters). This means that if you use the wave indexes, then the server will operate correctly on them, but the local content will become corrupted, but if you use Ruby indexes, then the local content will be correct, but the server content will be corrupted.

Ideally, the API should be able to use Ruby indexes and convert them into Wave indexes on the actual wire protocol. The only thing that isn't simple to convert transparently is an annotation or element that exists only between two letters (in fact, elements can only exist between characters).

Anyway, the key is consistency and a clear explanation of how it works in documentation, rather than anything else.

diminish7 commented 14 years ago

Ah, makes sense - that's how ranges are in Python... I changed how ranges serialize to rave json, but left the in-code ranges the same, so it should be fixed now.