Added bindings for vertical scrolling of interactive help.

check_movement_keys() function is not used now in interactive help.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2010-08-16 16:36:47 +04:00
parent b470fb81ce
commit 67e61510b4
5 changed files with 75 additions and 51 deletions

View File

@ -379,8 +379,14 @@ HelpHelp = f1
HelpIndex = f2; c
HelpBack = f3; left; l
HelpQuit = f10; esc; ctrl-g
HelpMoveUp = up
HelpMoveDown = down
HelpMoveUp = up; ctrl-p
HelpMoveDown = down; ctrl-n
HelpMovePgDn = f; space; pgdn; ctrl-v
HelpMovePgUp = b; pgup; alt-v; backspace
HelpMoveHalfPgDn = d
HelpMoveHalfPgUp = u
HelpMoveTop = home; ctrl-home; ctrl-pgup; a1; alt-lt; g
HelpMoveBottom = end; ctrl-end; ctrl-pgdn; c1; alt-gt; shift-g
HelpSelectLink = right; enter
HelpNextLink = tab
HelpPrevLink = alt-tab

View File

@ -383,8 +383,14 @@ HelpHelp = f1
HelpIndex = f2; c
HelpBack = f3; left; l
HelpQuit = f10; esc; ctrl-g
HelpMoveUp = up
HelpMoveDown = down
HelpMoveUp = up; ctrl-p
HelpMoveDown = down; ctrl-n
HelpMovePgDn = f; space; pgdn; ctrl-v
HelpMovePgUp = b; pgup; alt-v; backspace
HelpMoveHalfPgDn = d
HelpMoveHalfPgUp = u
HelpMoveTop = home; ctrl-home; ctrl-pgup; a1; alt-lt; g
HelpMoveBottom = end; ctrl-end; ctrl-pgdn; c1; alt-gt; shift-g
HelpSelectLink = right; enter
HelpNextLink = tab
HelpPrevLink = alt-tab

View File

@ -212,6 +212,12 @@
#define CK_HelpPrevLink 1009
#define CK_HelpNextNode 1010
#define CK_HelpPrevNode 1011
#define CK_HelpMovePgDn 1012
#define CK_HelpMovePgUp 1013
#define CK_HelpMoveHalfPgDn 1014
#define CK_HelpMoveHalfPgUp 1015
#define CK_HelpMoveTop 1016
#define CK_HelpMoveBottom 1017
/* common */
#define CK_ShowCommandLine 2001

View File

