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
This commit is contained in:
Chris Allegretta 2001-01-14 03:17:53 +00:00
parent 1748cd1d0f
commit 201d9bf467
3 changed files with 44 additions and 4 deletions

View File

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

View File

@ -1,5 +1,6 @@
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<title>The nano editor FAQ</title>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.73 [en] (X11; U; Linux 2.2.16 i586) [Netscape]">
@ -66,8 +67,11 @@ my window.&nbsp;&nbsp; How can I fix that?</a></font>
<br><font color="#330000"><a href="#4.5">4.5. When I type in a
search string, the string I last searched for is already in front of
my cursor! !What happened?!</a></font>
<br><a href="#4.6">4.6 How do I make nano my default editor (in Pine,
mutt, etc.)?</a></blockquote>
<br><font color="#330000"><a href="#4.6">4.6. I get the message "NumLock
glitch detected. Keypad will malfunction without NumLock on." What
gives?</a></font>
<br><font color="#330000"><a href="#4.7">4.7. How do I make nano my
default editor (in Pine, mutt, etc.)?</a></font></blockquote>
<h2>
<font color="#330000"><a href="#5">5. Internationalization</a></font></h2>
@ -422,7 +426,26 @@ Meta-P while in nano (see the ^G help text for more
details).</font></blockquote>
<h2>
<a NAME="4.6"></a>4.6. How do I make nano my default editor (in Pine,
<a NAME="4.6"></a>I get the message "NumLock glitch detected. Keypad
will malfunction without NumLock on." What gives?</h2>
<blockquote>
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.
<br><br>
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 <A href="nano@nano-editor.org">nano@nano-editor.org</A>.
<br>&nbsp;</blockquote>
<h2>
<a NAME="4.7"></a>4.7. How do I make nano my default editor (in Pine,
mutt, etc)?</h2>
<blockquote>You need to make nano your $EDITOR.&nbsp; If you want this

15
nano.c
View File

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