@@ -1038,8 +1038,37 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s
10381038 {
10391039 LLStyleSP emoji_style;
10401040 LLEmojiDictionary* ed = LLEmojiDictionary::instanceExists () ? LLEmojiDictionary::getInstance () : NULL ;
1041+ LLTextSegment* segmentp = nullptr ;
1042+ segment_vec_t ::iterator seg_iter;
1043+ if (segments && segments->size () > 0 )
1044+ {
1045+ seg_iter = segments->begin ();
1046+ segmentp = *seg_iter;
1047+ }
10411048 for (S32 text_kitty = 0 , text_len = static_cast <S32>(wstr.size ()); text_kitty < text_len; text_kitty++)
10421049 {
1050+ if (segmentp)
1051+ {
1052+ if (segmentp->getEnd () <= pos + text_kitty)
1053+ {
1054+ seg_iter++;
1055+ if (seg_iter != segments->end ())
1056+ {
1057+ segmentp = *seg_iter;
1058+ }
1059+ else
1060+ {
1061+ segmentp = nullptr ;
1062+ }
1063+ }
1064+ if (segmentp && !segmentp->getPermitsEmoji ())
1065+ {
1066+ // Some segments, like LLInlineViewSegment do not permit splitting
1067+ // and should not be interrupted by emoji segments
1068+ continue ;
1069+ }
1070+ }
1071+
10431072 llwchar code = wstr[text_kitty];
10441073 bool isEmoji = ed ? ed->isEmoji (code) : LLStringOps::isEmoji (code);
10451074 if (isEmoji)
@@ -3448,6 +3477,7 @@ S32 LLTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offs
34483477void LLTextSegment::updateLayout (const LLTextBase& editor) {}
34493478F32 LLTextSegment::draw (S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect) { return draw_rect.mLeft ; }
34503479bool LLTextSegment::canEdit () const { return false ; }
3480+ bool LLTextSegment::getPermitsEmoji () const { return true ; }
34513481void LLTextSegment::unlinkFromDocument (LLTextBase*) {}
34523482void LLTextSegment::linkToDocument (LLTextBase*) {}
34533483const LLUIColor& LLTextSegment::getColor () const { static const LLUIColor white = LLUIColorTable::instance ().getColor (" White" , LLColor4::white); return white; }
0 commit comments