diff --git a/Utilities/Strings.php b/Utilities/Strings.php index 7f7adf1..c24ea7c 100644 --- a/Utilities/Strings.php +++ b/Utilities/Strings.php @@ -492,10 +492,10 @@ public static function abbreviate($string, $maxWidth, $toWholeWord = false) } if ($toWholeWord) { - $lastSpace = mb_strrpos($string, ' ', -($fullLength - $maxWidth)); - $maxWidth = $lastSpace ? min($maxWidth, $lastSpace) : $maxWidth; + $lastSpace = mb_strrpos($string, ' ', -($fullLength - $maxWidth) + 1); + $maxWidth = $lastSpace ? $lastSpace+1 : $maxWidth; } - return trim(mb_substr($string, 0, $maxWidth)) . ' ...'; + return mb_substr($string, 0, $maxWidth) . '...'; } /**