nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 47770bd321c7034f7c5f6a7306cfc93865c96a3a
parent d656b0d3b9a1fe21fc8eea30d68f8be1362cce9f
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Tue, 28 May 2019 17:19:34 +0200

feedback: treat statusline() being called outside of curses mode as a bug

Diffstat:
Msrc/winio.c | 10+++-------
1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/winio.c b/src/winio.c @@ -2211,14 +2211,9 @@ void statusline(message_type importance, const char *msg, ...) (lastmessage == MILD && importance == HUSH)) return; - va_start(ap, msg); - - /* Curses mode is turned off. If we use wmove() now, it will muck - * up the terminal settings. So we just use vfprintf(). */ + /* Curses mode shouldn't be off when trying to write to the status bar. */ if (isendwin()) { - fprintf(stderr, "\n"); - vfprintf(stderr, msg, ap); - va_end(ap); + fprintf(stderr, "Out of curses -- please report a bug\n"); return; } @@ -2248,6 +2243,7 @@ void statusline(message_type importance, const char *msg, ...) /* Construct the message out of all the arguments. */ compound = charalloc(MAXCHARLEN * (COLS + 1)); + va_start(ap, msg); vsnprintf(compound, MAXCHARLEN * (COLS + 1), msg, ap); va_end(ap); message = display_string(compound, 0, COLS, FALSE, FALSE);