From 7ebf5f52b8d0af9c0965156218d2df44203b1ae6 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sat, 5 Dec 2020 12:12:11 +0100 Subject: [PATCH] tweaks: clean up after the previous change --- src/definitions.h | 5 ++--- src/nano.c | 24 +++++++++++------------- src/winio.c | 3 +-- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/definitions.h b/src/definitions.h index 13e9daa0..77910f14 100644 --- a/src/definitions.h +++ b/src/definitions.h @@ -68,15 +68,14 @@ #define PATH_MAX 4096 #endif -/* Ncurses support. */ +/* Prefer wide ncurses over normal ncurses over curses. */ #if defined(HAVE_NCURSESW_NCURSES_H) #include #elif defined(HAVE_NCURSES_H) #include #else -/* Curses support. */ #include -#endif /* CURSES_H */ +#endif #ifdef ENABLE_NLS /* Native language support. */ diff --git a/src/nano.c b/src/nano.c index 0ba7fb89..bf965c21 100644 --- a/src/nano.c +++ b/src/nano.c @@ -945,12 +945,11 @@ void do_suspend(int signal) /* Put nano to sleep (if suspension is enabled). */ void do_suspend_void(void) { - if (ISSET(SUSPENDABLE)) { - do_suspend(0); - } else { + if (!ISSET(SUSPENDABLE)) { statusbar(_("Suspension is not enabled")); beep(); - } + } else + do_suspend(0); ran_a_tool = TRUE; } @@ -1181,10 +1180,11 @@ void enable_flow_control(void) * control characters. */ void terminal_init(void) { - raw(); - nonl(); - noecho(); - disable_extended_io(); + raw(); + nonl(); + noecho(); + + disable_extended_io(); if (ISSET(PRESERVE)) enable_flow_control(); @@ -1767,12 +1767,10 @@ int main(int argc, char **argv) fcntl(STDIN_FILENO, F_SETFL, stdin_flags & ~O_NONBLOCK); #ifdef ENABLE_UTF8 - /* If setting the locale is successful and it uses UTF-8, we need - * to use the multibyte functions for text processing. */ - if (setlocale(LC_ALL, "") != NULL && - strcmp(nl_langinfo(CODESET), "UTF-8") == 0) { + /* If setting the locale is successful and it uses UTF-8, we will + * need to use the multibyte functions for text processing. */ + if (setlocale(LC_ALL, "") && strcmp(nl_langinfo(CODESET), "UTF-8") == 0) utf8_init(); - } #else setlocale(LC_ALL, ""); #endif diff --git a/src/winio.c b/src/winio.c index 0f779592..e90676ad 100644 --- a/src/winio.c +++ b/src/winio.c @@ -178,9 +178,8 @@ void read_keys_from(WINDOW *win) /* Before reading the first keycode, display any pending screen updates. */ doupdate(); - if (reveal_cursor) { + if (reveal_cursor) curs_set(1); - } /* Read in the first keycode, waiting for it to arrive. */ while (input == ERR) {