nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 48bd37812b798c8df9bc5d5d42f3f601eab02b85
parent 13f3017d0f8072842ecc1bd22ca3f849e13e0700
Author: Chris Allegretta <chrisa@asty.org>
Date:   Thu,  3 Jan 2002 21:26:34 +0000

- 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


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@964 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

Diffstat:
MChangeLog | 4++++
Mnano.1 | 5+++++
Mnano.c | 19++++++++++++++++---
Mnano.h | 1+
Mrcfile.c | 7++++---
5 files changed, 30 insertions(+), 6 deletions(-)

diff --git 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 @@ -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 @@ -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 @@ -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 @@ -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 */