From bc40bbf561d7cb5e95d90b468ad368a6d3626b99 Mon Sep 17 00:00:00 2001 From: James Johnson Date: Thu, 11 Jan 2018 12:37:20 -0500 Subject: [PATCH] Removed some redundant parts from findWrapLine --- src/dlangui/widgets/editors.d | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/dlangui/widgets/editors.d b/src/dlangui/widgets/editors.d index d805b2e6..68358af2 100644 --- a/src/dlangui/widgets/editors.d +++ b/src/dlangui/widgets/editors.d @@ -531,20 +531,18 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction int findWrapLine(TextPosition textPos) { - int curLine = 0; + int curWrapLine = 0; int curPosition = textPos.pos; - int i = 0; while (true) { - if (i == getSpan(textPos.line).wrapPoints.length - 1) - return curLine; - curPosition -= getSpan(textPos.line).wrapPoints[i].wrapPos; + if (curWrapLine == getSpan(textPos.line).wrapPoints.length - 1) + return curWrapLine; + curPosition -= getSpan(textPos.line).wrapPoints[curWrapLine].wrapPos; if (curPosition < 0) { - return curLine; + return curWrapLine; } - curLine++; - i++; + curWrapLine++; } }