From 57cf4864991db0e674a998c75d01bd0f7044590b Mon Sep 17 00:00:00 2001 From: Kate Date: Mon, 11 Nov 2024 21:18:15 +0000 Subject: [PATCH] Do not pre-write the answer to questions with the default anwser --- src/core/opamConsole.ml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/core/opamConsole.ml b/src/core/opamConsole.ml index 4438d69ae8e..491ca50e5cd 100644 --- a/src/core/opamConsole.ml +++ b/src/core/opamConsole.ml @@ -824,12 +824,13 @@ let confirm ?(require_unsafe_yes=false) ?(default=true) fmt = then (formatted_msg "%sn\n" prompt; false) else - short_user_input ~prompt ~default:(if default then 'y' else 'n') + short_user_input ~prompt ~default:' ' (function - | "y" | "yes" -> Some true - | "n" | "no" -> Some false - | "\027" -> Some false (* echap *) - | _ -> None)) + | " " -> Some default + | "y" | "yes" -> Some true + | "n" | "no" -> Some false + | "\027" -> Some false (* echap *) + | _ -> None)) fmt let read fmt =