diff options
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/llui/llchatentry.cpp | 18 | ||||
| -rw-r--r-- | indra/llui/llchatentry.h | 2 | ||||
| -rw-r--r-- | indra/llui/lltexteditor.cpp | 34 | ||||
| -rw-r--r-- | indra/llui/lltexteditor.h | 2 | 
4 files changed, 34 insertions, 22 deletions
| diff --git a/indra/llui/llchatentry.cpp b/indra/llui/llchatentry.cpp index 55e4beafb6..b01a8caf1f 100644 --- a/indra/llui/llchatentry.cpp +++ b/indra/llui/llchatentry.cpp @@ -250,21 +250,3 @@ void LLChatEntry::enableSingleLineMode(bool single_line_mode)      mPrevLinesCount = -1;      setWordWrap(!single_line_mode);  } - -LLWString LLChatEntry::getConvertedText() const -{ -    LLWString text = getWText(); -    S32 diff = 0; -    for (auto segment : mSegments) -    { -        if (segment && segment->getStyle() && segment->getStyle()->getDrawHighlightBg()) -        { -            S32 seg_length = segment->getEnd() - segment->getStart(); -            std::string slurl = segment->getStyle()->getLinkHREF(); - -            text.replace(segment->getStart() + diff, seg_length, utf8str_to_wstring(slurl)); -            diff += (S32)slurl.size() - seg_length; -        } -    } -    return text; -} diff --git a/indra/llui/llchatentry.h b/indra/llui/llchatentry.h index bb5eb8024d..5621ede1e7 100644 --- a/indra/llui/llchatentry.h +++ b/indra/llui/llchatentry.h @@ -68,8 +68,6 @@ public:      void enableSingleLineMode(bool single_line_mode);      boost::signals2::connection setTextExpandedCallback(const commit_signal_t::slot_type& cb); -    LLWString getConvertedText() const; -  private:      /** diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index bc73090ff7..cfe729be06 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -722,9 +722,21 @@ void LLTextEditor::handleMentionCommit(std::string name_url)      if (LLChatMentionHelper::instance().isCursorInNameMention(getWText(), mCursorPos, &mention_start_pos))      {          remove(mention_start_pos, mCursorPos - mention_start_pos, true); -        setCursorPos(mention_start_pos); +        insert(mention_start_pos, utf8str_to_wstring(name_url), false, LLTextSegmentPtr()); -        appendTextImpl(name_url, LLStyle::Params(), true); +        std::string new_text(wstring_to_utf8str(getConvertedText())); +        clear(); +        appendTextImpl(new_text, LLStyle::Params(), true); + +        segment_set_t::const_iterator it = getSegIterContaining(mention_start_pos); +        if (it != mSegments.end()) +        { +            setCursorPos((*it)->getEnd() + 1); +        } +        else +        { +            setCursorPos(mention_start_pos); +        }      }  } @@ -3129,3 +3141,21 @@ S32 LLTextEditor::spacesPerTab()  {      return SPACES_PER_TAB;  } + +LLWString LLTextEditor::getConvertedText() const +{ +    LLWString text = getWText(); +    S32 diff = 0; +    for (auto segment : mSegments) +    { +        if (segment && segment->getStyle() && segment->getStyle()->getDrawHighlightBg()) +        { +            S32 seg_length = segment->getEnd() - segment->getStart(); +            std::string slurl = segment->getStyle()->getLinkHREF(); + +            text.replace(segment->getStart() + diff, seg_length, utf8str_to_wstring(slurl)); +            diff += (S32)slurl.size() - seg_length; +        } +    } +    return text; +} diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index e38908734f..403ea3f4fc 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -215,6 +215,8 @@ public:      void            setPassDelete(bool b) { mPassDelete = b; } +    LLWString       getConvertedText() const; +  protected:      void            showContextMenu(S32 x, S32 y);      void            drawPreeditMarker(); | 
