From f6cf4a7d7c5e4c2f2ec76a236e07eaebf808b0d6 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Wed, 22 Oct 2003 16:20:47 +0000 Subject: [PATCH] avoid having duplicate case values when some key values are missing (assume ERR is -1 when doing so) git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1573 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 3 +++ src/nano.h | 16 ++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index df649056..12ab1607 100644 --- a/ChangeLog +++ b/ChangeLog @@ -121,6 +121,9 @@ CVS code - the curses library included with SunOS 5.7-5.9. Also define KEY_SUSPEND as -1 if it isn't defined, in case it isn't in more than just Slang. (DLR) + - Define all potentially missing keys as different negative + values (ERR is -1, so use -2, -3, etc.) so as to avoid having + duplicate case values when keys are missing. (DLR) - move.c: - Remove unneeded inclusion of stdio.h, make various cleanups, and preserve the cursor's coordinates when paging up and down. diff --git a/src/nano.h b/src/nano.h index 7122fa0a..38d973b9 100644 --- a/src/nano.h +++ b/src/nano.h @@ -89,23 +89,27 @@ #define strncasecmp nstrnicmp #endif +/* Note: ERR is defined as -1, so to avoid duplicate case values when + some key definitions are missing, we have to set these all to + different negative values other than -1. */ + /* HP-UX 10 & 11 do not seem to support KEY_HOME and KEY_END */ #ifndef KEY_HOME -#define KEY_HOME -1 +#define KEY_HOME -2 #endif #ifndef KEY_END -#define KEY_END -1 +#define KEY_END -3 #endif /* Slang and SunOS 5.7-5.9 do not seem to support KEY_RESIZE */ #ifndef KEY_RESIZE -#define KEY_RESIZE -1 +#define KEY_RESIZE -4 #endif /* Slang does not seem to support KEY_SUSPEND */ #ifndef KEY_SUSPEND -#define KEY_SUSPEND -1 +#define KEY_SUSPEND -5 #endif /* Snatch these out of the ncurses defs, so we can use them in search @@ -338,8 +342,8 @@ typedef struct historyheadtype { #define NANO_ALT_BRACKET ']' #define NANO_ALT_SPACE ' ' -/* Some semi-changeable keybindings; don't play with unless you're sure you -know what you're doing */ +/* Some semi-changeable keybindings; don't play with unless you're sure + you know what you're doing */ #define NANO_INSERTFILE_KEY NANO_CONTROL_R #define NANO_INSERTFILE_FKEY KEY_F(5)