(CGUIEditBox.cpp, processKey() function)
Code: Select all
case KEY_KEY_V:
// paste from the clipboard
if (Operator)
{
s32 realmbgn = MarkBegin < MarkEnd ? MarkBegin : MarkEnd;
s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
// add new character
c8* p = Operator->getTextFromClipboard();
if (p)
{
if (MarkBegin == MarkEnd)
{
// insert text
core::stringw s = Text.subString(0, CursorPos);
s.append(p);
s.append( Text.subString(CursorPos, Text.size()-CursorPos) );
// here is the change
if(s.size() <= Max)
{
Text = s;
s = p;
CursorPos += s.size();
}
}
else
{
// replace text
core::stringw s = Text.subString(0, realmbgn);
s.append(p);
s.append( Text.subString(realmend, Text.size()-realmend) );
//and here too
if(s.size() <= Max)
{
Text = s;
s = p;
CursorPos = realmbgn + s.size();
}
}
}
MarkBegin = 0;
MarkEnd = 0;
}
break;