readd the option to turn the keypad off by default from nano 1.2.x, with

a few tweaks


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2980 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2005-08-10 21:22:15 +00:00
parent abd8993660
commit 057edf7384
7 changed files with 68 additions and 44 deletions

View File

@ -142,6 +142,11 @@ CVS code -
entire range of Unicode. Changes to make_mbchar(),
is_valid_unicode(), parse_kbinput(), get_unicode_kbinput(),
parse_verbatim_kbinput(), and faq.html. (DLR)
- Readd the option to turn the keypad off by default from nano
1.2.x, but rename the long option from --keypad to
--rebindkeypad, and clarify its description on the command
line. Changes to window_init(), usage(), main(),
get_verbatim_kbinput(), nanorc.sample, and faq.html. (DLR)
- color.c:
- Remove unneeded fcntl.h include. (DLR)
- chars.c:

View File

@ -33,15 +33,16 @@
<h2><a href="#4">4. Running</a></h2>
<blockquote><p><a href="#4.1">4.1. How do I open a file with a name beginning with '+' from the command line?</a><br>
<a href="#4.2">4.2. Ack! My backspace/delete/enter/double bucky/meta key doesn't seem to work! What can I do?</a><br>
<a href="#4.3">4.3. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</a><br>
<a href="#4.4">4.4. Nano crashes when I type &lt;insert keystroke here&gt;!</a><br>
<a href="#4.5">4.5. Nano crashes when I resize my window. How can I fix that?</a><br>
<a href="#4.6">4.6. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</a><br>
<a href="#4.7a">4.7a. [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.7b">4.7b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</a><br>
<a href="#4.8">4.8. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
<a href="#4.9">4.9. I've compiled nano with color support, but I don't see any color when I run it!</a><br>
<a href="#4.10">4.10. How do I select text for the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</a></p></blockquote>
<a href="#4.3">4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</a><br>
<a href="#4.4">4.4. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</a><br>
<a href="#4.5">4.5. Nano crashes when I type &lt;insert keystroke here&gt;!</a><br>
<a href="#4.6">4.6. Nano crashes when I resize my window. How can I fix that?</a><br>
<a href="#4.7">4.7. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</a><br>
<a href="#4.8a">4.8a. [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.8b">4.8b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</a><br>
<a href="#4.9">4.9. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
<a href="#4.10">4.10. I've compiled nano with color support, but I don't see any color when I run it!</a><br>
<a href="#4.11">4.11. How do I select text for the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</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 &lt;x&gt; in my language. How can I fix it?</a></p></blockquote>
@ -181,19 +182,21 @@
<blockquote><p>Try setting your $TERM variable to 'vt100'. Nano doesn't yet support every term entry under the sun.</p>
<p>Bourne shell users (bash and sh): <b>export TERM=vt100</b><br>
C Shell users (tcsh and csh): <b>setenv TERM vt100</b></p></blockquote>
<h2><a name="4.3"></a>4.3. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</h2>
<h2><a name="4.3"></a>4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</h2>
<blockquote><p>You can use the <b>-K</b> or <b>--rebindkeypad</b> options on the command line, or add the line <b>set rebindkeypad</b> to your .nanorc. However, nano's mouse support won't work properly if you do any of these things.</p></blockquote>
<h2><a name="4.4"></a>4.4. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</h2>
<blockquote><p>It depends on the terminal type you're using. On some terminals, such as the FreeBSD console, xterm, konsole, and gnome-terminal, Shift-F1 to Shift-F4 will generate F13 to F16. On other terminals, such as the Linux console, rxvt, or Eterm, Shift-F3 to Shift-F6 will generate F13 to F16.</p></blockquote>
<h2><a name="4.4"></a>4.4. Nano crashes when I type &lt;insert keystroke here&gt;!</h2>
<h2><a name="4.5"></a>4.5. Nano crashes when I type &lt;insert keystroke here&gt;!</h2>
<blockquote><p>If you aren't trying some bizarre keystroke combination with some bizarre $TERM entry, chances are you have found a bug. You are welcome to submit it to the <a href="mailto:nano-devel@gnu.org">nano-devel</a> list or to <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a>.</p></blockquote>
<h2><a name="4.5"></a>4.5. Nano crashes when I resize my window. How can I fix that?</h2>
<h2><a name="4.6"></a>4.6. Nano crashes when I resize my window. How can I fix that?</h2>
<blockquote><p>Older versions of nano had this problem, please upgrade to a newer version (at least 0.9.9 would be great, 0.9.12 is recommended).</p></blockquote>
<h2><a name="4.6"></a>4.6. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</h2>
<h2><a name="4.7"></a>4.7. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</h2>
<blockquote><p>The help (^G) and justify (^J) function were among the last to be written. To show the improvements that nano had over Pico (go to line # and replace), ^_ and ^\ were put on the shortcut list. Later, ^G came back in place of ^_ as it proved to be very valuable for new Unix users. If you use the <b>-p</b> option to nano (or hit Meta-P) you will get the same shortcuts at the bottom as Pico.</p></blockquote>
<h2><a name="4.7a"></a>4.7a. [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?!</h2>
<h2><a name="4.8a"></a>4.8a. [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?!</h2>
<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.7b"></a>4.7b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</h2>
<h2><a name="4.8b"></a>4.8b. [version 1.1.99pre1 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.8"></a>4.8. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
<h2><a name="4.9"></a>4.9. 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>
@ -206,9 +209,9 @@
<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.9"></a>4.9. I've compiled nano with color support, but I don't see any color when I run it!</h2>
<h2><a name="4.10"></a>4.10. 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>
<h2><a name="4.10"></a>4.10. How do I select text for or paste text from the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</h2>
<h2><a name="4.11"></a>4.11. How do I select text for or paste text from the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</h2>
<blockquote><p>Try holding down the Shift key and selecting or pasting the text as you normally would.</p></blockquote>
<hr width="100%">
<h1><a name="5"></a>5. Internationalization</h1>
@ -249,9 +252,9 @@
<blockquote><p>Re-read Section <a href="#7.4">7.4</a> and you should know the answer.</p></blockquote>
<h2><a name="8"></a>8. ChangeLog</h2>
<blockquote>
<p>
<p>2005/08/10 - Add a new section 4.3, and move all section 4 entries after it down one number, to explain how to deal with numeric keypad problems. (DLR)<br>
2005/08/08 - Update section 3.8 to mention that verbatim input mode now takes a six-digit hexadecimal number. (DLR)<br>
2005/07/04 - Update section 4.10 to mention that pasting from the X clipboard via the middle mouse button also works when the Shift key is used.<br>
2005/07/04 - Update section 4.10 to mention that pasting from the X clipboard via the middle mouse button also works when the Shift key is used. (DLR)<br>
2005/06/15 - Update description of --enable-extra, and add missing line breaks. (DLR)<br>
2005/06/13 - Minor capitalization and wording fixes. (DLR)<br>
2005/06/08 - Updated section 1.1 to mention the current maintainer. (DLR)<br>

View File

@ -103,6 +103,9 @@
## Fix Backspace/Delete confusion problem.
# set rebinddelete
## Fix numeric keypad key confusion problem.
# set rebindkeypad
## Do extended regular expression searches by default.
# set regexp
@ -321,7 +324,7 @@
## highlight possible errors and parameters
# icolor brightwhite "^[[:space:]]*(set|unset|syntax|i?color).*$"
## set, unset and syntax
# icolor cyan "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|brackets|casesensitive|const|cut|fill|historylog|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|punct|quickblank|quotestr|rebinddelete)\>" "^[[:space:]]*(set|unset)[[:space:]]+(regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace)\>"
# icolor cyan "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|brackets|casesensitive|const|cut|fill|historylog|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|punct|quickblank|quotestr|rebinddelete)\>" "^[[:space:]]*(set|unset)[[:space:]]+(rebindkeypad|regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace)\>"
# icolor green "^[[:space:]]*(set|unset|syntax)\>"
## colors
# icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"

View File

@ -648,9 +648,12 @@ void window_init(void)
bottomwin = newwin(3 - no_help(), COLS, editwinrows + (2 -
no_more_space()), 0);
/* Turn the keypad on for the windows that get input. */
keypad(edit, TRUE);
keypad(bottomwin, TRUE);
/* Turn the keypad on for the windows that get input, if
* necessary. */
if (!ISSET(REBIND_KEYPAD)) {
keypad(edit, TRUE);
keypad(bottomwin, TRUE);
}
}
#ifndef DISABLE_MOUSE
@ -1052,6 +1055,8 @@ void usage(void)
print1opt("-I", "--ignorercfiles",
N_("Don't look at nanorc files"));
#endif
print1opt("-K", "--rebindkeypad",
N_("Fix numeric keypad key confusion problem"));
#ifndef NANO_SMALL
print1opt("-N", "--noconvert",
N_("Don't convert files from DOS/Mac format"));
@ -1871,6 +1876,7 @@ int main(int argc, char **argv)
#ifdef ENABLE_NANORC
{"ignorercfiles", 0, NULL, 'I'},
#endif
{"rebindkeypad", 0, NULL, 'K'},
{"morespace", 0, NULL, 'O'},
#ifndef DISABLE_JUSTIFY
{"quotestr", 1, NULL, 'Q'},
@ -1953,11 +1959,11 @@ int main(int argc, char **argv)
while ((optchr =
#ifdef HAVE_GETOPT_LONG
getopt_long(argc, argv,
"h?ABC:EFHINOQ:RST:UVY:abcdefgijklmo:pr:s:tvwxz",
"h?ABC:EFHIKNOQ:RST:UVY:abcdefgijklmo:pr:s:tvwxz",
long_options, NULL)
#else
getopt(argc, argv,
"h?ABC:EFHINOQ:RST:UVY:abcdefgijklmo:pr:s:tvwxz")
"h?ABC:EFHIKNOQ:RST:UVY:abcdefgijklmo:pr:s:tvwxz")
#endif
) != -1) {
switch (optchr) {
@ -1998,6 +2004,9 @@ int main(int argc, char **argv)
SET(NO_RCFILE);
break;
#endif
case 'K':
SET(REBIND_KEYPAD);
break;
#ifndef NANO_SMALL
case 'N':
SET(NO_CONVERT);

View File

@ -300,19 +300,20 @@ typedef struct rcoption {
#define MULTIBUFFER (1<<13)
#define SMOOTH_SCROLL (1<<14)
#define REBIND_DELETE (1<<15)
#define NO_CONVERT (1<<16)
#define BACKUP_FILE (1<<17)
#define NO_RCFILE (1<<18)
#define NO_COLOR_SYNTAX (1<<19)
#define PRESERVE (1<<20)
#define HISTORYLOG (1<<21)
#define RESTRICTED (1<<22)
#define SMART_HOME (1<<23)
#define WHITESPACE_DISPLAY (1<<24)
#define MORE_SPACE (1<<25)
#define TABS_TO_SPACES (1<<26)
#define QUICK_BLANK (1<<27)
#define USE_UTF8 (1<<28)
#define REBIND_KEYPAD (1<<16)
#define NO_CONVERT (1<<17)
#define BACKUP_FILE (1<<18)
#define NO_RCFILE (1<<19)
#define NO_COLOR_SYNTAX (1<<20)
#define PRESERVE (1<<21)
#define HISTORYLOG (1<<22)
#define RESTRICTED (1<<23)
#define SMART_HOME (1<<24)
#define WHITESPACE_DISPLAY (1<<25)
#define MORE_SPACE (1<<26)
#define TABS_TO_SPACES (1<<27)
#define QUICK_BLANK (1<<28)
#define USE_UTF8 (1<<29)
/* Control key sequences. Changing these would be very, very bad. */
#define NANO_CONTROL_SPACE 0

View File

@ -63,6 +63,7 @@ const static rcoption rcopts[] = {
{"quotestr", 0},
#endif
{"rebinddelete", REBIND_DELETE},
{"rebindkeypad", REBIND_KEYPAD},
#ifdef HAVE_REGEX_H
{"regexp", USE_REGEXP},
#endif

View File

@ -1419,20 +1419,22 @@ int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
int *retval;
/* Turn off flow control characters if necessary so that we can type
* them in verbatim, and turn the keypad off so that we don't get
* extended keypad values. */
* them in verbatim, and turn the keypad off if necessary so that we
* don't get extended keypad values. */
if (ISSET(PRESERVE))
disable_flow_control();
keypad(win, FALSE);
if (!ISSET(REBIND_KEYPAD))
keypad(win, FALSE);
/* Read in a stream of characters and interpret it if possible. */
retval = parse_verbatim_kbinput(win, kbinput_len);
/* Turn flow control characters back on if necessary and turn the
* keypad back on now that we're done. */
* keypad back on if necessary now that we're done. */
if (ISSET(PRESERVE))
enable_flow_control();
keypad(win, TRUE);
if (!ISSET(REBIND_KEYPAD))
keypad(win, TRUE);
return retval;
}