Cleanup in content_mapblock (#5746)
[oweals/minetest.git] / src / intlGUIEditBox.cpp
index 33bf8a13cfb22e155cac32ce0e0cea53ac9b4f1c..9884af003efd09c87d33ae7444b2fd239ffc2c58 100644 (file)
@@ -271,7 +271,7 @@ bool intlGUIEditBox::OnEvent(const SEvent& event)
                        break;
                case EET_KEY_INPUT_EVENT:
         {
-#if (defined(linux) || defined(__linux) || defined(__FreeBSD__))
+#if (defined(__linux__) || defined(__FreeBSD__))
             // ################################################################
                        // ValkaTR:
             // This part is the difference from the original intlGUIEditBox
@@ -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 + 1)
+               x = CurrentTextRect.LowerRightCorner.X + 1;
 
        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;
 }