From cb7367f172643c91476fbb4e61f09ec013aa2a20 Mon Sep 17 00:00:00 2001 From: Krzysztof Sucherek Date: Mon, 8 Mar 2021 14:23:48 +0100 Subject: [PATCH] fix error: redundant space before ellipsis. It had an effect on previous implementation. --- Utilities/Strings.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) . '...'; } /**