From 2c82148d87e43521133aa2f6132cbd5c600093ee Mon Sep 17 00:00:00 2001 From: constanttime Date: Sat, 9 Aug 2025 23:50:52 +0530 Subject: [PATCH] fix: Remove bold styling from prompt on Windows to prevent cursor shift Fixes #3364 - On Windows terminals, the bold ANSI escape code in the prompt was causing the cursor to be shifted to the right. This change removes the bold styling specifically for Windows while maintaining it for other platforms. The issue was in the readline prompt where console::style was applying bold formatting that Windows terminals weren't handling correctly. --- crates/goose-cli/src/session/input.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/goose-cli/src/session/input.rs b/crates/goose-cli/src/session/input.rs index 3459ca8069a8..b14f723bd2ab 100644 --- a/crates/goose-cli/src/session/input.rs +++ b/crates/goose-cli/src/session/input.rs @@ -68,8 +68,16 @@ pub fn get_input( rustyline::EventHandler::Conditional(Box::new(CtrlCHandler)), ); - let prompt = format!("{} ", console::style("( O)>").cyan().bold()); - + // On Windows, we need to be careful with ANSI codes and cursor positioning + // Using a simpler prompt format to avoid cursor shift issues + let prompt = if cfg!(target_os = "windows") { + // For Windows, use a simpler prompt without bold styling which can cause issues + format!("{} ", console::style("( O)>").cyan()) + } else { + // For other platforms, keep the original styling + format!("{} ", console::style("( O)>").cyan().bold()) + }; + let input = match editor.readline(&prompt) { Ok(text) => text, Err(e) => match e {