summaryrefslogtreecommitdiff
path: root/indra/llui/lltextbase.cpp
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-01-03 12:21:30 -0800
committerRichard Linden <none@none>2012-01-03 12:21:30 -0800
commit1b1ad93c5d341eb564a7e6fc1ae9298473d8a98e (patch)
treeaae52a892e4969a7936ea8554b770cb309f6cd25 /indra/llui/lltextbase.cpp
parent9f929043430632ef629a97977da7430685dd30e1 (diff)
EXP-1512 FIX changing UI size changes cursor position in notecards
fixed case where adding text between 2 consecutive newlines created gibberish
Diffstat (limited to 'indra/llui/lltextbase.cpp')
-rw-r--r--indra/llui/lltextbase.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 1f890b625f..0040be45c7 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -1513,6 +1513,8 @@ void LLTextBase::getSegmentAndOffset( S32 startpos, segment_set_t::iterator* seg
LLTextBase::segment_set_t::iterator LLTextBase::getEditableSegIterContaining(S32 index)
{
segment_set_t::iterator it = getSegIterContaining(index);
+ segment_set_t::iterator orig_it = it;
+
if (it == mSegments.end()) return it;
if (!(*it)->canEdit()
@@ -1520,13 +1522,18 @@ LLTextBase::segment_set_t::iterator LLTextBase::getEditableSegIterContaining(S32
&& it != mSegments.begin())
{
it--;
+ if ((*it)->canEdit())
+ {
+ return it;
+ }
}
- return it;
+ return orig_it;
}
LLTextBase::segment_set_t::const_iterator LLTextBase::getEditableSegIterContaining(S32 index) const
{
segment_set_t::const_iterator it = getSegIterContaining(index);
+ segment_set_t::const_iterator orig_it = it;
if (it == mSegments.end()) return it;
if (!(*it)->canEdit()
@@ -1534,8 +1541,12 @@ LLTextBase::segment_set_t::const_iterator LLTextBase::getEditableSegIterContaini
&& it != mSegments.begin())
{
it--;
+ if ((*it)->canEdit())
+ {
+ return it;
+ }
}
- return it;
+ return orig_it;
}
LLTextBase::segment_set_t::iterator LLTextBase::getSegIterContaining(S32 index)