diff --git a/master_changes.md b/master_changes.md index bc2c04e23cc..1d54c2f49d3 100644 --- a/master_changes.md +++ b/master_changes.md @@ -36,6 +36,7 @@ users) * [BUG] Ensure the output of opam commands using a column style UI stay consistent accross environment by setting the number of columns to 80 if stdout is not a tty and if the `COLUMNS` env variable is not set [#6244 @kit-ty-kate] * Improve the messages when a package is not up-to-date on opam upgrade [#6272 @kit-ty-kate - fix #6270] * Use a non-underline uppercase character to denotate the default when asking a question [#6289 @hannesm @kit-ty-kate - fix #6288] + * Do not pre-write the answer to questions with the default anwser [#6376 @kit-ty-kate] ## Switch * [BUG] Fix `opam switch remove ` failure when it is a linked switch [#6276 @btjorge - fix #6275] 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 =