]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
terminal-util: output newline at end of "Press any key to proceed" message 36424/head
authorLennart Poettering <lennart@poettering.net>
Mon, 17 Feb 2025 21:29:54 +0000 (22:29 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 18 Feb 2025 08:19:03 +0000 (09:19 +0100)
So far we'd leave the cursor at the end of the Press any key to proceed
message as long as the user didn't type in anything yet, and generated
the newline only after.

Let's switch this around: let's output the newline before.

This should make boot-time output nicer since it means concurrent output
while we wait will start at the beginning of line, and not in the middle.

src/basic/terminal-util.c

index f9e2a280246fe537b714ee72f19b694a1ce2e623..0a18577630381b93495b7290fdbdbd0dd0ddb8ae 100644 (file)
@@ -485,12 +485,12 @@ bool any_key_to_proceed(void) {
         fputs(ansi_highlight_magenta(), stdout);
         fputs("-- Press any key to proceed --", stdout);
         fputs(ansi_normal(), stdout);
+        fputc('\n', stdout);
         fflush(stdout);
 
         char key = 0;
         (void) read_one_char(stdin, &key, USEC_INFINITY, /* echo= */ false, /* need_nl= */ NULL);
 
-        fputc('\n', stdout);
         fputc('\n', stdout);
         fflush(stdout);