diff --git a/ChangeLog b/ChangeLog index a5e42347..208a4319 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,10 @@ CVS code - - Better integration of View mode (-v) and multibuffer. Fixes to new_file(), do_insertfile_void(), shortcut_init() (David Lawrence Ramsey). + - The keypad handling has changed (again). We now use + the keypad() function by default. New flag -K, --keypad + allows the old behavior for those using the keypad arrow keys + and rxvt-based terminals. - nano.c: die() - Only save files that were modified (David Lawrence Ramsey). diff --git a/nano.1 b/nano.1 index a67f6a9d..e2b79666 100644 --- a/nano.1 +++ b/nano.1 @@ -37,6 +37,11 @@ Write file in DOS format. .B \-F (\-\-multibuffer) Enable multiple file buffers (if available). .TP +.B \-K (\-\-keypad) +Do not use the ncurses keypad() call unless necessary. Try this flag if +you find that the arrow keys on the numeric keypad do not work for you +under nano. +.TP .B \-M (\-\-mac) Write file in Mac format. .TP diff --git a/nano.c b/nano.c index 06eb5dfc..2da10850 100644 --- a/nano.c +++ b/nano.c @@ -419,6 +419,8 @@ void usage(void) (_ (" -F --multibuffer Enable multiple file buffers\n")); #endif + printf(_ + (" -K --keypad Use alternate keypad routines\n")); #ifndef NANO_SMALL printf (_ @@ -493,14 +495,15 @@ void usage(void) #ifdef ENABLE_MULTIBUFFER printf(_(" -F Enable multiple file buffers\n")); #endif + printf(_(" -K Use alternate keypad routines\n\n")); #ifndef NANO_SMALL printf(_(" -M Write file in Mac format\n")); #endif - printf(_(" -T [num] Set width of a tab to num\n")); printf(_(" -R Use regular expressions for search\n")); #ifndef NANO_SMALL printf(_(" -S Smooth scrolling\n")); #endif + printf(_(" -T [num] Set width of a tab to num\n")); printf(_(" -V Print version information and exit\n")); printf(_(" -c Constantly show cursor position\n")); printf(_(" -h Show this message\n")); @@ -2710,6 +2713,8 @@ int main(int argc, char *argv[]) #ifndef NANO_SMALL {"smooth", 0, 0, 'S'}, #endif + {"keypad", 0, 0, 'K'}, + {0, 0, 0, 0} }; #endif @@ -2730,11 +2735,11 @@ int main(int argc, char *argv[]) #endif /* ENABLE_NANORC */ #ifdef HAVE_GETOPT_LONG - while ((optchr = getopt_long(argc, argv, "h?DFMRST:Vabcefgijklmo:pr:s:tvwxz", + while ((optchr = getopt_long(argc, argv, "h?DFKMRST:Vabcefgijklmo:pr:s:tvwxz", long_options, &option_index)) != EOF) { #else while ((optchr = - getopt(argc, argv, "h?DFMRST:Vabcefgijklmo:pr:s:tvwxz")) != EOF) { + getopt(argc, argv, "h?DFKMRST:Vabcefgijklmo:pr:s:tvwxz")) != EOF) { #endif switch (optchr) { @@ -2749,6 +2754,9 @@ int main(int argc, char *argv[]) SET(MULTIBUFFER); break; #endif + case 'K': + SET(ALT_KEYPAD); + break; #ifndef NANO_SMALL case 'M': SET(MAC_FILE); @@ -2926,6 +2934,11 @@ int main(int argc, char *argv[]) window_init(); mouse_init(); + if (!ISSET(ALT_KEYPAD)) { + keypad(edit, TRUE); + keypad(bottomwin, TRUE); + } + #ifdef ENABLE_COLOR do_colorinit(); diff --git a/nano.h b/nano.h index 7b4bb2a5..709fa0f3 100644 --- a/nano.h +++ b/nano.h @@ -165,6 +165,7 @@ typedef struct colortype { #define MAC_FILE (1<<22) #define SMOOTHSCROLL (1<<23) #define DISABLE_CURPOS (1<<24) /* Damn, we still need it */ +#define ALT_KEYPAD (1<<25) /* Damn, we still need it */ /* Control key sequences, changing these would be very very bad */ diff --git a/rcfile.c b/rcfile.c index 29ed1153..2655777f 100644 --- a/rcfile.c +++ b/rcfile.c @@ -40,9 +40,9 @@ #endif #ifndef DISABLE_WRAPJUSTIFY - #define NUM_RCOPTS 18 + #define NUM_RCOPTS 19 #else - #define NUM_RCOPTS 17 + #define NUM_RCOPTS 18 #endif /* Static stuff for the nanorc file */ @@ -69,7 +69,8 @@ rcoption rcopts[NUM_RCOPTS] = {"nohelp", NO_HELP}, {"suspend", SUSPEND}, {"multibuffer", MULTIBUFFER}, -{"smooth", SMOOTHSCROLL}}; +{"smooth", SMOOTHSCROLL}, +{"keypad", ALT_KEYPAD}}; /* We have an error in some part of the rcfile; put it on stderr and make the user hit return to continue starting up nano */