Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions indra/llui/lltexteditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1693,28 +1693,25 @@ void LLTextEditor::pasteTextWithLinebreaks(LLWString & clean_string)
std::basic_string<llwchar>::size_type start = 0;
std::basic_string<llwchar>::size_type pos = clean_string.find('\n',start);

while((pos != -1) && (pos != clean_string.length() -1))
while (pos != std::basic_string<llwchar>::npos)
{
if(pos!=start)
if (pos != start)
{
std::basic_string<llwchar> str = std::basic_string<llwchar>(clean_string,start,pos-start);
setCursorPos(mCursorPos + insert(mCursorPos, str, true, LLTextSegmentPtr()));
}
addLineBreakChar(true); // Add a line break and group with the next addition.
const bool trailing_linebreak = (pos == clean_string.length() - 1);
addLineBreakChar(!trailing_linebreak);

start = pos+1;
pos = clean_string.find('\n',start);
}

if (pos != start)
if (start < clean_string.length())
{
std::basic_string<llwchar> str = std::basic_string<llwchar>(clean_string,start,clean_string.length()-start);
setCursorPos(mCursorPos + insert(mCursorPos, str, false, LLTextSegmentPtr()));
}
else
{
addLineBreakChar(false); // Add a line break and end the grouping.
}
}

// copy selection to primary
Expand Down
Loading