Skip to content

Commit

Permalink
Ensure OpamConsole.pause always prints a newline character at the end
Browse files Browse the repository at this point in the history
  • Loading branch information
kit-ty-kate committed Feb 10, 2025
1 parent 78fb841 commit 6e89c8c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ users)

## opam-core
* `OpamConsole`: Replace `black` text style (unused and not very readable) by `gray` [#6358 @kit-ty-kate]
* `OpamConsole.pause`: Ensure the function always prints a newline character at the end [#6376 @kit-ty-kate]
* `OpamStd.List.split`: Improve performance [#6210 @kit-ty-kate]
* `OpamStd.Sys.{get_terminal_columns,uname,getconf,guess_shell_compat}`: Harden the process calls to account for failures [#6230 @kit-ty-kate - fix #6215]
* `OpamStd.Sys.getconf`: was removed, replaced by `get_long_bit` [#6217 @kit-ty-kate]
Expand Down
1 change: 0 additions & 1 deletion src/client/opamClient.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,6 @@ let initialise_msys2 root =
OpamConsole.error_and_exit `Aborted "MSYS2 failed to initialise"
| `No ->
OpamConsole.pause "Standing by, press enter to continue when done.";
OpamConsole.msg "\n"
| `Ignore ->
()
| `Quit ->
Expand Down
1 change: 0 additions & 1 deletion src/client/opamSolution.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,6 @@ let install_sys_packages ~map_sysmap ~confirm env config sys_packages t =
OpamConsole.msg "\n";
print_command sys_packages;
OpamConsole.pause "Standing by, press enter to continue when done.";
OpamConsole.msg "\n";
check_again t sys_packages
| `Ignore -> bypass t
| `Quit -> give_up_msg (); OpamStd.Sys.exit_because `Aborted
Expand Down
8 changes: 4 additions & 4 deletions src/core/opamConsole.ml
Original file line number Diff line number Diff line change
Expand Up @@ -748,9 +748,9 @@ let short_user_input ~prompt ?default ?on_eof f =
match input with
| None -> loop ()
| Some i -> match f i with
| Some a ->
if String.length i > 0 && i.[0] <> '\027' then print_endline i;
a
| Some a when String.length i > 0 && i.[0] = '\027' ->
print_newline (); a
| Some a -> print_endline i; a
| None -> loop ()
in
let attr = tcgetattr stdin in
Expand Down Expand Up @@ -780,7 +780,7 @@ let pause fmt =
let prompt = OpamStd.Format.reformat s in
short_user_input ~prompt ~default:""
(function
| "\027" -> OpamStd.Sys.exit_because `Aborted
| "\027" -> print_newline (); OpamStd.Sys.exit_because `Aborted
| _ -> Some ()))
fmt
else
Expand Down

0 comments on commit 6e89c8c

Please sign in to comment.