add new key aliases: F15 for "Mark Text" and F16 for "Where Is Next";

also add support for their corresponding escape sequences


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2042 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2004-11-01 22:40:02 +00:00
parent d402e71a2f
commit 8381fdd83a
4 changed files with 55 additions and 23 deletions

View File

@ -132,6 +132,8 @@ CVS code -
- Remove redundant NANO_SMALL #ifdef. (DLR)
- Change an erroneous _() around the "New Buffer" string to
N_(). (DLR)
- Add new key aliases: F15 for "Mark Text" (DLR) and F16 for
"Where Is Next" (Chris).
- nano.c:
die_save_file()
- Clarify the error message when there are too many backup files
@ -244,6 +246,7 @@ CVS code -
get_escape_seq_kbinput()
- Make the escape_seq parameter a const int*, since it's never
modified. (DLR)
- Support the escape sequences for F15 and F16. (DLR)
get_verbatim_kbinput()
- Add new parameter first. If first isn't ERR, make it the
first character in the returned sequence instead of reading

View File

@ -278,6 +278,8 @@ void shortcut_init(int unjustify)
const char *nano_spell_msg = N_("Invoke the spell checker, if available");
const char *nano_gotoline_msg = N_("Go to a specific line number");
const char *nano_replace_msg = N_("Replace text within the editor");
const char *nano_mark_msg = N_("Mark text at the cursor position");
const char *nano_whereis_next_msg = N_("Repeat last search");
const char *nano_prevline_msg = N_("Move to the previous line");
const char *nano_nextline_msg = N_("Move to the next line");
const char *nano_forward_msg = N_("Move forward one character");
@ -285,7 +287,6 @@ void shortcut_init(int unjustify)
const char *nano_home_msg = N_("Move to the beginning of the current line");
const char *nano_end_msg = N_("Move to the end of the current line");
const char *nano_refresh_msg = N_("Refresh (redraw) the current screen");
const char *nano_mark_msg = N_("Mark text at the cursor position");
const char *nano_delete_msg = N_("Delete the character under the cursor");
const char *nano_backspace_msg =
N_("Delete the character to the left of the cursor");
@ -311,11 +312,8 @@ void shortcut_init(int unjustify)
#ifndef DISABLE_JUSTIFY
const char *nano_fulljustify_msg = N_("Justify the entire file");
#endif
#ifndef NANO_SMALL
#ifdef HAVE_REGEX_H
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
const char *nano_bracket_msg = N_("Find other bracket");
#endif
const char *nano_whereis_next_msg = N_("Repeat last search");
#endif
const char *nano_cancel_msg = N_("Cancel the current function");
const char *nano_firstline_msg = N_("Go to the first line of the file");
@ -478,6 +476,26 @@ void shortcut_init(int unjustify)
IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY), NANO_REPLACE_FKEY,
NANO_NO_KEY, NOVIEW, do_replace);
sc_init_one(&main_list, NANO_MARK_KEY, N_("Mark Text"),
IFHELP(nano_mark_msg, NANO_MARK_ALTKEY), NANO_MARK_FKEY,
NANO_NO_KEY, NOVIEW,
#ifndef NANO_SMALL
do_mark
#else
nano_disabled_msg
#endif
);
sc_init_one(&main_list, NANO_NO_KEY, N_("Where Is Next"),
IFHELP(nano_whereis_next_msg, NANO_WHEREIS_NEXT_KEY),
NANO_WHEREIS_NEXT_FKEY, NANO_NO_KEY, VIEW,
#ifndef NANO_SMALL
do_research
#else
nano_disabled_msg
#endif
);
sc_init_one(&main_list, NANO_PREVLINE_KEY, N_("Prev Line"),
IFHELP(nano_prevline_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, do_up);
@ -506,16 +524,6 @@ void shortcut_init(int unjustify)
IFHELP(nano_refresh_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, total_refresh);
sc_init_one(&main_list, NANO_MARK_KEY, N_("Mark Text"),
IFHELP(nano_mark_msg, NANO_MARK_ALTKEY),
NANO_NO_KEY, NANO_NO_KEY, NOVIEW,
#ifndef NANO_SMALL
do_mark
#else
nano_disabled_msg
#endif
);
sc_init_one(&main_list, NANO_DELETE_KEY, N_("Delete"),
IFHELP(nano_delete_msg, NANO_NO_KEY), NANO_NO_KEY,
NANO_NO_KEY, NOVIEW, do_delete);
@ -575,18 +583,12 @@ void shortcut_init(int unjustify)
NANO_NO_KEY, NOVIEW, do_full_justify);
#endif
#ifndef NANO_SMALL
#ifdef HAVE_REGEX_H
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
sc_init_one(&main_list, NANO_NO_KEY, N_("Find Other Bracket"),
IFHELP(nano_bracket_msg, NANO_BRACKET_KEY), NANO_NO_KEY,
NANO_NO_KEY, VIEW, do_find_bracket);
#endif
sc_init_one(&main_list, NANO_NO_KEY, N_("Where Is Next"),
IFHELP(nano_whereis_next_msg, NANO_WHEREIS_NEXT_KEY),
NANO_NO_KEY, NANO_NO_KEY, VIEW, do_research);
#endif
free_shortcutage(&whereis_list);
sc_init_one(&whereis_list, NANO_HELP_KEY, get_help_msg,

View File

@ -397,6 +397,7 @@ typedef struct historyheadtype {
#define NANO_WHEREIS_KEY NANO_CONTROL_W
#define NANO_WHEREIS_FKEY KEY_F(6)
#define NANO_WHEREIS_NEXT_KEY NANO_ALT_W
#define NANO_WHEREIS_NEXT_FKEY KEY_F(16)
#define NANO_TOOTHERWHEREIS_KEY NANO_CONTROL_T
#define NANO_REPLACE_KEY NANO_CONTROL_4
#define NANO_REPLACE_FKEY KEY_F(14)
@ -429,6 +430,7 @@ typedef struct historyheadtype {
#define NANO_BACK_KEY NANO_CONTROL_B
#define NANO_MARK_KEY NANO_CONTROL_6
#define NANO_MARK_ALTKEY NANO_ALT_A
#define NANO_MARK_FKEY KEY_F(15)
#define NANO_HOME_KEY NANO_CONTROL_A
#define NANO_END_KEY NANO_CONTROL_E
#define NANO_DELETE_KEY NANO_CONTROL_D

View File

@ -88,6 +88,13 @@ static bool resetstatuspos = FALSE;
* omitted. (Same as above.)
* - F13 on FreeBSD console == End on Mach console; the former is
* omitted. (Same as above.)
* - F15 on FreeBSD console == Shift-Up on rxvt/Eterm; the former is
* omitted. (The arrow keys, with or without modifiers, are 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.)
* - F16 on FreeBSD console == Shift-Down on rxvt/Eterm; the former is
* omitted. (Same as above.)
*
* Note that Center (5) on the numeric keypad with NumLock off can also
* be the Begin key. */
@ -138,7 +145,7 @@ void unget_kbinput(int kbinput, bool meta_key, bool func_key)
* keypad sequence. Supported extended keypad values consist of [arrow
* key], Ctrl-[arrow key], Shift-[arrow key], Enter, Backspace, the
* editing keypad (Insert, Delete, Home, End, PageUp, and PageDown), the
* function keypad (F1-F14), and the numeric keypad with NumLock off.
* function keypad (F1-F16), and the numeric keypad with NumLock off.
* Assume nodelay(win) is FALSE. */
int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
{
@ -654,6 +661,14 @@ int get_escape_seq_kbinput(const int *escape_seq, size_t es_len, bool
* xterm. */
retval = KEY_F(14);
break;
case 'R': /* Esc O 2 R == F15 on
* xterm. */
retval = KEY_F(15);
break;
case 'S': /* Esc O 2 S == F16 on
* xterm. */
retval = KEY_F(16);
break;
}
}
break;
@ -931,6 +946,16 @@ int get_escape_seq_kbinput(const int *escape_seq, size_t es_len, bool
* rxvt/Eterm. */
retval = KEY_F(14);
break;
case '8': /* Esc [ 2 8 ~ == F15 on
* VT220/VT320/Linux console/
* rxvt/Eterm. */
retval = KEY_F(15);
break;
case '9': /* Esc [ 2 9 ~ == F16 on
* VT220/VT320/Linux console/
* rxvt/Eterm. */
retval = KEY_F(16);
break;
default: /* Esc [ 2 ~ == Insert on
* VT220/VT320/Linux console/
* xterm. */