From fccec92ce68283e1870d01baf65ab60539c434a1 Mon Sep 17 00:00:00 2001 From: ongspxm Date: Mon, 22 Dec 2025 18:45:28 +0800 Subject: [PATCH] tui fix diff --- code-rs/tui/src/get_git_diff.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code-rs/tui/src/get_git_diff.rs b/code-rs/tui/src/get_git_diff.rs index 78ab53d92f6..b204d479aea 100644 --- a/code-rs/tui/src/get_git_diff.rs +++ b/code-rs/tui/src/get_git_diff.rs @@ -21,8 +21,10 @@ pub(crate) async fn get_git_diff() -> io::Result<(bool, String)> { } // Run tracked diff and untracked file listing in parallel. + // Force-disable ANSI color escapes so the TUI diff renderer can apply its own + // styling without leaking raw escape sequences into the buffer. let (tracked_diff_res, untracked_output_res) = tokio::join!( - run_git_capture_diff(&["diff", "--color"]), + run_git_capture_diff(&["diff", "--no-color"]), run_git_capture_stdout(&["ls-files", "--others", "--exclude-standard"]), ); let tracked_diff = tracked_diff_res?; @@ -45,7 +47,7 @@ pub(crate) async fn get_git_diff() -> io::Result<(bool, String)> { let null_path = null_path.clone(); let file = file.to_string(); join_set.spawn(async move { - let args = ["diff", "--color", "--no-index", "--", &null_path, &file]; + let args = ["diff", "--no-color", "--no-index", "--", &null_path, &file]; run_git_capture_diff(&args).await }); }