diff --git a/src/ChangeLog b/src/ChangeLog index 92ee64fc2..6d4c3711d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2003-11-21 Pavel Roskin + * view.c (check_left_right_keys): Implement fast scrolling if + Ctrl is pressed. Idea by Arpad Biro + * execute.c (do_execute): Use get_key_code(), not getch() to consume all characters from a single sequence. Reported by Miven Dooligan diff --git a/src/view.c b/src/view.c index 8b6b612c2..af8681e11 100644 --- a/src/view.c +++ b/src/view.c @@ -2249,18 +2249,39 @@ view_labels (WView *view) redraw_labels (h); } -/* Both views */ -static int +/* Check for left and right arrows, possibly with modifiers */ +static cb_ret_t check_left_right_keys (WView *view, int c) { - if (c == KEY_LEFT) + if (c == KEY_LEFT) { move_left (view); - else if (c == KEY_RIGHT) - move_right (view); - else - return 0; + return MSG_HANDLED; + } - return 1; + if (c == KEY_RIGHT) { + move_right (view); + return MSG_HANDLED; + } + + /* Ctrl with arrows moves by 10 postions in the unwrap mode */ + if (view->hex_mode || view->wrap_mode) + return MSG_NOT_HANDLED; + + if (c == (KEY_M_CTRL | KEY_LEFT)) { + view->start_col = view->start_col + 10; + if (view->start_col > 0) + view->start_col = 0; + view->dirty++; + return MSG_HANDLED; + } + + if (c == (KEY_M_CTRL | KEY_RIGHT)) { + view->start_col = view->start_col - 10; + view->dirty++; + return MSG_HANDLED; + } + + return MSG_NOT_HANDLED; } static void