Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit cd9e1d2

Browse files
authored
Merge pull request #286 from UnityTech/fix_editing_bug
Fix bug in paragraph.
2 parents 39e7ca8 + 452b063 commit cd9e1d2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Runtime/ui/txt/paragraph.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,8 @@ public void setParagraphStyle(ParagraphStyle style) {
661661

662662
public List<TextBox> getRectsForRange(int start, int end) {
663663
var lineBoxes = new SplayTree<int, List<TextBox>>();
664-
foreach (var run in this._codeUnitRuns) {
664+
for (int runIndex = 0; runIndex < this._codeUnitRunsCount; runIndex++) {
665+
var run = this._codeUnitRuns[runIndex];
665666
if (run.codeUnits.start >= end) {
666667
break;
667668
}
@@ -784,7 +785,8 @@ internal PositionWithAffinity getGlyphPositionAtCoordinate(float dx, float dy) {
784785
}
785786

786787
TextDirection direction = TextDirection.ltr;
787-
foreach (var run in this._codeUnitRuns) {
788+
for (int runIndex = 0; runIndex < this._codeUnitRunsCount; runIndex++) {
789+
var run = this._codeUnitRuns[runIndex];
788790
if (gp.codeUnit >= run.codeUnits.start && gp.codeUnit + 1 <= run.codeUnits.end) {
789791
direction = run.direction;
790792
break;

0 commit comments

Comments
 (0)