diff --git a/src/nano.h b/src/nano.h
index 36c7e9b1c7b23f009a2325a38f575d7953c7493d..b2e154a1bf79a99c834635dcf4206d43489e28d7 100644
--- a/src/nano.h
+++ b/src/nano.h
@@ -92,6 +92,10 @@
 #include <curses.h>
 #endif /* CURSES_H */
 
+#if defined(NCURSES_VERSION_MAJOR) && (NCURSES_VERSION_MAJOR < 6)
+#define USING_OLD_NCURSES yes
+#endif
+
 #ifdef ENABLE_NLS
 /* Native language support. */
 #ifdef HAVE_LIBINTL_H
diff --git a/src/winio.c b/src/winio.c
index 2bb7244a0653af9ecf6a224001c6fd8e72cd2aee..c9786679147f055193ecf3e4f52bae727f495ecf 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -46,8 +46,10 @@ static int statusblank = 0;
 	/* The number of keystrokes left before we blank the statusbar. */
 static bool suppress_cursorpos = FALSE;
 	/* Should we skip constant position display for one keystroke? */
+#ifdef USING_OLD_NCURSES
 static bool seen_wide = FALSE;
 	/* Whether we've seen a multicolumn character in the current line. */
+#endif
 
 #ifndef NANO_TINY
 static sig_atomic_t last_sigwinch_counter = 0;
@@ -1761,7 +1763,9 @@ char *display_string(const char *buf, size_t start_col, size_t span,
     converted = charalloc(strlen(buf) * (mb_cur_max() + tabsize) + 1);
 
     index = 0;
+#ifdef USING_OLD_NCURSES
     seen_wide = FALSE;
+#endif
     buf += start_index;
 
     if (*buf != '\0' && *buf != '\t' &&
@@ -1845,9 +1849,10 @@ char *display_string(const char *buf, size_t start_col, size_t span,
 		converted[index++] = *(buf++);
 
 	    start_col += charwidth;
+#ifdef USING_OLD_NCURSES
 	    if (charwidth > 1)
 		seen_wide = TRUE;
-
+#endif
 	    continue;
 	}
 
@@ -2229,7 +2234,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int
      * marking highlight on just the pieces that need it. */
     mvwaddstr(edit, line, 0, converted);
 
-#ifndef USE_SLANG
+#ifdef USING_OLD_NCURSES
     /* Tell ncurses to really redraw the line without trying to optimize
      * for what it thinks is already there, because it gets it wrong in
      * the case of a wide character in column zero.  See bug #31743. */