From 4889c0d405355db2bf166bc3a835dbc0ccc0007a Mon Sep 17 00:00:00 2001 From: Barry <91018388+barry166@users.noreply.github.com> Date: Mon, 6 Jul 2026 04:59:47 +0800 Subject: [PATCH] fix(cli): restore cursor when configure exits (#10222) --- crates/goose-cli/src/commands/configure.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/goose-cli/src/commands/configure.rs b/crates/goose-cli/src/commands/configure.rs index bb51673d1a..96f1574b65 100644 --- a/crates/goose-cli/src/commands/configure.rs +++ b/crates/goose-cli/src/commands/configure.rs @@ -28,11 +28,22 @@ use goose::session::SessionType; use goose_providers::thinking::ThinkingEffort; use serde_json::Value; use std::collections::HashMap; -use std::io::IsTerminal; +use std::io::{IsTerminal, Write}; // useful for light themes where there is no discernible colour contrast between // cursor-selected and cursor-unselected items. const MULTISELECT_VISIBILITY_HINT: &str = "<"; +const SHOW_CURSOR: &[u8] = b"\x1b[?25h"; + +struct CursorRestoreGuard; + +impl Drop for CursorRestoreGuard { + fn drop(&mut self) { + let mut stdout = std::io::stdout().lock(); + let _ = stdout.write_all(SHOW_CURSOR); + let _ = stdout.flush(); + } +} pub async fn handle_configure() -> anyhow::Result<()> { if !std::io::stdin().is_terminal() { @@ -42,6 +53,7 @@ pub async fn handle_configure() -> anyhow::Result<()> { ); } + let _cursor_restore = CursorRestoreGuard; let config = Config::global(); if !config.exists() {