Skip to content

Commit

Permalink
Fix UTF32 characters breaking sentence parser due directly accessing …
Browse files Browse the repository at this point in the history
…string array indexes (#1452)
  • Loading branch information
Kuuuube authored Oct 3, 2024
1 parent 1f2a2e2 commit 9d549ec
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ext/js/dom/text-source-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class TextSourceGenerator {
source = source.clone();
const startLength = source.setStartOffset(extent, layoutAwareScan);
const endLength = source.setEndOffset(extent * 2 - startLength, true, layoutAwareScan);
const text = source.text();
const text = [...source.text()];
const textLength = text.length;
const textEndAnchor = textLength - endLength;

Expand Down Expand Up @@ -173,7 +173,7 @@ export class TextSourceGenerator {

// Result
return {
text: text.substring(cursorStart, cursorEnd),
text: text.slice(cursorStart, cursorEnd).join(''),
offset: startLength - cursorStart,
};
}
Expand Down

0 comments on commit 9d549ec

Please sign in to comment.