From 24f308468d27b14db8fe2c6e8c578b3a771fedb1 Mon Sep 17 00:00:00 2001 From: "Colin T.A. Gray" Date: Mon, 25 Nov 2024 07:55:15 -0500 Subject: [PATCH] Replaces some (!) ASCII characters with a sigil - allows ANSI control sequences in diff output --- lib/primitiveValues/string.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/primitiveValues/string.js b/lib/primitiveValues/string.js index e9e4d85..bf9ec32 100644 --- a/lib/primitiveValues/string.js +++ b/lib/primitiveValues/string.js @@ -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'