diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-19 21:46:01 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-19 21:46:08 +0900 |
| commit | 5e31fa33c3b5cf726a57a063b8e7a070869250fe (patch) | |
| tree | 98522466966fa7df483cad174ab5fc03db39bc09 /crates/shirabe/src/io/buffer_io.rs | |
| parent | c839244d8d09f3036ebfee8eef7eb6b147e593ab (diff) | |
| download | php-shirabe-5e31fa33c3b5cf726a57a063b8e7a070869250fe.tar.gz php-shirabe-5e31fa33c3b5cf726a57a063b8e7a070869250fe.tar.zst php-shirabe-5e31fa33c3b5cf726a57a063b8e7a070869250fe.zip | |
fix(compile): fix more random compile errors
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/io/buffer_io.rs')
| -rw-r--r-- | crates/shirabe/src/io/buffer_io.rs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/crates/shirabe/src/io/buffer_io.rs b/crates/shirabe/src/io/buffer_io.rs index aa1d970..79fa9c3 100644 --- a/crates/shirabe/src/io/buffer_io.rs +++ b/crates/shirabe/src/io/buffer_io.rs @@ -56,15 +56,26 @@ impl BufferIO { let output = Preg::replace_callback( r"{(?<=^|\n|\x08)(.+?)(\x08+)}", - |matches: &[String]| -> String { - let pre = strip_tags(&matches[1]); + |matches: &indexmap::IndexMap< + shirabe_external_packages::composer::pcre::preg::CaptureKey, + String, + >| + -> String { + let empty = String::new(); + let g1 = matches + .get(&shirabe_external_packages::composer::pcre::preg::CaptureKey::ByIndex(1)) + .unwrap_or(&empty); + let g2 = matches + .get(&shirabe_external_packages::composer::pcre::preg::CaptureKey::ByIndex(2)) + .unwrap_or(&empty); + let pre = strip_tags(g1); - if pre.len() == matches[2].len() { + if pre.len() == g2.len() { return String::new(); } // TODO reverse parse the string, skipping span tags and \033\[([0-9;]+)m(.*?)\033\[0m style blobs - format!("{}\n", matches[1].trim_end()) + format!("{}\n", g1.trim_end()) }, &output, ); |
