<a href="#4.4">4.4. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</a><br>
<a href="#4.5a">4.5a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</a><br>
<a href="#4.5b">4.5b. [version 1.2.2 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</a><br>
- <a href="#4.6">4.6. I get the message "NumLock glitch detected. Keypad will malfunction with NumLock off." What gives?</a><br>
- <a href="#4.7">4.7. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
- <a href="#4.8">4.8. I've compiled nano with color support, but I don't see any color when I run it!</a></p></blockquote>
+ <a href="#4.6">4.6. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
+ <a href="#4.7">4.7. I've compiled nano with color support, but I don't see any color when I run it!</a></p></blockquote>
<h2><a href="#5">5. Internationalization</a></h2>
<blockquote><p><a href="#5.1">5.1. There's no translation for my language!</a><br>
<a href="#5.2">5.2. I don't like the translation for <x> in my language. How can I fix it?</a></p></blockquote>
<blockquote><p>In nano version 0.9.20, the default is to have a completely consistent user interface across all user input functions. This means that regardless of whether you're being asked for a filename to insert or write, or a string to search for, the previous value is already inserted before the cursor. If you prefer the old behavior, use the Pico emulation mode (-p or --pico) or just hit Meta-P while in nano (see the ^G help text for more details).</p></blockquote>
<h2><a name="4.5b"></a>4.5b. [version 1.2.2 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</h2>
<blockquote><p>It was decided that consistency was nice, but people are used to Pico's inconsistent behavior. Also, in version 1.1.99pre1, search and replace history was introduced. If you wish to edit your previous search/replace entry (or any previous entry), you can do so by hitting the up arrow to cycle through your history. This method allows the best of both worlds: You don't need to erase the previous string if you want to enter a new one, but you can with one keystroke recall previous entries for editing. Therefore there is now no "Pico mode", nano is and has always been a Pico <b>clone</b>, and clones by default should be compatible.</p></blockquote>
-<h2><a name="4.6"></a>4.6. I get the message "NumLock glitch detected. Keypad will malfunction with NumLock off." What gives?</h2>
-<blockquote><p>Nano (and actually almost all console editors) has issues when cycling the NumLock key in certain X terminals (rxvt, aterm, wterm, etc...). When you switch NumLock from 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.</p>
- <p>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="mailto:nano@nano-editor.org">nano@nano-editor.org</a>.</p></blockquote>
-<h2><a name="4.7"></a>4.7. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
+<h2><a name="4.6"></a>4.6. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
<blockquote><p>You need to make nano your $EDITOR. If you want this to be saved, you should put a line like this in your <b>.bashrc</b> if you use bash (or <b>.zshrc</b> if you believe in zsh):</p>
<p><b>export EDITOR=/usr/local/bin/nano</b></p>
<p>or if you use tcsh put this in your <b>.cshrc</b> file:</p>
<p>Mutt users should see an effect immediately the next time you log in, no further configuration is needed. However, if you want to let people know you use nano to compose your email messages, you can put a line like this in your <b>.muttrc</b>:</p>
<p><b>my_hdr X-Composer: nano x.y.z</b></p>
<p>Again, replace x.y.z with the version of nano you use.</p></blockquote>
-<h2><a name="4.8"></a>4.8. I've compiled nano with color support, but I don't see any color when I run it!</h2>
+<h2><a name="4.7"></a>4.7. I've compiled nano with color support, but I don't see any color when I run it!</h2>
<blockquote><p>If you want nano to actually use color, you have to specify the color configurations you want it to use in your .nanorc. Some example configurations are in the <b>nanorc.sample</b> that comes with the nano source or your nano package. See Section <a href="#3.9">3.9</a>.</p></blockquote>
<hr width="100%">
<h1><a name="5"></a>5. Internationalization</h1>
<h2><a name="8"></a>8. ChangeLog</h2>
<blockquote>
<p>
+2004/04/07 - Removed NumLock glitch question, as it's no longer needed. (DLR)<br>
2004/01/30 - Fixed inaccuracy: multibuffer mode was first in nano 1.1.0, not 1.1.12. (DLR)<br>
2003/12/31 - Added question about the new verbatim input function, and a few minor fixes. Removed reference to "set pico" (DLR).<br>
2003/07/02 - Added question about nano's not showing color when it's compiled with color support (DLR; suggested by Jordi).<br>
we call statusbar(), before we
actually blank the statusbar */
+/* Note on the following input routines: VT100s and derived terminals
+ * generate Ctrl-H for Backspace and Ctrl-? (Ctrl-8) for Delete, while
+ * VT220s/VT320s and derived terminals generate Ctrl-? (Ctrl-8) for
+ * Backspace (VT320 only) and Esc [ 3 ~ for Delete (VT220/VT320). The
+ * FreeBSD console is VT100-derived, but sometimes xterm wrongly assumes
+ * it's VT220/VT320-derived. The workarounds for the problems that this
+ * causes, in get_accepted_kbinput() and get_escape_seq_kbinput(), are
+ * indicated by the comments beginning with "Terminal breakage". */
+
/* Read in a single input character. If it's ignored, swallow it and go
* on. Otherwise, try to translate it from ASCII, extended keypad
* values, and/or escape sequences. Supported extended keypad values
* consist of [arrow key], Ctrl-[arrow key], Shift-[arrow key], Enter,
- * Backspace, Insert, Delete, Home, End, PageUp, PageDown, and F1-F14.
- * Assume nodelay(win) is FALSE. */
+ * Backspace, the editing keypad (Insert, Delete, Home, End, PageUp, and
+ * PageDown), the function keypad (F1-F14), and the numeric keypad with
+ * NumLock off. Assume nodelay(win) is FALSE. */
int get_kbinput(WINDOW *win, int *meta_key)
{
int kbinput, retval;
kbinput = wgetch(win);
switch (kbinput) {
case ERR:
+#ifdef KEY_RESIZE
+ /* Slang and SunOS 5.7-5.9 don't support KEY_RESIZE. */
case KEY_RESIZE:
+#endif
#ifdef PDCURSES
case KEY_SHIFT_L:
case KEY_SHIFT_R:
break;
case 'O':
case 'o':
- /* Terminal breakage, part 1: We shouldn't get an escape
- * sequence here for terminals that support Delete, but
- * we do sometimes on FreeBSD. Thank you, Wouter van
- * Hemel. */
+ /* Terminal breakage, part 1: When Delete is pressed,
+ * xterm generates the VT220/VT320 sequence, Esc [ 3 ~,
+ * for it instead of the VT100 sequence, Ctrl-?
+ * (Ctrl-8). Work around this by always interpreting
+ * the VT220/VT320 sequence as Delete. Thank you,
+ * Wouter van Hemel. */
case '[':
{
int old_kbinput = kbinput, *escape_seq;
}
break;
case NANO_CONTROL_8:
- /* Terminal breakage, part 2: We shouldn't get Ctrl-8
- * (Ctrl-?) for Backspace or Delete, but we do sometimes. */
+ /* Terminal breakage, part 2: When Backspace is pressed,
+ * xterm generates the VT320 sequence, Ctrl-? (Ctrl-8), for
+ * it instead of the VT100 sequence, Ctrl-H. Work around
+ * this by interpreting the VT320 sequence as Delete when
+ * REBIND_DELETE isn't set, and as Backspace when it is. */
kbinput = ISSET(REBIND_DELETE) ? NANO_DELETE_KEY : NANO_BACKSPACE_KEY;
break;
case KEY_DOWN:
case KEY_RIGHT:
kbinput = NANO_FORWARD_KEY;
break;
+#ifdef KEY_HOME
+ /* HP-UX 10 and 11 don't support KEY_HOME. */
case KEY_HOME:
kbinput = NANO_HOME_KEY;
break;
+#endif
case KEY_BACKSPACE:
kbinput = NANO_BACKSPACE_KEY;
break;
case KEY_DC:
- /* Terminal breakage, part 3: We should only get KEY_DC when
- * hitting Delete, but we get it when hitting Backspace
- * sometimes on FreeBSD. Thank you, Lee Nelson. */
+ /* Terminal breakage, part 3: When Backspace is pressed,
+ * xterm generates the VT320 sequence, Ctrl-? (Ctrl-8), for
+ * it instead of the VT100 sequence, Ctrl-H. Ctrl-?
+ * (Ctrl-8) then gets translated into the keypad value
+ * KEY_DC. Work around this by interpreting KEY_DC as
+ * Delete when REBIND_DELETE isn't set, and as Backspace
+ * when it is. Thank you, Lee Nelson. */
kbinput = ISSET(REBIND_DELETE) ? NANO_BACKSPACE_KEY : NANO_DELETE_KEY;
break;
case KEY_IC:
case KEY_ENTER:
kbinput = NANO_ENTER_KEY;
break;
+ case KEY_B2: /* Center (5) on numeric keypad with NumLock off
+ * on xterm. */
+#ifdef KEY_BEG
+ /* Slang doesn't support KEY_BEG. */
+ case KEY_BEG: /* Center (5) on numeric keypad with NumLock off
+ * on Eterm. */
+#endif
+ kbinput = '5';
+ break;
+#ifdef KEY_END
+ /* HP-UX 10 and 11 don't support KEY_END. */
case KEY_END:
kbinput = NANO_END_KEY;
break;
+#endif
+#ifdef KEY_SUSPEND
+ /* Slang doesn't support KEY_SUSPEND. */
case KEY_SUSPEND:
kbinput = NANO_SUSPEND_KEY;
break;
+#endif
+#ifdef KEY_SLEFT
+ /* Slang doesn't support KEY_SLEFT. */
case KEY_SLEFT:
kbinput = NANO_BACK_KEY;
break;
+#endif
+#ifdef KEY_SRIGHT
+ /* Slang doesn't support KEY_SRIGHT. */
case KEY_SRIGHT:
kbinput = NANO_FORWARD_KEY;
break;
+#endif
}
#ifdef DEBUG
fprintf(stderr, "get_accepted_kbinput(): kbinput = %d, meta_key = %d\n", kbinput, *meta_key);
* There are several escape sequence conflicts and omissions, outlined
* as follows:
*
+ * - PageDown on FreeBSD console == Center (5) on numeric keypad with
+ * NumLock off on Linux console. (The editing keypad key is more
+ * important to have working than the numeric keypad key, because the
+ * latter actually has no value when NumLock is off.)
* - F1 on FreeBSD console == kmous on xterm/rxvt/Eterm; the latter is
* omitted. (Mouse input will only work properly if the extended
* keypad value KEY_MOUSE is generated on mouse events instead of the
* kmous escape sequence.)
* - F9 on FreeBSD console == PageDown on Hurd console; the former is
- * omitted. (The editing keypad, consisting of Insert, Delete, Home,
- * End, PageUp, and PageDown, is more important to have working than
- * the function keys, because the functions of the former are not
+ * omitted. (The editing keypad is more important to have working
+ * than the function keys, because the functions of the former are not
* arbitrary and the functions of the latter are.)
* - F10 on FreeBSD console == PageUp on Hurd console; the former is
* omitted. (Same as above.)
* - F13 on FreeBSD console == End on Hurd console; the former is
* omitted. (Same as above.)
- * - The Hurd console has no escape sequences for F11, F12, F13, or
- * F14. */
+ * - The Hurd console has no escape sequences for F11, F12, F13, F14, or
+ * Center (5) on the numeric keypad with NumLock off.
+ *
+ * Note that Center (5) on the numeric keypad with NumLock off can be
+ * either kb2 or kbeg, or both. */
int get_escape_seq_kbinput(WINDOW *win, int *escape_seq, size_t
escape_seq_len)
{
case 'D': /* Esc O D == Left on xterm. */
kbinput = get_escape_seq_abcd(escape_seq[1]);
break;
+ case 'E': /* Esc O E == Center (5) on numeric keypad
+ * with NumLock off on xterm. */
+ kbinput = '5';
+ break;
case 'F': /* Esc O F == End on xterm. */
kbinput = NANO_END_KEY;
break;
case 'H': /* Esc O H == Home on xterm. */
kbinput = NANO_HOME_KEY;
break;
+ case 'M': /* Esc O M == Enter on numeric keypad with
+ * NumLock off on xterm/Eterm. */
+ kbinput = NANO_ENTER_KEY;
+ break;
case 'P': /* Esc O P == F1 on Hurd console. */
kbinput = KEY_F(1);
break;
case 'd': /* Esc O d == Ctrl-Left on rxvt. */
kbinput = get_escape_seq_abcd(escape_seq[1]);
break;
+ case 'j': /* Esc O j == '*' on numeric keypad with
+ * NumLock off on xterm/rxvt. */
+ kbinput = '*';
+ break;
+ case 'k': /* Esc O k == '+' on numeric keypad with
+ * NumLock off on xterm/rxvt. */
+ kbinput = '+';
+ break;
+ case 'l': /* Esc O l == ',' on numeric keypad with
+ * NumLock off on xterm/rxvt. */
+ kbinput = '+';
+ break;
+ case 'm': /* Esc O m == '-' on numeric keypad with
+ * NumLock off on xterm/rxvt. */
+ kbinput = '-';
+ break;
+ case 'n': /* Esc O n == Delete (.) on numeric keypad
+ * with NumLock off on rxvt. */
+ kbinput = NANO_DELETE_KEY;
+ break;
+ case 'o': /* Esc O o == '/' on numeric keypad with
+ * NumLock off on xterm/rxvt. */
+ kbinput = '/';
+ break;
+ case 'p': /* Esc O p == Insert (0) on numeric keypad
+ * with NumLock off on rxvt. */
+ kbinput = NANO_INSERTFILE_KEY;
+ break;
+ case 'q': /* Esc O q == End (1) on numeric keypad
+ * with NumLock off on rxvt. */
+ kbinput = NANO_END_KEY;
+ break;
+ case 'r': /* Esc O r == Down (2) on numeric keypad
+ * with NumLock off on rxvt. */
+ kbinput = NANO_NEXTLINE_KEY;
+ break;
+ case 's': /* Esc O s == PageDown (3) on numeric
+ * keypad with NumLock off on rxvt. */
+ kbinput = NANO_NEXTPAGE_KEY;
+ break;
+ case 't': /* Esc O t == Left (4) on numeric keypad
+ * with NumLock off on rxvt. */
+ kbinput = NANO_BACK_KEY;
+ break;
+ case 'u': /* Esc O u == Center (5) on numeric keypad
+ * with NumLock off on rxvt/Eterm. */
+ kbinput = '5';
+ break;
+ case 'v': /* Esc O v == Right (6) on numeric keypad
+ * with NumLock off on rxvt. */
+ kbinput = NANO_FORWARD_KEY;
+ break;
+ case 'w': /* Esc O w == Home (7) on numeric keypad
+ * with NumLock off on rxvt. */
+ kbinput = NANO_HOME_KEY;
+ break;
+ case 'x': /* Esc O x == Up (8) on numeric keypad
+ * with NumLock off on rxvt. */
+ kbinput = NANO_PREVLINE_KEY;
+ break;
+ case 'y': /* Esc O y == PageUp (9) on numeric keypad
+ * with NumLock off on rxvt. */
+ kbinput = NANO_PREVPAGE_KEY;
+ break;
}
break;
case 'o':
* console/rxvt/Eterm. */
kbinput = get_escape_seq_abcd(escape_seq[1]);
break;
+ case 'E': /* Esc [ E == Center (5) on numeric keypad
+ * with NumLock off on FreeBSD console. */
+ kbinput = '5';
+ break;
case 'F': /* Esc [ F == End on FreeBSD
* console/Eterm. */
kbinput = NANO_END_KEY;
break;
case 'G': /* Esc [ G == PageDown on FreeBSD
- * console. */
+ * console. */
kbinput = NANO_NEXTPAGE_KEY;
break;
case 'H': /* Esc [ H == Home on FreeBSD