commit 99733666852c60f17dc94442e5bb74061359abb5
parent e72db0e3508b2bba116d9802b32968c3db00b52d
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Mon, 26 Dec 2016 17:31:27 +0100
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.
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git 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;
}