commit 7ebf5f52b8d0af9c0965156218d2df44203b1ae6
parent 4f7593b704972a26bf243605fd53b22543cb0b69
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sat, 5 Dec 2020 12:12:11 +0100
tweaks: clean up after the previous change
Diffstat:
3 files changed, 14 insertions(+), 18 deletions(-)
diff --git 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 <ncursesw/ncurses.h>
#elif defined(HAVE_NCURSES_H)
#include <ncurses.h>
#else
-/* Curses support. */
#include <curses.h>
-#endif /* CURSES_H */
+#endif
#ifdef ENABLE_NLS
/* Native language support. */
diff --git 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
@@ -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) {