Skip to content

Commit

Permalink
Replaces some (!) ASCII characters with a sigil - allows ANSI control…
Browse files Browse the repository at this point in the history
… sequences in diff output
  • Loading branch information
colinta committed Nov 25, 2024
1 parent 791d2a8 commit 24f3084
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/primitiveValues/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ exports.tag = tag
// http://graphemica.com/blocks/control-pictures where applicable.
function basicEscape (string) {
return string.replace(/\\/g, '\\\\')
.replace(/\x00/g, "␀")
.replace(/\x1b/g, "␛")
.replace(/\x11/g, "␑")
.replace(/\x12/g, "␒")
.replace(/\x13/g, "␓")
.replace(/\x14/g, "␔")

}

const CRLF_CONTROL_PICTURE = '\u240D\u240A'
Expand Down

0 comments on commit 24f3084

Please sign in to comment.