@ -54,9 +54,8 @@
#include "lib/global.h"
#include "lib/tty/tty.h"
#include "lib/skin.h"
#include "lib/tty/mouse.h"
#include "lib/tty/key.h"
#include "lib/skin.h"
#include "lib/strutil.h"
#include "dialog.h" /* For Dlg_head */
@ -673,36 +672,6 @@ help_back (Dlg_head * h)
help_callback (h, NULL, DLG_DRAW, 0, NULL); /* FIXME: unneeded? */
}
static void
help_cmk_move_backward (void *vp, int lines)
{
(void) &vp;
move_backward (lines);
}
static void
help_cmk_move_forward (void *vp, int lines)
{
(void) &vp;
move_forward (lines);
}
static void
help_cmk_moveto_top (void *vp, int lines)
{
(void) &vp;
(void) &lines;
move_to_top ();
}
static void
help_cmk_moveto_bottom (void *vp, int lines)
{
(void) &vp;
(void) &lines;
move_to_bottom ();
}
static void
help_next_link (gboolean move_down)
{
@ -833,6 +802,24 @@ help_execute_cmd (unsigned long command)
case CK_HelpMoveDown:
help_next_link (TRUE);
break;
case CK_HelpMovePgDn:
move_forward (help_lines - 1);
break;
case CK_HelpMovePgUp:
move_backward (help_lines - 1);
break;
case CK_HelpMoveHalfPgDn:
move_forward (help_lines / 2);
break;
case CK_HelpMoveHalfPgUp:
move_backward (help_lines / 2);
break;
case CK_HelpMoveTop:
move_to_top ();
break;
case CK_HelpMoveBottom:
move_to_bottom ();
break;
case CK_HelpSelectLink:
help_select_link ();
break;
@ -861,22 +848,11 @@ help_execute_cmd (unsigned long command)
static cb_ret_t
help_handle_key (Dlg_head * h, int c)
{
if (c != KEY_UP && c != KEY_DOWN &&
check_movement_keys (c, help_lines, NULL,
help_cmk_move_backward,
help_cmk_move_forward,
help_cmk_moveto_top, help_cmk_moveto_bottom) == MSG_HANDLED)
{
/* Nothing */ ;
}
else
{
unsigned long command;
unsigned long command;
command = lookup_keymap_command (help_map, c);
if ((command == CK_Ignore_Key) || (help_execute_cmd (command) == MSG_NOT_HANDLED))
return MSG_NOT_HANDLED;
}
command = lookup_keymap_command (help_map, c);
if ((command == CK_Ignore_Key) || (help_execute_cmd (command) == MSG_NOT_HANDLED))
return MSG_NOT_HANDLED;
help_callback (h, NULL, DLG_DRAW, 0, NULL);
return MSG_HANDLED;

View File

@ -295,6 +295,12 @@ static name_keymap_t command_names[] = {
{ "HelpQuit", CK_HelpQuit },
{ "HelpMoveUp", CK_HelpMoveUp },
{ "HelpMoveDown", CK_HelpMoveDown },
{ "HelpMovePgDn", CK_HelpMovePgDn },
{ "HelpMovePgUp", CK_HelpMovePgUp },
{ "HelpMoveHalfPgDn", CK_HelpMoveHalfPgDn },
{ "HelpMoveHalfPgUp", CK_HelpMoveHalfPgUp },
{ "HelpMoveTop", CK_HelpMoveTop },
{ "HelpMoveBottom", CK_HelpMoveBottom },
{ "HelpSelectLink", CK_HelpSelectLink },
{ "HelpNextLink", CK_HelpNextLink },
{ "HelpPrevLink", CK_HelpPrevLink },
@ -919,7 +925,31 @@ const global_keymap_t default_help_keymap[] = {
{ KEY_LEFT, CK_HelpBack, "Left" },
{ 'l', CK_HelpBack, "l" },
{ KEY_DOWN, CK_HelpMoveDown, "Down" },
{ XCTRL ('n'), CK_HelpMoveDown, "C-n" },
{ KEY_UP, CK_HelpMoveUp, "Up" },
{ XCTRL ('p'), CK_HelpMoveUp, "C-p" },
{ KEY_NPAGE, CK_HelpMovePgDn, "PgDn" },
{ XCTRL ('v'), CK_HelpMovePgDn, "C-v" },
{ 'f', CK_HelpMovePgDn, "f" },
{ ' ', CK_HelpMovePgDn, "Space" },
{ KEY_PPAGE, CK_HelpMovePgUp, "PgUp" },
{ ALT ('v'), CK_HelpMovePgUp, "M-v" },
{ 'b', CK_HelpMovePgUp, "b" },
{ KEY_BACKSPACE, CK_HelpMovePgUp, "BackSpace" },
{ 'd', CK_HelpMoveHalfPgDn, "d" },
{ 'u', CK_HelpMoveHalfPgUp, "u" },
{ KEY_HOME, CK_HelpMoveTop, "Home" },
{ KEY_M_CTRL | KEY_HOME, CK_HelpMoveTop, "C-Home" },
{ KEY_M_CTRL | KEY_PPAGE, CK_HelpMoveTop, "C-PgUp" },
{ KEY_A1, CK_HelpMoveTop, "A1" },
{ ALT ('<'), CK_HelpMoveTop, "M-<" },
{ 'g', CK_HelpMoveTop, "g" },
{ KEY_END, CK_HelpMoveBottom, "End" },
{ KEY_M_CTRL | KEY_END, CK_HelpMoveBottom, "C-End" },
{ KEY_M_CTRL | KEY_NPAGE, CK_HelpMoveBottom, "C-PgDn" },
{ KEY_C1, CK_HelpMoveBottom, "C1" },
{ ALT ('>'), CK_HelpMoveBottom, "M->" },
{ 'G', CK_HelpMoveBottom, "G" },
{ KEY_RIGHT, CK_HelpSelectLink, "Right" },
{ KEY_ENTER, CK_HelpSelectLink, "Enter" },
{ '\n', CK_HelpSelectLink, "Enter" },