Skip to content
This repository was archived by the owner on Jun 18, 2022. It is now read-only.

Commit 5ae5ba7

Browse files
Only decolorize in cli\safe_str_pad() when colorizing
If we're not colorizing, we should be calculating padding based on the original string.
1 parent d0564da commit 5ae5ba7

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/cli/cli.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,9 @@ function safe_substr( $str, $start, $length = false ) {
202202
* @return string
203203
*/
204204
function safe_str_pad( $string, $length ) {
205+
$cleaned_string = Colors::shouldColorize() ? Colors::decolorize( $string ) : $string;
205206
// Hebrew vowel characters
206-
$cleaned_string = preg_replace( '#[\x{591}-\x{5C7}]+#u', '', Colors::decolorize( $string ) );
207+
$cleaned_string = preg_replace( '#[\x{591}-\x{5C7}]+#u', '', $cleaned_string );
207208
if ( function_exists( 'mb_strwidth' ) && function_exists( 'mb_detect_encoding' ) ) {
208209
$real_length = mb_strwidth( $cleaned_string, mb_detect_encoding( $string ) );
209210
} else {

0 commit comments

Comments
 (0)