diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-25 13:25:39 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-25 23:47:47 +0900 |
| commit | 285ce0831fdb617916cac6249dd36c56802e5598 (patch) | |
| tree | ebcf89838bbfe7be770c13a9998d1dbf90dadb4b /crates/shirabe/src/console | |
| parent | e351b2f05553a9d3f1689e15234d8b07924848ea (diff) | |
| download | php-shirabe-285ce0831fdb617916cac6249dd36c56802e5598.tar.gz php-shirabe-285ce0831fdb617916cac6249dd36c56802e5598.tar.zst php-shirabe-285ce0831fdb617916cac6249dd36c56802e5598.zip | |
fix(console): spell ESC as \x1b for regex crate in HtmlOutputFormatter
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/console')
| -rw-r--r-- | crates/shirabe/src/console/html_output_formatter.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/shirabe/src/console/html_output_formatter.rs b/crates/shirabe/src/console/html_output_formatter.rs index 4ee87a1..cfb2f21 100644 --- a/crates/shirabe/src/console/html_output_formatter.rs +++ b/crates/shirabe/src/console/html_output_formatter.rs @@ -57,8 +57,11 @@ impl HtmlOutputFormatter { }; let clear_escape_codes = "(?:39|49|0|22|24|25|27|28)"; + // Regex pattern compatibility: + // The PHP pattern writes the ESC byte as the octal escape `\033`; the `regex` crate reads + // `\0` as a backreference, so spell ESC as `\x1b` instead. let pattern = format!( - "{{\\033\\[([0-9;]+)m(.*?)\\033\\[(?:{};)*?{}m}}s", + "{{\\x1b\\[([0-9;]+)m(.*?)\\x1b\\[(?:{};)*?{}m}}s", clear_escape_codes, clear_escape_codes ); |
