PR 109 (double-width wrapping) and issue 106 (pre-colorization).#111
Merged
miya0001 merged 9 commits intowp-cli:masterfrom Jul 25, 2017
Merged
PR 109 (double-width wrapping) and issue 106 (pre-colorization).#111miya0001 merged 9 commits intowp-cli:masterfrom
miya0001 merged 9 commits intowp-cli:masterfrom
Conversation
…enable Colors in tests.
Member
|
Looks good on my end. Flagging a review from @miya0001 for a double-check |
Contributor
Author
|
Thanks @miya0001 - it's great to have a native kanji and kana user on board! |
Member
This was referenced Jul 26, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

PR #109 and issue #106
For PR #109 (incorrect wrapping of East Asian double-width chars in tables), adds an
is_widtharg tosafe_substr()to make it interpret thelengtharg as a spacing width, and uses the East Asian Width regex (now refactored to load in a function) to adjust accordingly (a slow algorithm but couldn't think of anything better). Uses this inAscii::row().For issue #106 (related wp-cli/wp-cli#2458), adds
pre_colorizedarg to various functions, and addsAscii::set/isPreColorized()andTable::set/isAsciiPreColorize()(the latter to be used via a correspondingascii_pre_colorizedarg to be added toWP_CLI/Formatter, see gitlost/wp-cli#15.)Also centralizes decolorization into
Colors::decolorize(), adding akeeparg to optionally keep either tokens or encodings.Also makes sure
Colors::colorize()only reads from cache after checkingshouldColorize().Also marks as unused the
coloredarg toColors::cacheString(), and stops using thedecolorizedcache element inlength()andwidth()as it never gets looked up if passed a colorized string (as they're indexed on the original string).Also replicates the padding logic of
safe_str_pad()inColors::pad()and moves decolorization toColors::width(), as it seems better that low-level funcs don't referenceColors.Also makes
lengtharg ofsafe_substr()cross PHP compat whethernullorfalse.Also adds an optional
encodingarg to various functions to save some processing, and makesmb_detect_encoding()use strict.