Code: Select all
//! Direct access operator
T& operator [](const u32 index)
{
_IRR_DEBUG_BREAK_IF(index>=used) // bad index
return array[index];
}
Code: Select all
// draw cursor
if (WordWrap || MultiLine)
{
cursorLine = getLineFromPos(CursorPos);
txtLine = &BrokenText[cursorLine];
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); <=== this one
If I paste 2 lines of text into an empty edit box (so only 1 line break), there's no error.
If I paste 3 lines of text into an empty edit box, it stops.
If I type "abc" into the box, then put my cursor to the start of the line, then paste 3 lines of text, it pastes correctly and doesn't crash BUT my cursor ends up 2 places to the right of where it should be (cursor is now on the "c")
Same goes for if I type "abcde" into the box, then put my cursor to the start of the line, then paste text containing 4 new lines, my cursor ends up 5 places to the right of where it should be (cursor is now on the "e")
But if there are too little chars for the cursor to be incorrect by (eg. "abcde" and pasting 10 lines of text) then the program will stop.
Note that I'm on windows so a newline for me is \r\n.
Now if I use the copyToClipboard function in Irrlicht to copy a string of 10 lines, using \n instead of \r\n for newlines, then paste it into an empty edit box, then no error occurs and it works properly.
So the problem is most likely related to the handling of \r and where its trying to draw the cursor position but I could be wrong.