diff --git a/ChangeLog b/ChangeLog index 88bd467046417d0bfa2dc58bb3cdab7bdd691312..0c7f5d6989e04e7029fe3191433a8c20e8183162 100644 --- a/ChangeLog +++ b/ChangeLog @@ -135,6 +135,9 @@ CVS code - doc/syntax/sh.nanorc, and doc/syntax/tex.nanorc; changes to configure.ac, nano.spec.in, doc/Makefile.am, and m4/Makefile.am; removal of doc/nanorc.sample. (DLR) + - Replace usage of the bool curses_ended with the isendwin() + function, and remove curses_ended. Changes to do_suspend(). + (DLR) - browser.c: do_browser() - Reference NANO_GOTODIR_(ALT|F)?KEY instead of @@ -249,6 +252,8 @@ CVS code - (DLR, found by Benno Schulenberg) renumber() - Remove invalid assert. (DLR, found by Filipe Moreira) + do_suspend() + - Simplify the printing of "Use \"fg\" to return to nano". (DLR) do_input() - Remove redundant check for allow_funcs' being TRUE when we get KEY_MOUSE. (DLR) @@ -327,6 +332,9 @@ CVS code - statusbar message. (Benno Schulenberg) - Unconditionally blank the statusbar as soon as we're finished getting input. (DLR, suggested by Benno Schulenberg) +- utils.c: + nperror() + - Simplify. (DLR) - winio.c: parse_kbinput() - If we get NANO_CONTROL_8, properly handle it in all cases. diff --git a/src/global.c b/src/global.c index 80c77e13afee1827a1d7de284c78ff03b21400e6..c61077e214d90f85a89a5d6e59a37253285a99cc 100644 --- a/src/global.c +++ b/src/global.c @@ -208,10 +208,6 @@ regmatch_t regmatches[10]; int reverse_attr = A_REVERSE; /* The curses attribute we use for reverse video. */ -bool curses_ended = FALSE; - /* Whether endwin() has ended curses mode and statusbar() - * should hence write to stderr instead of displaying on the - * statusbar. */ char *homedir = NULL; /* The user's home directory, from $HOME or /etc/passwd. */ diff --git a/src/nano.c b/src/nano.c index dca1c63d01c5dadc20e520177d6fc067369d8a16..1d7ed8ef2b1a74101844dd40a7edf55f87f5ff06 100644 --- a/src/nano.c +++ b/src/nano.c @@ -532,6 +532,7 @@ void finish(void) blank_statusbar(); wrefresh(bottomwin); + endwin(); /* Restore the old terminal settings. */ @@ -555,7 +556,6 @@ void die(const char *msg, ...) va_list ap; endwin(); - curses_ended = TRUE; /* Restore the old terminal settings. */ tcsetattr(0, TCSANOW, &oldterm); @@ -994,8 +994,10 @@ RETSIGTYPE handle_hupterm(int signal) /* Handler for SIGTSTP (suspend). */ RETSIGTYPE do_suspend(int signal) { + /* Temporarily leave curses mode. */ endwin(); - printf("\n\n\n\n\n%s\n", _("Use \"fg\" to return to nano")); + + printf(_("\n\n\n\n\nUse \"fg\" to return to nano\n")); fflush(stdout); /* Restore the old terminal settings. */ diff --git a/src/proto.h b/src/proto.h index 4bc4b771d8f3297c2736af7cfec933fb51091327..c9e857940952682d4905636e01cb807d61240fe3 100644 --- a/src/proto.h +++ b/src/proto.h @@ -138,7 +138,6 @@ extern regmatch_t regmatches[10]; #endif extern int reverse_attr; -extern bool curses_ended; extern char *homedir; diff --git a/src/utils.c b/src/utils.c index d94ce758352dcda66f64441d25d48ac0cab6044a..70601b3d8f95f128dac1aba6d9169d44d2945688 100644 --- a/src/utils.c +++ b/src/utils.c @@ -355,17 +355,15 @@ const char *strstrwrapper(const char *haystack, const char *needle, return mbstrcasestr(start, needle); } -/* This is a wrapper for the perror() function. The wrapper takes care - * of curses, calls perror() (which writes to stderr), and then - * refreshes the screen. Note that nperror() causes the window to - * flicker once. */ +/* This is a wrapper for the perror() function. The wrapper temporarily + * leaves curses mode, calls perror() (which writes to stderr), and then + * reenters curses mode, updating the screen in the process. Note that + * nperror() causes the window to flicker once. */ void nperror(const char *s) { - /* Leave curses mode and go to the terminal. */ - if (endwin() != ERR) { - perror(s); /* Print the error. */ - total_refresh(); /* Return to curses and refresh. */ - } + endwin(); + perror(s); + doupdate(); } /* This is a wrapper for the malloc() function that properly handles diff --git a/src/winio.c b/src/winio.c index 2b7b1611555dc9ae8370d20d2a9d5356f102ad9b..8fc99d6f4cfd9c7b1c6451f4573d3237a4a28821 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2119,7 +2119,7 @@ void statusbar(const char *msg, ...) /* Curses mode is turned off. If we use wmove() now, it will muck * up the terminal settings. So we just use vfprintf(). */ - if (curses_ended) { + if (isendwin()) { vfprintf(stderr, msg, ap); va_end(ap); return;