Fix small text box caret issue found by KroArtem

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8305 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-04-12 19:37:40 +00:00
parent 740d3f1309
commit 8c096136e7

View File

@ -924,14 +924,16 @@ void CGUIEditBox::draw()
startPos = BrokenTextPositions[cursorLine];
}
s = txtLine->subString(0,CursorPos-startPos);
charcursorpos = font->getDimension(s.c_str()).Width ; //==+
font->getKerningWidth(L"_", CursorPos-startPos > 0 ? &((*txtLine)[CursorPos-startPos-1]) : 0);
charcursorpos = font->getDimension(s.c_str()).Width ;
// + font->getKerningWidth(L"_", CursorPos-startPos > 0 ? &((*txtLine)[CursorPos-startPos-1]) : 0);
if (focus && (getTime() - BlinkStartTime) % 2 == 0 && !m_rtl)
{
//setTextRect(cursorLine);
//CurrentTextRect.UpperLeftCorner.X += charcursorpos;
setTextRect(0);
core::rect< s32 > caret_rect = CurrentTextRect;
caret_rect.UpperLeftCorner.X += charcursorpos - 1;
caret_rect.LowerRightCorner.X = caret_rect.UpperLeftCorner.X + 2;