From d7f5ad97860ef887136849b15de9f7f9ce2621b6 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Thu, 4 Mar 2004 19:30:53 +0000 Subject: [PATCH] add function key aliases for NANO_FIRSTLINE_KEY and NANO_LASTLINE_KEY, and make sure statusbar input handles both them and NANO_HELP_FKEY properly git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1682 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 4 +++- src/global.c | 4 ++-- src/nano.h | 2 ++ src/winio.c | 8 +++++++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index b1a6f5e3..07bc8154 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,7 +11,9 @@ CVS code - NANO_DOWN_KEY in the search history shortcut entries. (DLR) - Add NANO_UNJUSTIFY_FKEY (the same as NANO_UNCUT_FKEY) to the shortcut list, and tweak the unjustify routine to use it. - (DLR) + Also add NANO_FIRSTLINE_FKEY and NANO_LASTLINE_FKEY, and tweak + the statusbar input routines to handle them and NANO_HELP_FKEY + properly. (DLR) - Add more intuitive Meta-key aliases for moving to the beginning and ending lines of a paragraph at the search prompt: Meta-P and Meta-N. (DLR) diff --git a/src/global.c b/src/global.c index cd488371..007c1f1c 100644 --- a/src/global.c +++ b/src/global.c @@ -619,12 +619,12 @@ void shortcut_init(int unjustify) /* Translators: try to keep this string under 10 characters long */ sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, _("First Line"), - IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY, + IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_FIRSTLINE_FKEY, NANO_NO_KEY, VIEW, do_first_line); /* Translators: try to keep this string under 10 characters long */ sc_init_one(&whereis_list, NANO_LASTLINE_KEY, _("Last Line"), - IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY, + IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_LASTLINE_FKEY, NANO_NO_KEY, VIEW, do_last_line); /* Translators: try to keep this string under 10 characters long */ diff --git a/src/nano.h b/src/nano.h index 5fb496b7..e5b6efaa 100644 --- a/src/nano.h +++ b/src/nano.h @@ -407,7 +407,9 @@ typedef struct historyheadtype { #define NANO_SPELL_KEY NANO_CONTROL_T #define NANO_SPELL_FKEY KEY_F(12) #define NANO_FIRSTLINE_KEY NANO_PREVPAGE_KEY +#define NANO_FIRSTLINE_FKEY NANO_PREVPAGE_FKEY #define NANO_LASTLINE_KEY NANO_NEXTPAGE_KEY +#define NANO_LASTLINE_FKEY NANO_NEXTPAGE_FKEY #define NANO_CANCEL_KEY NANO_CONTROL_C #define NANO_REFRESH_KEY NANO_CONTROL_L #define NANO_JUSTIFY_KEY NANO_CONTROL_J diff --git a/src/winio.c b/src/winio.c index 27ad4edf..fff100ee 100644 --- a/src/winio.c +++ b/src/winio.c @@ -1135,12 +1135,16 @@ int nanogetstr(int allowtabs, const char *buf, const char *def, fprintf(stderr, "Aha! \'%c\' (%d)\n", kbinput, kbinput); #endif + if (kbinput == t->func_key) + kbinput = t->val; + if (kbinput == t->val && is_cntrl_char(kbinput)) { #ifndef DISABLE_HELP /* Have to do this here, it would be too late to do it in statusq() */ - if (kbinput == NANO_HELP_KEY || kbinput == NANO_HELP_FKEY) { + if (kbinput == NANO_HELP_KEY) { + kbinput = NANO_HELP_KEY; do_help(); break; } @@ -2042,10 +2046,12 @@ int statusq(int tabs, const shortcut *s, const char *def, switch (ret) { case NANO_FIRSTLINE_KEY: + case NANO_FIRSTLINE_FKEY: do_first_line(); resetstatuspos = 1; break; case NANO_LASTLINE_KEY: + case NANO_LASTLINE_FKEY: do_last_line(); resetstatuspos = 1; break;