diff options
author | Seth ProductEngine <slitovchuk@productengine.com> | 2011-07-14 23:46:27 +0300 |
---|---|---|
committer | Seth ProductEngine <slitovchuk@productengine.com> | 2011-07-14 23:46:27 +0300 |
commit | aad5943ab05cd5689b2898174c085fe9d5f69345 (patch) | |
tree | 5279ed13df461234dea851b5d945bd3ac9df3738 /indra | |
parent | fc5aaf5df8d3b064c05539c7b6911a4c3f4dc1c7 (diff) |
STORM-1234 FIXED text editor selection which was skipping the last character in line.
Added handling of the wrapped lines case when calculating the starting position for selection.
The bug is a regression caused by the fix of STORM-320 which was dealing with calculating the position of the input cursor while navigating through the lines of text with word wrapping enabled.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llui/lltextbase.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 349dbc3405..919364be63 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -2024,8 +2024,17 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round, } else if (hit_past_end_of_line && segmentp->getEnd() >= line_iter->mDocIndexEnd) { - // segment wraps to next line, so just set doc pos to the end of the line - pos = llclamp(line_iter->mDocIndexEnd - 1, 0, getLength()); + if (getLineNumFromDocIndex(line_iter->mDocIndexEnd - 1) == line_iter->mLineNum) + { + // if segment wraps to the next line we should step one char back + // to compensate for the space char between words + // which is removed due to wrapping + pos = llclamp(line_iter->mDocIndexEnd - 1, 0, getLength()); + } + else + { + pos = llclamp(line_iter->mDocIndexEnd, 0, getLength()); + } break; } start_x += text_width; |