Support ANSI escapes in strings by replacing \x1b
with ␛
#84
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.
There is a library that I saw the other day that does exactly this - replaces ASCII control characters with a sigil... but now I can't find it. @sindresorhus I think I saw it in one of your projects, do you remember what it was called?
Anyway I needed to hack this up to get unblocked, and I had this bit of replacement locally so I used that. (I'm using DC1-4 in a similar way that you're using
CONTROL_PICTURE
so they show up in my strings). I left them in specifically because they're a bit of a code smell. Why only these 5 sigils? Why not all the ASCII control characters?I wonder if this would be better handled as an option to concordance... but then again I don't think it's a bad thing to output these control characters as printable characters, so the argument for having it be the default behaviour could be made.
Anyway I'll propose this as a starting point, but I don't think it's polished and ready - I'm happy to do more work on it.