FIRE-119 VWR-17751 Satomi Ahn - Script editors reported on wrong line

Thanks Satomi!
meow-7.2.2
Arrehn 2010-12-11 19:51:34 -05:00
parent 7056d9eada
commit a4549db263
1 changed files with 20 additions and 10 deletions

View File

@ -2214,22 +2214,32 @@ bool LLTextBase::scrolledToEnd()
return mScroller->isAtBottom();
}
bool LLTextBase::setCursor(S32 row, S32 column)
bool LLTextBase::setCursor(S32 true_row, S32 column)
{
if (0 <= row && row < (S32)mLineInfoList.size())
if (0 <= true_row && true_row < (S32)mLineInfoList.size())
{
S32 doc_pos = mLineInfoList[row].mDocIndexStart;
column = llclamp(column, 0, mLineInfoList[row].mDocIndexEnd - mLineInfoList[row].mDocIndexStart - 1);
doc_pos += column;
updateCursorXPos();
return setCursorPos(doc_pos);
S32 row = true_row;
S32 doc_pos;
while ( row < (S32)mLineInfoList.size() && mLineInfoList[row].mLineNum < true_row ) row++;
while ( row < (S32)mLineInfoList.size() && mLineInfoList[row].mLineNum == true_row )
{
S32 line_length = mLineInfoList[row].mDocIndexEnd - mLineInfoList[row].mDocIndexStart;
if ( column >= line_length)
{
column -= line_length;
row ++;
}
else
{
doc_pos = mLineInfoList[row].mDocIndexStart + column;
updateCursorXPos();
return setCursorPos(doc_pos);
}
}
}
return false;
}
bool LLTextBase::setCursorPos(S32 cursor_pos, bool keep_cursor_offset)
{
S32 new_cursor_pos = cursor_pos;