- 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
This commit is contained in:
Chris Allegretta 2002-01-03 21:26:34 +00:00
parent 13f3017d0f
commit 48bd37812b
5 changed files with 30 additions and 6 deletions

View File

@ -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).

5
nano.1
View File

@ -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

19
nano.c
View File

@ -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();

1
nano.h
View File

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

View File

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