From 99733666852c60f17dc94442e5bb74061359abb5 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 26 Dec 2016 17:31:27 +0100 Subject: [PATCH] prompt: represent newlines as ^J instead of breaking the bar Also at the yes-no prompt, a 0x0A byte should be displayed as a ^J instead of splitting the prompt bar in two and spreading it over two lines. This fixes https://savannah.gnu.org/bugs/?49934. --- src/prompt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/prompt.c b/src/prompt.c index 5e0cce2f..ec4ca0b0 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -723,6 +723,8 @@ int do_prompt(bool allow_tabs, int do_yesno_prompt(bool all, const char *msg) { int response = -2, width = 16; + char *message = display_string(msg, 0, COLS, FALSE); + /* TRANSLATORS: For the next three strings, if possible, specify * the single-byte shortcuts for both your language and English. * For example, in French: "OoYy", for both "Oui" and "Yes". */ @@ -773,7 +775,7 @@ int do_yesno_prompt(bool all, const char *msg) /* Color the statusbar over its full width and display the question. */ wattron(bottomwin, interface_color_pair[TITLE_BAR]); blank_statusbar(); - mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1)); + mvwaddnstr(bottomwin, 0, 0, message, actual_x(message, COLS - 1)); wattroff(bottomwin, interface_color_pair[TITLE_BAR]); wnoutrefresh(bottomwin); @@ -827,5 +829,7 @@ int do_yesno_prompt(bool all, const char *msg) } } while (response == -2); + free(message); + return response; }