Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14027081
D9597.id22989.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
464 B
Referenced Files
None
Subscribers
None
D9597.id22989.diff
View Options
diff --git a/src/utils/utf8.php b/src/utils/utf8.php
--- a/src/utils/utf8.php
+++ b/src/utils/utf8.php
@@ -190,6 +190,9 @@
*/
function phutil_utf8_console_strlen($string) {
+ // Formatting and colors don't contribute any width in the console.
+ $string = preg_replace('/\e\[\d*m/sU', '', $string);
+
// In the common case of an ASCII string, just return the string length.
if (preg_match('/^[\x01-\x7F]*\z/', $string)) {
return strlen($string);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 9, 5:04 AM (4 d, 22 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6762786
Default Alt Text
D9597.id22989.diff (464 B)
Attached To
Mode
D9597: Ignore colors and formatting when determining string length.
Attached
Detach File
Event Timeline
Log In to Comment