diff --git a/src/global.c b/src/global.c
index 12c2cbc154422a573240b617ac008293b187e5f2..6a58089922b6a078b3297581025c63c07f42835b 100644
--- a/src/global.c
+++ b/src/global.c
@@ -1147,9 +1147,7 @@ void shortcut_init(void)
     add_to_sclist(MMAIN, "M-^", 0, do_copy_text, 0);
     add_to_sclist(MMAIN, "M-}", 0, do_indent, 0);
     add_to_sclist(MMAIN, "M-{", 0, do_unindent, 0);
-#ifdef KEY_BTAB
-    add_to_sclist(MMAIN, "S-Tab", KEY_BTAB, do_unindent, 0);
-#endif
+    add_to_sclist(MMAIN, "S-Tab", SHIFT_TAB, do_unindent, 0);
     add_to_sclist(MMAIN, "M-:", 0, record_macro, 0);
     add_to_sclist(MMAIN, "M-;", 0, run_macro, 0);
     add_to_sclist(MMAIN, "M-U", 0, do_undo, 0);
diff --git a/src/nano.h b/src/nano.h
index 7ce36646b64710df8ece8cda3e8ceca7b328f84b..7e6d8f816504ebc5124748d24caf44231ac2afda 100644
--- a/src/nano.h
+++ b/src/nano.h
@@ -590,6 +590,7 @@ enum
 #define SHIFT_END 0x456
 #define SHIFT_PAGEUP 0x457
 #define SHIFT_PAGEDOWN 0x458
+#define SHIFT_TAB 0x45F
 
 #ifdef USE_SLANG
 #ifdef ENABLE_UTF8
diff --git a/src/winio.c b/src/winio.c
index 3a64cd14e930ebd1dcc8d25a0bc0ce4aed173c44..b6fd62e76012390438f210e026c5fb21814be7b3 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -613,11 +613,9 @@ int parse_kbinput(WINDOW *win)
 #ifndef NANO_TINY
 	/* Is Shift being held? */
 	if (modifiers & 0x01) {
-#ifdef KEY_BTAB
 	    /* A shifted <Tab> is a back tab. */
 	    if (retval == TAB_CODE)
-		return KEY_BTAB;
-#endif
+		return SHIFT_TAB;
 	    shift_held = TRUE;
 	}
 #endif
@@ -769,6 +767,11 @@ int parse_kbinput(WINDOW *win)
 	case KEY_SUSPEND:
 	    return the_code_for(do_suspend_void, KEY_SUSPEND);
 #endif
+#ifdef KEY_BTAB
+	/* Slang doesn't support KEY_BTAB. */
+	case KEY_BTAB:
+	    return SHIFT_TAB;
+#endif
 #ifdef PDCURSES
 	case KEY_SHIFT_L:
 	case KEY_SHIFT_R:
@@ -1213,8 +1216,9 @@ int convert_sequence(const int *seq, size_t seq_len)
 			return KEY_F(12);
 		    case 'Y': /* Esc [ Y == End on Mach console. */
 			return KEY_END;
-		    case 'Z': /* Esc [ Z == F14 on FreeBSD console. */
-			return KEY_F(14);
+		    case 'Z': /* Esc [ Z == Shift-Tab on ANSI/Linux console/
+			       * FreeBSD console/xterm/rxvt/Terminal. */
+			return SHIFT_TAB;
 		    case 'a': /* Esc [ a == Shift-Up on rxvt/Eterm. */
 		    case 'b': /* Esc [ b == Shift-Down on rxvt/Eterm. */
 		    case 'c': /* Esc [ c == Shift-Right on rxvt/Eterm. */