Fix conversion of byte to grapheme offsets/lengths

Missed one case in ve.ce.Docuemnt#getNodeAndOffset.

Bug: 49246

Change-Id: Iff1dfb90130685bb710821f8386cfa2f296f2f95
This commit is contained in:
Ed Sanders 2013-06-07 14:26:46 +01:00
parent 8039b1c2f8
commit 348d2355c6
2 changed files with 3 additions and 2 deletions

View file

@ -1,5 +1,5 @@
<p>12𨋢456789𨋢bc</p>
<p>「𨋢」字響<tt>香港</tt>衍生出好多新詞,好似:𨋢</p>
<p>「𨋢」字響<tt>香港</tt>衍生出好多新詞,好似:𨋢<tt>香港</tt> abc</p>
<p>abc</p>
<p>one c̀ombining accent</p>
<p>two ç̀ombining accents</p>

View file

@ -146,7 +146,8 @@ ve.ce.Document.prototype.getNodeAndOffset = function ( offset ) {
}
item = current[0][current[1]];
if ( item.nodeType === Node.TEXT_NODE ) {
length = item.textContent.length;
// offset, startOffset and length are all data model lengths (not byte lengths)
length = ve.getClusterOffset( item.textContent, item.textContent.length );
if ( offset >= startOffset && offset <= startOffset + length ) {
return {
node: item,