From 201d9bf4679b010737047446d36a0a29989092bd Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Sun, 14 Jan 2001 03:17:53 +0000 Subject: [PATCH] Added print_numlock_warning(), code to figure out when numlock makes the keypad go bad. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@475 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 4 ++++ faq.html | 29 ++++++++++++++++++++++++++--- nano.c | 15 ++++++++++++++- 3 files changed, 44 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index feb4c889..6b269db4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,9 @@ General - Previous change to #ifdefs DISABLE_TABCOMP and NANO_SMALL rolled back. (Rocco) - Various #ifdef & #ifndef cleanups. (Rocco) + - Added message for when keypad goes awry. Added code in main and + function print_numlock_warning() to notify user, and added an + apropriate section in the faq to refer to this brokenness. - configure.in: - Fix for _use_keypad check breaking slang support (Christian Weisgerber). @@ -14,6 +17,7 @@ General - faq.html: - Added some info on making the binary smaller with the configure script. + - Added section on keypad bugginess. - files.c: real_dir_from_tilde() - Oops, fix case where buf ="~", silly crash (bug discovered by diff --git a/faq.html b/faq.html index af02eb8d..4e96418f 100644 --- a/faq.html +++ b/faq.html @@ -1,5 +1,6 @@ +The nano editor FAQ @@ -66,8 +67,11 @@ my window.   How can I fix that?
4.5. When I type in a search string, the string I last searched for is already in front of my cursor! !What happened?! -
4.6 How do I make nano my default editor (in Pine, -mutt, etc.)? +
4.6. I get the message "NumLock +glitch detected. Keypad will malfunction without NumLock on." What +gives? +
4.7. How do I make nano my +default editor (in Pine, mutt, etc.)?

5. Internationalization

@@ -422,7 +426,26 @@ Meta-P while in nano (see the ^G help text for more details).

-4.6. How do I make nano my default editor (in Pine, +I get the message "NumLock glitch detected. Keypad +will malfunction without NumLock on." What gives?

+ +
+Nano (actually almost all console editors do) has issues when cycling +the NumLock key in certain X terminals (rxvt, aterm, wterm, etc...). When +you switch NumLock on to off, you put the terminal into an "application +mode" that changes what sequences are sent by the keypad. These sequences +vary sufficiently from terminal to terminal that it is nearly impossible +to work around them from within nano. +

+In a nutshell, if you want to be able to use the keypad with the arrow and +page up/down functionality, you have to exit nano and reset your terminal +(presumably with "reset" or "stty sane" or similar) and then run nano +again with NumLock off. If you know an easier way to restore "normal +mode", please mail nano@nano-editor.org. +
 
+ +

+4.7. How do I make nano my default editor (in Pine, mutt, etc)?

You need to make nano your $EDITOR.  If you want this diff --git a/nano.c b/nano.c index 7b3dcdfc..d859148e 100644 --- a/nano.c +++ b/nano.c @@ -2028,6 +2028,17 @@ void do_toggle(int which) #endif } +/* If the NumLock key has made the keypad gone awry, print an error + message, hopefully we can address it later. */ +void print_numlock_warning(void) +{ + static int didmsg = 0; + if (!didmsg) { + statusbar(_("NumLock glitch detected. Keypad will malfunction without NumLock on")); + didmsg = 1; + } +} + /* This function returns the correct keystroke, given the A,B,C or D input key. This is a common sequence of many terms which send Esc-O-[A-D] or Esc-[-[A-D]. */ @@ -2297,7 +2308,9 @@ int main(int argc, char *argv[]) kbinput = wgetch(edit); if (kbinput <= 'D' && kbinput >= 'A') kbinput = ABCD(kbinput); - if (kbinput <= 'S' && kbinput >= 'P') + else if (kbinput <= 'z' && kbinput >= 'j') + print_numlock_warning(); + else if (kbinput <= 'S' && kbinput >= 'P') kbinput = KEY_F(kbinput - 79); #ifdef DEBUG else { -- 2.39.5