Hypertopic / LaSuli

Social annotation for qualitative analysis
https://hypertopic.org/lasuli
GNU General Public License v3.0
12 stars 4 forks source link

Highlights containing a sequence of spaces are shorter than intended #30

Closed benel closed 11 years ago

benel commented 11 years ago

Reproduction scenario 1

Open the following TXT file (with two spaces between mode and antique):

Le soleil résonne sur le mode  antique dans le chœur harmonieux des sphères

Highlight mode antique.

What is highlighted is really mode antiqu (without the trailing e).

benel commented 11 years ago

Reproduction scenario 2

Open the following TXT file (with 3 spaces at the beginning of each line):

   Le soleil résonne sur le mode antique dans le chœur harmonieux des sphères,
   et sa course ordonnée s’accomplit avec la rapidité de la foudre.

Highlight sphères, et sa course.

What is highlighted is really sphères, et sa cou.

benel commented 11 years ago

The cause of this bug is that the fragment end position is computed from the text extracted from HTML:

endPos = startPos + strContent.length;

See : lasuli.ui.js#1450 and lasuli.highlighter.js#126.