Removed some redundant parts from findWrapLine

This commit is contained in:
James Johnson 2018-01-11 12:37:20 -05:00
parent 83a2f2ef5c
commit bc40bbf561
1 changed files with 6 additions and 8 deletions

View File

@ -531,20 +531,18 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction
int findWrapLine(TextPosition textPos) int findWrapLine(TextPosition textPos)
{ {
int curLine = 0; int curWrapLine = 0;
int curPosition = textPos.pos; int curPosition = textPos.pos;
int i = 0;
while (true) while (true)
{ {
if (i == getSpan(textPos.line).wrapPoints.length - 1) if (curWrapLine == getSpan(textPos.line).wrapPoints.length - 1)
return curLine; return curWrapLine;
curPosition -= getSpan(textPos.line).wrapPoints[i].wrapPos; curPosition -= getSpan(textPos.line).wrapPoints[curWrapLine].wrapPos;
if (curPosition < 0) if (curPosition < 0)
{ {
return curLine; return curWrapLine;
} }
curLine++; curWrapLine++;
i++;
} }
} }