@@ -923,19 +923,30 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s
923
923
S32 new_seg_start = pos + (S32)i;
924
924
segment_set_t ::iterator cur_seg_iter = getSegIterContaining (new_seg_start);
925
925
LLStyleSP new_style;
926
+ std::string tooltip;
926
927
if (cur_seg_iter != mSegments .end ()) // Should be 100%
927
928
{
928
- // Use font EmojiLarge but preserve the target font style
929
+ // Use font EmojiLarge but preserve the target font style and tooltip if present
929
930
new_style = (*cur_seg_iter)->getStyle ()->clone ();
930
931
U8 font_style = new_style->getFont ()->getFontDesc ().getStyle ();
931
932
new_style->setFont (LLFontGL::getFont (LLFontDescriptor (" Emoji" , " Large" , font_style)));
933
+ if (!(*cur_seg_iter)->getToken ())
934
+ {
935
+ tooltip = (*cur_seg_iter)->getToolTip ();
936
+ }
932
937
}
933
938
else // Very unlikely
934
939
{
935
940
new_style = new LLStyle (getStyleParams ());
936
941
new_style->setFont (LLFontGL::getFontEmojiLarge ());
937
942
}
938
- insertSegment (new LLEmojiTextSegment (new_style, new_seg_start, new_seg_start + 1 , *this ));
943
+ LLTextSegmentPtr new_seg = new LLEmojiTextSegment (new_style, new_seg_start, new_seg_start + 1 , *this );
944
+
945
+ if (!tooltip.empty ())
946
+ {
947
+ new_seg->setToolTip (tooltip);
948
+ }
949
+ insertSegment (new_seg);
939
950
}
940
951
}
941
952
}
@@ -1066,18 +1077,19 @@ void LLTextBase::insertSegment(LLTextSegmentPtr segment_to_insert)
1066
1077
S32 old_segment_end = cur_segmentp->getEnd ();
1067
1078
// split old at start point for new segment
1068
1079
cur_segmentp->setEnd (segment_to_insert->getStart ());
1069
- // insert new segment before remainder of old segment
1070
- mSegments .insert (cur_seg_iter, segment_to_insert);
1071
1080
// advance to next segment
1072
1081
// insert remainder of old segment
1073
- if (segment_to_insert->getEnd () < old_segment_end)
1082
+ LLStyleConstSP sp = cur_segmentp->getStyle ();
1083
+ LLTextSegmentPtr remainder_segment = new LLNormalTextSegment (sp, segment_to_insert->getStart (), old_segment_end, *this );
1084
+ mSegments .insert (cur_seg_iter, remainder_segment);
1085
+ std::string tooltip = segment_to_insert->getToolTip ();
1086
+ if (!tooltip.empty ())
1074
1087
{
1075
- LLTextSegmentPtr remainder_segment = cur_segmentp->clone (*this );
1076
- remainder_segment->setStart (segment_to_insert->getEnd ());
1077
- remainder_segment->setEnd (old_segment_end);
1078
- mSegments .insert (cur_seg_iter, remainder_segment);
1079
- remainder_segment->linkToDocument (this );
1088
+ remainder_segment->setToolTip (tooltip);
1080
1089
}
1090
+ remainder_segment->linkToDocument (this );
1091
+ // insert new segment before remainder of old segment
1092
+ mSegments .insert (cur_seg_iter, segment_to_insert);
1081
1093
1082
1094
segment_to_insert->linkToDocument (this );
1083
1095
// at this point, there will be two overlapping segments owning the text
@@ -3310,6 +3322,7 @@ void LLTextSegment::setStyle(LLStyleConstSP style) {}
3310
3322
void LLTextSegment::setToken ( LLKeywordToken* token ) {}
3311
3323
LLKeywordToken* LLTextSegment::getToken () const { return NULL ; }
3312
3324
void LLTextSegment::setToolTip ( const std::string &msg ) {}
3325
+ std::string LLTextSegment::getToolTip () const { return std::string (); }
3313
3326
void LLTextSegment::dump () const {}
3314
3327
bool LLTextSegment::handleMouseDown (S32 x, S32 y, MASK mask) { return false ; }
3315
3328
bool LLTextSegment::handleMouseUp (S32 x, S32 y, MASK mask) { return false ; }
0 commit comments