Properly move cursor when home and end keys are used.

This commit is contained in:
Eric Melville 2001-08-31 01:56:06 +00:00
parent d2c60af81a
commit ae0b7d588a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=82613
2 changed files with 20 additions and 4 deletions

View File

@ -43,7 +43,7 @@ dialog_checklist(unsigned char *title, unsigned char *prompt, int height, int wi
{
int i, j, x, y, cur_x, cur_y, old_x, old_y, box_x, box_y, key = 0, button,
choice, l, k, scroll, max_choice, item_no = 0, *status;
int redraw_menu = FALSE;
int redraw_menu = FALSE, cursor_reset = FALSE;
int rval = 0, onlist = 1, ok_space, cancel_space;
char okButton, cancelButton;
WINDOW *dialog, *list;
@ -452,6 +452,7 @@ draw:
scroll = 0;
choice = 0;
redraw_menu = TRUE;
cursor_reset = TRUE;
onlist = 1;
break;
@ -461,6 +462,7 @@ draw:
scroll = 0;
choice = max_choice - 1;
redraw_menu = TRUE;
cursor_reset = TRUE;
onlist = 1;
break;
@ -581,7 +583,13 @@ draw:
print_button(dialog, " OK ", y, x, !button);
}
wnoutrefresh(dialog);
wmove(list, old_y, old_x);
if (cursor_reset) {
wmove(list, choice, check_x+1);
cursor_reset = FALSE;
}
else {
wmove(list, old_y, old_x);
}
wrefresh(list);
redraw_menu = FALSE;
}

View File

@ -46,7 +46,7 @@ dialog_radiolist(unsigned char *title, unsigned char *prompt, int height, int wi
{
int i, j, x, y, cur_x, cur_y, old_x, old_y, box_x, box_y, key = 0, button,
choice, l, k, scroll, max_choice, *status, item_no = 0, was_on = 0;
int redraw_menu = FALSE;
int redraw_menu = FALSE, cursor_reset = FALSE;
int rval = 0, onlist = 1, ok_space, cancel_space;
char okButton, cancelButton;
WINDOW *dialog, *list;
@ -455,6 +455,7 @@ draw:
scroll = 0;
choice = 0;
redraw_menu = TRUE;
cursor_reset = TRUE;
onlist = 1;
break;
@ -464,6 +465,7 @@ draw:
scroll = 0;
choice = max_choice - 1;
redraw_menu = TRUE;
cursor_reset = TRUE;
onlist = 1;
break;
@ -575,7 +577,13 @@ draw:
print_button(dialog, " OK ", y, x, !button);
}
wnoutrefresh(dialog);
wmove(list, old_y, old_x);
if (cursor_reset) {
wmove(list, choice, check_x+1);
cursor_reset = FALSE;
}
else {
wmove(list, old_y, old_x);
}
wrefresh(list);
redraw_menu = FALSE;
}