work around the NumLock glitch
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1718 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
805547fed0
commit
0a25808f34
14
ChangeLog
14
ChangeLog
|
@ -6,6 +6,9 @@ CVS code -
|
||||||
- Make sure the special control keys are handled the same way
|
- Make sure the special control keys are handled the same way
|
||||||
after the window is resized or we come out of suspend mode.
|
after the window is resized or we come out of suspend mode.
|
||||||
Changes to do_cont() and handle_sigwinch(). (DLR)
|
Changes to do_cont() and handle_sigwinch(). (DLR)
|
||||||
|
- Add better explanations for and in the "Terminal breakage"
|
||||||
|
comments, and handle missing key #ifdefs inside the functions
|
||||||
|
that use those keys. (DLR)
|
||||||
- files.c:
|
- files.c:
|
||||||
add_open_file()
|
add_open_file()
|
||||||
- Rearrange the NANO_SMALL #ifdef so that the code to set the
|
- Rearrange the NANO_SMALL #ifdef so that the code to set the
|
||||||
|
@ -14,6 +17,9 @@ CVS code -
|
||||||
- nano.c:
|
- nano.c:
|
||||||
do_delete()
|
do_delete()
|
||||||
- Tweak for efficiency. (David Benbennick)
|
- Tweak for efficiency. (David Benbennick)
|
||||||
|
print_numlock_warning()
|
||||||
|
- Removed, as it's no longer needed and was never called
|
||||||
|
anywhere after the input overhaul. (DLR)
|
||||||
do_verbatim_kbinput()
|
do_verbatim_kbinput()
|
||||||
- Use size_t's instead of ints for the get_verbatim_kbinput()
|
- Use size_t's instead of ints for the get_verbatim_kbinput()
|
||||||
call and the loop that ungetch()es its returned int*,
|
call and the loop that ungetch()es its returned int*,
|
||||||
|
@ -48,14 +54,22 @@ CVS code -
|
||||||
- When reading characters from input, properly reallocate
|
- When reading characters from input, properly reallocate
|
||||||
verbatim_kbinput via (int*)nrealloc() instead of an uncast
|
verbatim_kbinput via (int*)nrealloc() instead of an uncast
|
||||||
realloc(). (DLR)
|
realloc(). (DLR)
|
||||||
|
get_accepted_kbinput()
|
||||||
|
- Add proper support for the keypad values and escape sequences
|
||||||
|
generated by the NumLock glitch. (DLR)
|
||||||
get_escape_seq_kbinput()
|
get_escape_seq_kbinput()
|
||||||
- Change escape_seq_len from an int to a size_t, since it should
|
- Change escape_seq_len from an int to a size_t, since it should
|
||||||
never be negative. (DLR)
|
never be negative. (DLR)
|
||||||
|
- Add proper support for the keypad values and escape sequences
|
||||||
|
generated by the NumLock glitch. (DLR)
|
||||||
edit_refresh()
|
edit_refresh()
|
||||||
- Remove apparently unneeded leaveok() calls. (David Benbennick)
|
- Remove apparently unneeded leaveok() calls. (David Benbennick)
|
||||||
- nano.texi:
|
- nano.texi:
|
||||||
- Fix inaccuracies: Meta-L now toggles line wrapping, and Meta-<
|
- Fix inaccuracies: Meta-L now toggles line wrapping, and Meta-<
|
||||||
and Meta-> aren't toggles. (DLR)
|
and Meta-> aren't toggles. (DLR)
|
||||||
|
- faq.html:
|
||||||
|
- Removed question about the NumLock glitch, as it's no longer
|
||||||
|
needed. (DLR)
|
||||||
|
|
||||||
GNU nano 1.3.2 - 2004.03.31
|
GNU nano 1.3.2 - 2004.03.31
|
||||||
- General:
|
- General:
|
||||||
|
|
13
doc/faq.html
13
doc/faq.html
|
@ -38,9 +38,8 @@
|
||||||
<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.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.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.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.6">4.6. How do I make nano my default editor (in Pine, mutt, etc.)?</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.7">4.7. I've compiled nano with color support, but I don't see any color when I run it!</a></p></blockquote>
|
||||||
<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>
|
|
||||||
<h2><a href="#5">5. Internationalization</a></h2>
|
<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>
|
<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>
|
<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>
|
||||||
|
@ -183,10 +182,7 @@
|
||||||
<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>
|
<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>
|
<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>
|
<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>
|
<h2><a name="4.6"></a>4.6. How do I make nano my default editor (in Pine, mutt, etc.)?</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>
|
|
||||||
<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>
|
<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><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>or if you use tcsh put this in your <b>.cshrc</b> file:</p>
|
||||||
|
@ -199,7 +195,7 @@
|
||||||
<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>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><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>
|
<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>
|
<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%">
|
<hr width="100%">
|
||||||
<h1><a name="5"></a>5. Internationalization</h1>
|
<h1><a name="5"></a>5. Internationalization</h1>
|
||||||
|
@ -241,6 +237,7 @@
|
||||||
<h2><a name="8"></a>8. ChangeLog</h2>
|
<h2><a name="8"></a>8. ChangeLog</h2>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p>
|
<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>
|
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/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>
|
2003/07/02 - Added question about nano's not showing color when it's compiled with color support (DLR; suggested by Jordi).<br>
|
||||||
|
|
12
src/nano.c
12
src/nano.c
|
@ -2971,18 +2971,6 @@ void allow_pending_sigwinch(int allow)
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_SMALL */
|
||||||
|
|
||||||
/* If the NumLock key has made the keypad go 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 with NumLock off"));
|
|
||||||
didmsg = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
void do_toggle(const toggle *which)
|
void do_toggle(const toggle *which)
|
||||||
{
|
{
|
||||||
|
|
36
src/nano.h
36
src/nano.h
|
@ -105,34 +105,6 @@
|
||||||
* all of the special sentinel values below, to different negative
|
* all of the special sentinel values below, to different negative
|
||||||
* values other than -1. */
|
* values other than -1. */
|
||||||
|
|
||||||
/* HP-UX 10 & 11 do not seem to support KEY_HOME and KEY_END. */
|
|
||||||
#ifndef KEY_HOME
|
|
||||||
#define KEY_HOME -2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef KEY_END
|
|
||||||
#define KEY_END -3
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Slang and SunOS 5.7-5.9 do not seem to support KEY_RESIZE. */
|
|
||||||
#ifndef KEY_RESIZE
|
|
||||||
#define KEY_RESIZE -4
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Slang does not seem to support KEY_SUSPEND, KEY_SLEFT, or
|
|
||||||
* KEY_SRIGHT. */
|
|
||||||
#ifndef KEY_SUSPEND
|
|
||||||
#define KEY_SUSPEND -5
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef KEY_SLEFT
|
|
||||||
#define KEY_SLEFT -6
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef KEY_SRIGHT
|
|
||||||
#define KEY_SRIGHT -7
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define VERMSG "GNU nano " VERSION
|
#define VERMSG "GNU nano " VERSION
|
||||||
|
|
||||||
/* If we aren't using ncurses, turn the mouse support off, as it's
|
/* If we aren't using ncurses, turn the mouse support off, as it's
|
||||||
|
@ -366,13 +338,13 @@ typedef struct historyheadtype {
|
||||||
#define NANO_ALT_SPACE ' '
|
#define NANO_ALT_SPACE ' '
|
||||||
|
|
||||||
/* Some semi-changeable keybindings; don't play with these unless you're
|
/* Some semi-changeable keybindings; don't play with these unless you're
|
||||||
* sure you know what you're doing. */
|
* sure you know what you're doing. Assume ERR is defined as -1. */
|
||||||
|
|
||||||
/* No key at all. */
|
/* No key at all. */
|
||||||
#define NANO_NO_KEY -8
|
#define NANO_NO_KEY -2
|
||||||
|
|
||||||
/* Special sentinel key used for search string history. */
|
/* Special sentinel key used for search/replace history. */
|
||||||
#define NANO_HISTORY_KEY -9
|
#define NANO_HISTORY_KEY -3
|
||||||
|
|
||||||
/* Normal keys. */
|
/* Normal keys. */
|
||||||
#define NANO_INSERTFILE_KEY NANO_CONTROL_R
|
#define NANO_INSERTFILE_KEY NANO_CONTROL_R
|
||||||
|
|
|
@ -341,7 +341,6 @@ RETSIGTYPE do_cont(int signal);
|
||||||
void handle_sigwinch(int s);
|
void handle_sigwinch(int s);
|
||||||
void allow_pending_sigwinch(int allow);
|
void allow_pending_sigwinch(int allow);
|
||||||
#endif
|
#endif
|
||||||
void print_numlock_warning(void);
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
void do_toggle(const toggle *which);
|
void do_toggle(const toggle *which);
|
||||||
#endif
|
#endif
|
||||||
|
|
162
src/winio.c
162
src/winio.c
|
@ -38,12 +38,22 @@ static int statblank = 0; /* Number of keystrokes left after
|
||||||
we call statusbar(), before we
|
we call statusbar(), before we
|
||||||
actually blank the statusbar */
|
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
|
/* Read in a single input character. If it's ignored, swallow it and go
|
||||||
* on. Otherwise, try to translate it from ASCII, extended keypad
|
* on. Otherwise, try to translate it from ASCII, extended keypad
|
||||||
* values, and/or escape sequences. Supported extended keypad values
|
* values, and/or escape sequences. Supported extended keypad values
|
||||||
* consist of [arrow key], Ctrl-[arrow key], Shift-[arrow key], Enter,
|
* consist of [arrow key], Ctrl-[arrow key], Shift-[arrow key], Enter,
|
||||||
* Backspace, Insert, Delete, Home, End, PageUp, PageDown, and F1-F14.
|
* Backspace, the editing keypad (Insert, Delete, Home, End, PageUp, and
|
||||||
* Assume nodelay(win) is FALSE. */
|
* 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 get_kbinput(WINDOW *win, int *meta_key)
|
||||||
{
|
{
|
||||||
int kbinput, retval;
|
int kbinput, retval;
|
||||||
|
@ -134,7 +144,10 @@ int get_ignored_kbinput(WINDOW *win)
|
||||||
kbinput = wgetch(win);
|
kbinput = wgetch(win);
|
||||||
switch (kbinput) {
|
switch (kbinput) {
|
||||||
case ERR:
|
case ERR:
|
||||||
|
#ifdef KEY_RESIZE
|
||||||
|
/* Slang and SunOS 5.7-5.9 don't support KEY_RESIZE. */
|
||||||
case KEY_RESIZE:
|
case KEY_RESIZE:
|
||||||
|
#endif
|
||||||
#ifdef PDCURSES
|
#ifdef PDCURSES
|
||||||
case KEY_SHIFT_L:
|
case KEY_SHIFT_L:
|
||||||
case KEY_SHIFT_R:
|
case KEY_SHIFT_R:
|
||||||
|
@ -190,10 +203,12 @@ int get_accepted_kbinput(WINDOW *win, int kbinput, int *meta_key)
|
||||||
break;
|
break;
|
||||||
case 'O':
|
case 'O':
|
||||||
case 'o':
|
case 'o':
|
||||||
/* Terminal breakage, part 1: We shouldn't get an escape
|
/* Terminal breakage, part 1: When Delete is pressed,
|
||||||
* sequence here for terminals that support Delete, but
|
* xterm generates the VT220/VT320 sequence, Esc [ 3 ~,
|
||||||
* we do sometimes on FreeBSD. Thank you, Wouter van
|
* for it instead of the VT100 sequence, Ctrl-?
|
||||||
* Hemel. */
|
* (Ctrl-8). Work around this by always interpreting
|
||||||
|
* the VT220/VT320 sequence as Delete. Thank you,
|
||||||
|
* Wouter van Hemel. */
|
||||||
case '[':
|
case '[':
|
||||||
{
|
{
|
||||||
int old_kbinput = kbinput, *escape_seq;
|
int old_kbinput = kbinput, *escape_seq;
|
||||||
|
@ -222,8 +237,11 @@ int get_accepted_kbinput(WINDOW *win, int kbinput, int *meta_key)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NANO_CONTROL_8:
|
case NANO_CONTROL_8:
|
||||||
/* Terminal breakage, part 2: We shouldn't get Ctrl-8
|
/* Terminal breakage, part 2: When Backspace is pressed,
|
||||||
* (Ctrl-?) for Backspace or Delete, but we do sometimes. */
|
* 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;
|
kbinput = ISSET(REBIND_DELETE) ? NANO_DELETE_KEY : NANO_BACKSPACE_KEY;
|
||||||
break;
|
break;
|
||||||
case KEY_DOWN:
|
case KEY_DOWN:
|
||||||
|
@ -238,16 +256,23 @@ int get_accepted_kbinput(WINDOW *win, int kbinput, int *meta_key)
|
||||||
case KEY_RIGHT:
|
case KEY_RIGHT:
|
||||||
kbinput = NANO_FORWARD_KEY;
|
kbinput = NANO_FORWARD_KEY;
|
||||||
break;
|
break;
|
||||||
|
#ifdef KEY_HOME
|
||||||
|
/* HP-UX 10 and 11 don't support KEY_HOME. */
|
||||||
case KEY_HOME:
|
case KEY_HOME:
|
||||||
kbinput = NANO_HOME_KEY;
|
kbinput = NANO_HOME_KEY;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case KEY_BACKSPACE:
|
case KEY_BACKSPACE:
|
||||||
kbinput = NANO_BACKSPACE_KEY;
|
kbinput = NANO_BACKSPACE_KEY;
|
||||||
break;
|
break;
|
||||||
case KEY_DC:
|
case KEY_DC:
|
||||||
/* Terminal breakage, part 3: We should only get KEY_DC when
|
/* Terminal breakage, part 3: When Backspace is pressed,
|
||||||
* hitting Delete, but we get it when hitting Backspace
|
* xterm generates the VT320 sequence, Ctrl-? (Ctrl-8), for
|
||||||
* sometimes on FreeBSD. Thank you, Lee Nelson. */
|
* 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;
|
kbinput = ISSET(REBIND_DELETE) ? NANO_BACKSPACE_KEY : NANO_DELETE_KEY;
|
||||||
break;
|
break;
|
||||||
case KEY_IC:
|
case KEY_IC:
|
||||||
|
@ -262,18 +287,39 @@ int get_accepted_kbinput(WINDOW *win, int kbinput, int *meta_key)
|
||||||
case KEY_ENTER:
|
case KEY_ENTER:
|
||||||
kbinput = NANO_ENTER_KEY;
|
kbinput = NANO_ENTER_KEY;
|
||||||
break;
|
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:
|
case KEY_END:
|
||||||
kbinput = NANO_END_KEY;
|
kbinput = NANO_END_KEY;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#ifdef KEY_SUSPEND
|
||||||
|
/* Slang doesn't support KEY_SUSPEND. */
|
||||||
case KEY_SUSPEND:
|
case KEY_SUSPEND:
|
||||||
kbinput = NANO_SUSPEND_KEY;
|
kbinput = NANO_SUSPEND_KEY;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#ifdef KEY_SLEFT
|
||||||
|
/* Slang doesn't support KEY_SLEFT. */
|
||||||
case KEY_SLEFT:
|
case KEY_SLEFT:
|
||||||
kbinput = NANO_BACK_KEY;
|
kbinput = NANO_BACK_KEY;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#ifdef KEY_SRIGHT
|
||||||
|
/* Slang doesn't support KEY_SRIGHT. */
|
||||||
case KEY_SRIGHT:
|
case KEY_SRIGHT:
|
||||||
kbinput = NANO_FORWARD_KEY;
|
kbinput = NANO_FORWARD_KEY;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "get_accepted_kbinput(): kbinput = %d, meta_key = %d\n", kbinput, *meta_key);
|
fprintf(stderr, "get_accepted_kbinput(): kbinput = %d, meta_key = %d\n", kbinput, *meta_key);
|
||||||
|
@ -357,21 +403,27 @@ int get_ascii_kbinput(WINDOW *win, int kbinput)
|
||||||
* There are several escape sequence conflicts and omissions, outlined
|
* There are several escape sequence conflicts and omissions, outlined
|
||||||
* as follows:
|
* 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
|
* - F1 on FreeBSD console == kmous on xterm/rxvt/Eterm; the latter is
|
||||||
* omitted. (Mouse input will only work properly if the extended
|
* omitted. (Mouse input will only work properly if the extended
|
||||||
* keypad value KEY_MOUSE is generated on mouse events instead of the
|
* keypad value KEY_MOUSE is generated on mouse events instead of the
|
||||||
* kmous escape sequence.)
|
* kmous escape sequence.)
|
||||||
* - F9 on FreeBSD console == PageDown on Hurd console; the former is
|
* - F9 on FreeBSD console == PageDown on Hurd console; the former is
|
||||||
* omitted. (The editing keypad, consisting of Insert, Delete, Home,
|
* omitted. (The editing keypad is more important to have working
|
||||||
* End, PageUp, and PageDown, is more important to have working than
|
* than the function keys, because the functions of the former are not
|
||||||
* the function keys, because the functions of the former are not
|
|
||||||
* arbitrary and the functions of the latter are.)
|
* arbitrary and the functions of the latter are.)
|
||||||
* - F10 on FreeBSD console == PageUp on Hurd console; the former is
|
* - F10 on FreeBSD console == PageUp on Hurd console; the former is
|
||||||
* omitted. (Same as above.)
|
* omitted. (Same as above.)
|
||||||
* - F13 on FreeBSD console == End on Hurd console; the former is
|
* - F13 on FreeBSD console == End on Hurd console; the former is
|
||||||
* omitted. (Same as above.)
|
* omitted. (Same as above.)
|
||||||
* - The Hurd console has no escape sequences for F11, F12, F13, or
|
* - The Hurd console has no escape sequences for F11, F12, F13, F14, or
|
||||||
* F14. */
|
* 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
|
int get_escape_seq_kbinput(WINDOW *win, int *escape_seq, size_t
|
||||||
escape_seq_len)
|
escape_seq_len)
|
||||||
{
|
{
|
||||||
|
@ -401,12 +453,20 @@ int get_escape_seq_kbinput(WINDOW *win, int *escape_seq, size_t
|
||||||
case 'D': /* Esc O D == Left on xterm. */
|
case 'D': /* Esc O D == Left on xterm. */
|
||||||
kbinput = get_escape_seq_abcd(escape_seq[1]);
|
kbinput = get_escape_seq_abcd(escape_seq[1]);
|
||||||
break;
|
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. */
|
case 'F': /* Esc O F == End on xterm. */
|
||||||
kbinput = NANO_END_KEY;
|
kbinput = NANO_END_KEY;
|
||||||
break;
|
break;
|
||||||
case 'H': /* Esc O H == Home on xterm. */
|
case 'H': /* Esc O H == Home on xterm. */
|
||||||
kbinput = NANO_HOME_KEY;
|
kbinput = NANO_HOME_KEY;
|
||||||
break;
|
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. */
|
case 'P': /* Esc O P == F1 on Hurd console. */
|
||||||
kbinput = KEY_F(1);
|
kbinput = KEY_F(1);
|
||||||
break;
|
break;
|
||||||
|
@ -443,6 +503,70 @@ int get_escape_seq_kbinput(WINDOW *win, int *escape_seq, size_t
|
||||||
case 'd': /* Esc O d == Ctrl-Left on rxvt. */
|
case 'd': /* Esc O d == Ctrl-Left on rxvt. */
|
||||||
kbinput = get_escape_seq_abcd(escape_seq[1]);
|
kbinput = get_escape_seq_abcd(escape_seq[1]);
|
||||||
break;
|
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;
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
|
@ -614,12 +738,16 @@ int get_escape_seq_kbinput(WINDOW *win, int *escape_seq, size_t
|
||||||
* console/rxvt/Eterm. */
|
* console/rxvt/Eterm. */
|
||||||
kbinput = get_escape_seq_abcd(escape_seq[1]);
|
kbinput = get_escape_seq_abcd(escape_seq[1]);
|
||||||
break;
|
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
|
case 'F': /* Esc [ F == End on FreeBSD
|
||||||
* console/Eterm. */
|
* console/Eterm. */
|
||||||
kbinput = NANO_END_KEY;
|
kbinput = NANO_END_KEY;
|
||||||
break;
|
break;
|
||||||
case 'G': /* Esc [ G == PageDown on FreeBSD
|
case 'G': /* Esc [ G == PageDown on FreeBSD
|
||||||
* console. */
|
* console. */
|
||||||
kbinput = NANO_NEXTPAGE_KEY;
|
kbinput = NANO_NEXTPAGE_KEY;
|
||||||
break;
|
break;
|
||||||
case 'H': /* Esc [ H == Home on FreeBSD
|
case 'H': /* Esc [ H == Home on FreeBSD
|
||||||
|
|
Loading…
Reference in New Issue