CHUI-964 ADD FIX Oversized "To" input field hides actual IM text

master
PavelK ProductEngine 2013-06-05 19:40:06 +03:00
parent 58d2896a07
commit 0ada8944ee
4 changed files with 26 additions and 6 deletions

View File

@ -158,7 +158,7 @@ void LLChatEntry::onValueChange(S32 start, S32 end)
resetLabel();
}
bool LLChatEntry::useLabel()
bool LLChatEntry::useLabel() const
{
return !getLength() && !mLabel.empty();
}

View File

@ -56,7 +56,7 @@ protected:
LLChatEntry(const Params& p);
/*virtual*/ void beforeValueChange();
/*virtual*/ void onValueChange(S32 start, S32 end);
/*virtual*/ bool useLabel();
/*virtual*/ bool useLabel() const;
public:

View File

@ -1854,7 +1854,17 @@ LLTextBase::segment_set_t::iterator LLTextBase::getSegIterContaining(S32 index)
static LLPointer<LLIndexSegment> index_segment = new LLIndexSegment();
if (index > getLength()) { return mSegments.end(); }
S32 text_len = 0;
if (!useLabel())
{
text_len = getLength();
}
else
{
text_len = mLabel.getWString().length();
}
if (index > text_len) { return mSegments.end(); }
// when there are no segments, we return the end iterator, which must be checked by caller
if (mSegments.size() <= 1) { return mSegments.begin(); }
@ -1870,7 +1880,17 @@ LLTextBase::segment_set_t::const_iterator LLTextBase::getSegIterContaining(S32 i
{
static LLPointer<LLIndexSegment> index_segment = new LLIndexSegment();
if (index > getLength()) { return mSegments.end(); }
S32 text_len = 0;
if (!useLabel())
{
text_len = getLength();
}
else
{
text_len = mLabel.getWString().length();
}
if (index > text_len) { return mSegments.end(); }
// when there are no segments, we return the end iterator, which must be checked by caller
if (mSegments.size() <= 1) { return mSegments.begin(); }
@ -2101,7 +2121,7 @@ void LLTextBase::resetLabel()
}
}
bool LLTextBase::useLabel()
bool LLTextBase::useLabel() const
{
return !getLength() && !mLabel.empty() && !hasFocus();
}

View File

@ -507,7 +507,7 @@ protected:
void initFromParams(const Params& p);
virtual void beforeValueChange();
virtual void onValueChange(S32 start, S32 end);
virtual bool useLabel();
virtual bool useLabel() const;
// draw methods
void drawSelectionBackground(); // draws the black box behind the selected text