Skip to content

Commit a4a377e

Browse files
HybridDognerzhul
authored andcommittedMay 19, 2017
Fix textarea bug: clicking right of the end of a line caused the cursor to be in one of the next lines (#3474)
1 parent 75c393c commit a4a377e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎src/intlGUIEditBox.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -1120,14 +1120,16 @@ s32 intlGUIEditBox::getCursorPos(s32 x, s32 y)
11201120

11211121
if (x < CurrentTextRect.UpperLeftCorner.X)
11221122
x = CurrentTextRect.UpperLeftCorner.X;
1123+
else if (x > CurrentTextRect.LowerRightCorner.X)
1124+
x = CurrentTextRect.LowerRightCorner.X;
11231125

11241126
s32 idx = font->getCharacterFromPos(Text.c_str(), x - CurrentTextRect.UpperLeftCorner.X);
11251127

11261128
// click was on or left of the line
11271129
if (idx != -1)
11281130
return idx + startPos;
11291131

1130-
// click was off the right edge of the line, go to end.
1132+
// click was off the right edge of the last line, go to end.
11311133
return txtLine->size() + startPos;
11321134
}
11331135

1 commit comments

Comments
 (1)

Fixer-007 commented on May 19, 2017

@Fixer-007
Contributor

Detected regression... will post an issue.

Please sign in to comment.