diff --git a/src/Editor.php b/src/Editor.php index 04890c4..eb9cae0 100644 --- a/src/Editor.php +++ b/src/Editor.php @@ -528,7 +528,21 @@ class Editor { for ($i = 0; $i < $len; $i++) { - if ($hl[$i] === Highlight::NORMAL) + // Handle 'non-printable' characters + if (is_cntrl($c[$i])) + { + $sym = (ord($c[$i]) <= 26) + ? chr(ord('@') + ord($c[$i])) + : '?'; + $this->ab .= "\x1b[7m"; + $this->ab .= $sym; + $this->ab .= "\x1b[m"; + if ($currentColor !== -1) + { + $this->ab .= sprintf("\x1b%dm", $currentColor); + } + } + else if ($hl[$i] === Highlight::NORMAL) { if ($currentColor !== -1) {