summaryrefslogtreecommitdiff
path: root/indra/llui/lltextbase.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-03-17 01:15:29 +0200
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-03-17 22:47:23 +0200
commit05c8cd82dc7a0bb900e837e932ab6f619fc20fe0 (patch)
tree932fad0334fb7a8f6d94312a8060fd0f7fb4261e /indra/llui/lltextbase.cpp
parentdd4f5cf13dbf9ec463bee2ce25e652786e5fb370 (diff)
viewer-private#540 Avoid micro truncations #3
Diffstat (limited to 'indra/llui/lltextbase.cpp')
-rw-r--r--indra/llui/lltextbase.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index b53b5bd7a4..c084b400f6 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -1091,13 +1091,12 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s
getViewModel()->getEditableDisplay().insert(pos, wstr);
- if ( truncate() )
- {
- insert_len = getLength() - old_len;
- }
-
if (mTrackValueChange)
{
+ if (truncate())
+ {
+ insert_len = getLength() - old_len;
+ }
onValueChange(pos, pos + insert_len);
}
needsReflow(pos);
@@ -2373,6 +2372,7 @@ void LLTextBase::setText(const LLStringExplicit &utf8str, const LLStyle::Params&
startOfDoc();
}
+ truncate(); // was postponed to avoid micro truncations and expensive checks
mTrackValueChange = true;
onValueChange(0, getLength());
}
@@ -2404,6 +2404,10 @@ void LLTextBase::appendTextImpl(const std::string& new_text, const LLStyle::Para
LLStyle::Params style_params(getStyleParams());
style_params.overwriteFrom(input_params);
+ // todo: this does not check for maximum size, might
+ // want to stop once maximum size was reached to avoid
+ // expensive findUrl, replaceUrl calls.
+
S32 part = (S32)LLTextParser::WHOLE;
if ((mParseHTML || force_slurl) && !style_params.is_link) // Don't search for URLs inside a link segment (STORM-358).
{
@@ -2595,6 +2599,7 @@ void LLTextBase::copyContents(const LLTextBase* source)
getViewModel()->setDisplay(source->getViewModel()->getDisplay());
+ truncate(); // was postponed to avoid micro truncations and expensive checks
mTrackValueChange = true;
onValueChange(0, getLength());
needsReflow();