summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2009-11-18 09:12:54 -0800
committerJames Cook <james@lindenlab.com>2009-11-18 09:12:54 -0800
commit1a2694f92b8dc27e8eb1b53b83e3b5201754f589 (patch)
tree9101c2fe4aa02a52ccfb44bc9e68b1d27051e65e /indra/llui
parent22aa5eed910bbd1b366789cb96247899c744df75 (diff)
parentacc53aa2f7a3fd939a207674a3bdf96d6e649f90 (diff)
merge
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/lllineeditor.cpp27
-rw-r--r--indra/llui/lllineeditor.h4
-rw-r--r--indra/llui/lltextbase.cpp8
3 files changed, 30 insertions, 9 deletions
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 75905d0927..c2f91ff7e0 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -84,8 +84,8 @@ void LLLineEditor::PrevalidateNamedFuncs::declareValues()
declare("non_negative_s32", LLLineEditor::prevalidateNonNegativeS32);
declare("alpha_num", LLLineEditor::prevalidateAlphaNum);
declare("alpha_num_space", LLLineEditor::prevalidateAlphaNumSpace);
- declare("printable_not_pipe", LLLineEditor::prevalidatePrintableNotPipe);
- declare("printable_no_space", LLLineEditor::prevalidatePrintableNoSpace);
+ declare("ascii_printable_no_pipe", LLLineEditor::prevalidateASCIIPrintableNoPipe);
+ declare("ascii_printable_no_space", LLLineEditor::prevalidateASCIIPrintableNoSpace);
}
LLLineEditor::Params::Params()
@@ -2186,20 +2186,28 @@ BOOL LLLineEditor::prevalidateAlphaNumSpace(const LLWString &str)
return rv;
}
+// Used for most names of things stored on the server, due to old file-formats
+// that used the pipe (|) for multiline text storage. Examples include
+// inventory item names, parcel names, object names, etc.
// static
-BOOL LLLineEditor::prevalidatePrintableNotPipe(const LLWString &str)
+BOOL LLLineEditor::prevalidateASCIIPrintableNoPipe(const LLWString &str)
{
BOOL rv = TRUE;
S32 len = str.length();
if(len == 0) return rv;
while(len--)
{
- if('|' == str[len])
+ llwchar wc = str[len];
+ if (wc < 0x20
+ || wc > 0x7f
+ || wc == '|')
{
rv = FALSE;
break;
}
- if(!((' ' == str[len]) || LLStringOps::isAlnum((char)str[len]) || LLStringOps::isPunct((char)str[len])))
+ if(!(wc == ' '
+ || LLStringOps::isAlnum((char)wc)
+ || LLStringOps::isPunct((char)wc) ) )
{
rv = FALSE;
break;
@@ -2209,15 +2217,19 @@ BOOL LLLineEditor::prevalidatePrintableNotPipe(const LLWString &str)
}
+// Used for avatar names
// static
-BOOL LLLineEditor::prevalidatePrintableNoSpace(const LLWString &str)
+BOOL LLLineEditor::prevalidateASCIIPrintableNoSpace(const LLWString &str)
{
BOOL rv = TRUE;
S32 len = str.length();
if(len == 0) return rv;
while(len--)
{
- if(LLStringOps::isSpace(str[len]))
+ llwchar wc = str[len];
+ if (wc < 0x20
+ || wc > 0x7f
+ || LLStringOps::isSpace(wc))
{
rv = FALSE;
break;
@@ -2232,6 +2244,7 @@ BOOL LLLineEditor::prevalidatePrintableNoSpace(const LLWString &str)
return rv;
}
+
// static
BOOL LLLineEditor::prevalidateASCII(const LLWString &str)
{
diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h
index d3daa941cf..4474963b1a 100644
--- a/indra/llui/lllineeditor.h
+++ b/indra/llui/lllineeditor.h
@@ -235,8 +235,8 @@ public:
static BOOL prevalidateNonNegativeS32(const LLWString &str);
static BOOL prevalidateAlphaNum(const LLWString &str );
static BOOL prevalidateAlphaNumSpace(const LLWString &str );
- static BOOL prevalidatePrintableNotPipe(const LLWString &str);
- static BOOL prevalidatePrintableNoSpace(const LLWString &str);
+ static BOOL prevalidateASCIIPrintableNoPipe(const LLWString &str);
+ static BOOL prevalidateASCIIPrintableNoSpace(const LLWString &str);
static BOOL prevalidateASCII(const LLWString &str);
static BOOL postvalidateFloat(const std::string &str);
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index caaf47240f..cd795282f9 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -2380,6 +2380,14 @@ bool LLNormalTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& widt
width = mStyle->getFont()->getWidth(text.c_str(), mStart + first_char, num_chars);
// if last character is a newline, then return true, forcing line break
llwchar last_char = text[mStart + first_char + num_chars - 1];
+
+ LLUIImagePtr image = mStyle->getImage();
+ if( image.notNull())
+ {
+ width += image->getWidth();
+ height = llmax(height, image->getHeight());
+ }
+
return num_chars >= 1 && last_char == '\n';
}