7728 - show elipsis only when > length
Fixed the elipsis issue, only adds an elipisis if the text length exceeds the length that is being truncated too.
This commit is contained in:
committed by
Sebastiaan Janssen
parent
994c379a94
commit
7c841eb6ac
@@ -243,21 +243,27 @@ namespace Umbraco.Web
|
||||
}
|
||||
}
|
||||
|
||||
if (!lengthReached && currentTextLength >= length)
|
||||
if (!lengthReached)
|
||||
{
|
||||
// if the last character added was the first of a two character unicode pair, add the second character
|
||||
if (Char.IsHighSurrogate((char)ic))
|
||||
if (currentTextLength == length)
|
||||
{
|
||||
var lowSurrogate = tr.Read();
|
||||
outputtw.Write((char)lowSurrogate);
|
||||
}
|
||||
// if the last character added was the first of a two character unicode pair, add the second character
|
||||
if (char.IsHighSurrogate((char)ic))
|
||||
{
|
||||
var lowSurrogate = tr.Read();
|
||||
outputtw.Write((char)lowSurrogate);
|
||||
}
|
||||
|
||||
// Reached truncate limit.
|
||||
if (addElipsis)
|
||||
{
|
||||
outputtw.Write(hellip);
|
||||
}
|
||||
lengthReached = true;
|
||||
// only add elipsis if current length greater than original length
|
||||
if (currentTextLength > length)
|
||||
{
|
||||
if (addElipsis)
|
||||
{
|
||||
outputtw.Write(hellip);
|
||||
}
|
||||
lengthReached = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user