From 388f152e022d1dfad255508305485e4c611a81e1 Mon Sep 17 00:00:00 2001 From: Jean Mertz Date: Sat, 11 Apr 2026 01:01:23 +0200 Subject: [PATCH] chore(tools): Fix `fs_create_file` response appending modified string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous code modified `response` first, then appended `response` to itself — causing the already-modified string (including the full content block) to appear as the footer instead of the original header. The fix clones the header before modification and builds the complete output in a single `push_str` call, so the file path appears correctly both before and after the highlighted content block. Signed-off-by: Jean Mertz --- .config/jp/tools/src/fs/create_file.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/jp/tools/src/fs/create_file.rs b/.config/jp/tools/src/fs/create_file.rs index ea9ced6f..89233409 100644 --- a/.config/jp/tools/src/fs/create_file.rs +++ b/.config/jp/tools/src/fs/create_file.rs @@ -41,8 +41,8 @@ pub(crate) async fn fs_create_file( let highlighted = Formatter::new() .format_terminal(&code_block) .unwrap_or(code_block); - response.push_str(&format!(" with content:\n\n{highlighted}\n")); - response.push_str(&format!("\n{response}\n")); + let header = response.clone(); + response.push_str(&format!(" with content:\n\n{highlighted}\n\n{header}")); } return Ok(response.into());