From 5e31fa33c3b5cf726a57a063b8e7a070869250fe Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 19 May 2026 21:46:01 +0900 Subject: fix(compile): fix more random compile errors Co-Authored-By: Claude Opus 4.7 (1M context) --- crates/shirabe/src/io/buffer_io.rs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'crates/shirabe/src/io/buffer_io.rs') 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]); - - if pre.len() == matches[2].len() { + |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() == 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, ); -- cgit v1.3.1