Allow emacs-style next/prev characters as well as arrow keys so that

I can offer this as a consistent feature.
This commit is contained in:
jkh 1997-01-15 02:50:48 +00:00
parent ed2799b548
commit aaad85f64d
5 changed files with 13 additions and 9 deletions

View File

@ -255,12 +255,12 @@ draw:
break;
if (i < max_choice || (key >= '1' && key <= MIN('9', '0'+max_choice)) || key == KEY_UP ||
key == KEY_DOWN || key == ' ' || key == '+' || key == '-' ) {
key == KEY_DOWN || key == ' ' || key == '+' || key == '-' || key == '' || key == '') {
if (key >= '1' && key <= MIN('9', '0'+max_choice))
i = key - '1';
else if (key == KEY_UP || key == '-') {
else if (key == KEY_UP || key == '-' || key == '') {
if (!choice) {
if (scroll) {
/* Scroll list down */
@ -283,7 +283,7 @@ draw:
else
i = choice - 1;
}
else if (key == KEY_DOWN || key == '+') {
else if (key == KEY_DOWN || key == '+' || key == '') {
if (choice == max_choice - 1) {
if (scroll+choice < item_no-1) {
/* Scroll list up */

View File

@ -236,10 +236,10 @@ draw:
break;
if (i < max_choice || (key >= '1' && key <= MIN('9', '0'+max_choice)) ||
key == KEY_UP || key == KEY_DOWN || key == '-' || key == '+') {
key == KEY_UP || key == KEY_DOWN || key == '-' || key == '+' || key == '' || key == '') {
if (key >= '1' && key <= MIN('9', '0'+max_choice))
i = key - '1';
else if (key == KEY_UP || key == '-') {
else if (key == KEY_UP || key == '-' || key == '') {
if (!choice) {
if (scroll) {
/* Scroll menu down */
@ -262,7 +262,7 @@ draw:
else
i = choice - 1;
}
else if (key == KEY_DOWN || key == '+')
else if (key == KEY_DOWN || key == '+' || key == '')
if (choice == max_choice - 1) {
if (scroll+choice < item_no-1) {
/* Scroll menu up */

View File

@ -193,9 +193,11 @@ dialog_mesgbox(unsigned char *title, unsigned char *prompt, int height, int widt
startline = max_lines - theight;
if (startline < 0) startline = 0;
break;
case '\020': /* ^P */
case KEY_UP:
if (startline > 0) startline--;
break;
case '\016': /* ^N */
case KEY_DOWN:
if (startline < max_lines - theight) startline++;
break;

View File

@ -262,10 +262,10 @@ draw:
break;
if (i < max_choice || (key >= '1' && key <= MIN('9', '0' + max_choice)) ||
key == KEY_UP || key == KEY_DOWN || key == ' ' || key == '+' || key == '-' ) {
key == KEY_UP || key == KEY_DOWN || key == ' ' || key == '+' || key == '-' || key == '' || key == '') {
if (key >= '1' && key <= MIN('9', '0' + max_choice))
i = key - '1';
else if (key == KEY_UP || key == '-') {
else if (key == KEY_UP || key == '-' || key == '') {
if (!choice) {
if (scroll) {
/* Scroll list down */
@ -288,7 +288,7 @@ draw:
else
i = choice - 1;
}
else if (key == KEY_DOWN || key == '+') {
else if (key == KEY_DOWN || key == '+' || key == '') {
if (choice == max_choice - 1) {
if (scroll + choice < item_no - 1) {
/* Scroll list up */

View File

@ -219,6 +219,7 @@ int dialog_textbox(unsigned char *title, unsigned char *file, int height, int wi
break;
case 'K': /* Previous line */
case 'k':
case '\020': /* ^P */
case KEY_UP:
if (!begin_reached) {
back_lines(page_length+1);
@ -266,6 +267,7 @@ int dialog_textbox(unsigned char *title, unsigned char *file, int height, int wi
break;
case 'J': /* Next line */
case 'j':
case '\016': /* ^N */
case KEY_DOWN:
if (!end_reached) {
begin_reached = 0;