Skip to content

Commit

Permalink
Do not pre-write the answer to questions with the default anwser
Browse files Browse the repository at this point in the history
  • Loading branch information
kit-ty-kate committed Jan 24, 2025
1 parent 0128c98 commit ac627d0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <dir>` failure when it is a linked switch [#6276 @btjorge - fix #6275]
Expand Down
11 changes: 6 additions & 5 deletions src/core/opamConsole.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit ac627d0

Please sign in to comment.