diff options
author | you <ovvv@web.de> | 2017-05-19 07:57:21 +0200 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-05-19 07:57:21 +0200 |
commit | a4a377ecad6f1732cc54e7ac329fdef9949f9bf7 (patch) | |
tree | 05b628db3b92860d2b627421ce51e9f53452d640 | |
parent | 75c393c915ce7fa0e6529999f77c86f3a5897106 (diff) | |
download | minetest-a4a377ecad6f1732cc54e7ac329fdef9949f9bf7.tar.gz minetest-a4a377ecad6f1732cc54e7ac329fdef9949f9bf7.tar.bz2 minetest-a4a377ecad6f1732cc54e7ac329fdef9949f9bf7.zip |
Fix textarea bug: clicking right of the end of a line caused the cursor to be in one of the next lines (#3474)
-rw-r--r-- | src/intlGUIEditBox.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/intlGUIEditBox.cpp b/src/intlGUIEditBox.cpp index 29f828076..4cc2d746f 100644 --- a/src/intlGUIEditBox.cpp +++ b/src/intlGUIEditBox.cpp @@ -1120,6 +1120,8 @@ s32 intlGUIEditBox::getCursorPos(s32 x, s32 y) if (x < CurrentTextRect.UpperLeftCorner.X) x = CurrentTextRect.UpperLeftCorner.X; + else if (x > CurrentTextRect.LowerRightCorner.X) + x = CurrentTextRect.LowerRightCorner.X; s32 idx = font->getCharacterFromPos(Text.c_str(), x - CurrentTextRect.UpperLeftCorner.X); @@ -1127,7 +1129,7 @@ s32 intlGUIEditBox::getCursorPos(s32 x, s32 y) if (idx != -1) return idx + startPos; - // click was off the right edge of the line, go to end. + // click was off the right edge of the last line, go to end. return txtLine->size() + startPos; } |