Add patches from Peter Postma in PR 24755 to cleanup output in sushi:

* hide the cursor everywhere except in forms (looks nicer)
        * fix repaint with lists (from TODO)
        * fix the form page (removes XXX)
        * force a pos_form_cursor() after every keypress in the forms
          to ensure that the selected field got the focus.
        * tweak the status message a bit.
This commit is contained in:
garbled 2004-03-24 19:10:58 +00:00
parent 27d4257287
commit 732560ccbd
4 changed files with 33 additions and 8 deletions

View File

@ -65,6 +65,6 @@ $set 4 menu titles and stuff
6 Enter the field data below, and hit enter to return to the form. 6 Enter the field data below, and hit enter to return to the form.
7 Data Entry: 7 Data Entry:
8 Form Page: 8 Form Page:
9 PGUP/PGDN to change page, UP/DOWN switch field, ENTER=Do. 9 PGUP/PGDN to change page, UP/DOWN switch field, ENTER submit.
10 Log ended at 10 Log ended at
11 Script ended at 11 Script ended at

View File

@ -14,6 +14,5 @@ bulk pkgadd
/etc/ftpusers /etc/ftpusers
BUGS: BUGS:
the f4 popup isn't repainting the screen properly
required fields, aren't. required fields, aren't.
All of the /etc/*.conf menus need to be updated prior to release. All of the /etc/*.conf menus need to be updated prior to release.

View File

@ -1,4 +1,4 @@
/* $NetBSD: scanform.c,v 1.35 2004/03/22 19:03:19 jdc Exp $ */ /* $NetBSD: scanform.c,v 1.36 2004/03/24 19:10:58 garbled Exp $ */
/* /*
* Copyright (c) 2000 The NetBSD Foundation, Inc. * Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -80,7 +80,7 @@ form_status(FORM *form)
wstandout(stdscr); wstandout(stdscr);
mvwaddstr(stdscr, ws.ws_row-3, 0, catgets(catalog, 4, 9, mvwaddstr(stdscr, ws.ws_row-3, 0, catgets(catalog, 4, 9,
"PGUP/PGDN to change page, UP/DOWN switch field, ENTER=Do.")); "PGUP/PGDN to change page, UP/DOWN switch field, ENTER submit."));
wstandend(stdscr); wstandend(stdscr);
snprintf(buf, sizeof(buf), "%s (%d/%d)", snprintf(buf, sizeof(buf), "%s (%d/%d)",
catgets(catalog, 4, 8, "Form Page:"), catgets(catalog, 4, 8, "Form Page:"),
@ -481,10 +481,12 @@ my_driver(FORM * form, int c, char *path)
/* NOTREACHED */ /* NOTREACHED */
break; break;
case SHOWHELP: case SHOWHELP:
if (simple_lang_handler(path, HELPFILE, handle_help) == -2) curs_set(0);
if (simple_lang_handler(path, HELPFILE, handle_help) == -2)
nohelp(); nohelp();
touchwin(stdscr); touchwin(stdscr);
wrefresh(stdscr); wrefresh(stdscr);
curs_set(1);
return(FALSE); return(FALSE);
/* NOTREACHED */ /* NOTREACHED */
break; break;
@ -500,6 +502,7 @@ my_driver(FORM * form, int c, char *path)
if (field_buffer(curfield, 1) == NULL || if (field_buffer(curfield, 1) == NULL ||
field_buffer(curfield, 0) == NULL) field_buffer(curfield, 0) == NULL)
return(FALSE); return(FALSE);
curs_set(0);
otmp = tmp = strdup(field_buffer(curfield, 1)); otmp = tmp = strdup(field_buffer(curfield, 1));
stripWhiteSpace(vBOTH, tmp); stripWhiteSpace(vBOTH, tmp);
if (*tmp == 'm') { if (*tmp == 'm') {
@ -545,6 +548,9 @@ my_driver(FORM * form, int c, char *path)
destroyCDKScroll(plist); destroyCDKScroll(plist);
free(otmp); free(otmp);
} }
touchwin(stdscr);
wrefresh(stdscr);
curs_set(1);
return(FALSE); return(FALSE);
/* NOTREACHED */ /* NOTREACHED */
break; break;
@ -859,6 +865,7 @@ process_form(FORM *form, char *path)
if (strcmp("pre", form_userptr(form)) == 0) if (strcmp("pre", form_userptr(form)) == 0)
return(process_preform(form, path)); return(process_preform(form, path));
curs_set(0);
*msg = catgets(catalog, 3, 17, "Are you sure? (Y/n)"); *msg = catgets(catalog, 3, 17, "Are you sure? (Y/n)");
label = newCDKLabel(cdkscreen, CENTER, CENTER, msg, 1, TRUE, FALSE); label = newCDKLabel(cdkscreen, CENTER, CENTER, msg, 1, TRUE, FALSE);
activateCDKLabel(label, NULL); activateCDKLabel(label, NULL);
@ -866,6 +873,7 @@ process_form(FORM *form, char *path)
destroyCDKLabel(label); destroyCDKLabel(label);
touchwin(stdscr); touchwin(stdscr);
wrefresh(stdscr); wrefresh(stdscr);
curs_set(1);
if (key != 13 && key != 10 && key != 121 && key != 89) /* enter y Y */ if (key != 13 && key != 10 && key != 121 && key != 89) /* enter y Y */
return -1; return -1;
@ -1608,12 +1616,14 @@ tab_help(FORM *form)
} else } else
return; return;
curs_set(0);
label = newCDKLabel(cdkscreen, CENTER, CENTER, msg, lines, TRUE, FALSE); label = newCDKLabel(cdkscreen, CENTER, CENTER, msg, lines, TRUE, FALSE);
activateCDKLabel(label, NULL); activateCDKLabel(label, NULL);
waitCDKLabel(label, 0); waitCDKLabel(label, 0);
destroyCDKLabel(label); destroyCDKLabel(label);
touchwin(stdscr); touchwin(stdscr);
wrefresh(stdscr); wrefresh(stdscr);
curs_set(1);
} }
int int
@ -1639,6 +1649,7 @@ handle_form(char *basedir, char *path, char **args)
bailout("malloc: %s", strerror(errno)); bailout("malloc: %s", strerror(errno));
fflush(NULL); fflush(NULL);
curs_set(0);
/* generate a label to let the user know we are thinking */ /* generate a label to let the user know we are thinking */
msg[0] = catgets(catalog, 4, 2, "Generating form data, please wait"); msg[0] = catgets(catalog, 4, 2, "Generating form data, please wait");
label = newCDKLabel(cdkscreen, CENTER, CENTER, msg, 1, TRUE, FALSE); label = newCDKLabel(cdkscreen, CENTER, CENTER, msg, 1, TRUE, FALSE);
@ -1667,11 +1678,15 @@ handle_form(char *basedir, char *path, char **args)
wrefresh(stdscr); wrefresh(stdscr);
wrefresh(boxwin); wrefresh(boxwin);
form_status(menuform); form_status(menuform);
curs_set(1);
while (!done) { while (!done) {
pos_form_cursor(menuform);
wrefresh(formwin);
switch (form_driver(menuform, c = get_request(formwin))) { switch (form_driver(menuform, c = get_request(formwin))) {
case E_OK: case E_OK:
if (c == REQ_NEXT_PAGE || c == REQ_PREV_PAGE || if (c == REQ_NEXT_PAGE || c == REQ_PREV_PAGE ||
c == REQ_FIRST_PAGE || c == REQ_LAST_PAGE) c == REQ_FIRST_PAGE || c == REQ_LAST_PAGE ||
c == REQ_NEXT_FIELD || c == REQ_PREV_FIELD)
form_status(menuform); form_status(menuform);
break; break;
case E_UNKNOWN_COMMAND: case E_UNKNOWN_COMMAND:
@ -1684,6 +1699,7 @@ handle_form(char *basedir, char *path, char **args)
break; break;
} }
} }
curs_set(0);
fc = field_count(menuform); fc = field_count(menuform);
f = form_fields(menuform); f = form_fields(menuform);
unpost_form(menuform); unpost_form(menuform);
@ -1740,6 +1756,7 @@ handle_preform(char *basedir, char *path)
bailout("malloc: %s", strerror(errno)); bailout("malloc: %s", strerror(errno));
fflush(NULL); fflush(NULL);
curs_set(0);
/* generate a label to let the user know we are thinking */ /* generate a label to let the user know we are thinking */
msg[0] = catgets(catalog, 4, 2, "Generating form data, please wait"); msg[0] = catgets(catalog, 4, 2, "Generating form data, please wait");
label = newCDKLabel(cdkscreen, CENTER, CENTER, msg, 1, TRUE, FALSE); label = newCDKLabel(cdkscreen, CENTER, CENTER, msg, 1, TRUE, FALSE);
@ -1765,11 +1782,15 @@ handle_preform(char *basedir, char *path)
post_form(menuform); post_form(menuform);
wrefresh(stdscr); wrefresh(stdscr);
form_status(menuform); form_status(menuform);
curs_set(1);
while (!done) { while (!done) {
pos_form_cursor(menuform);
wrefresh(formwin);
switch (form_driver(menuform, c = get_request(formwin))) { switch (form_driver(menuform, c = get_request(formwin))) {
case E_OK: case E_OK:
if (c == REQ_NEXT_PAGE || c == REQ_PREV_PAGE || if (c == REQ_NEXT_PAGE || c == REQ_PREV_PAGE ||
c == REQ_FIRST_PAGE || c == REQ_LAST_PAGE) c == REQ_FIRST_PAGE || c == REQ_LAST_PAGE ||
c == REQ_NEXT_FIELD || c == REQ_PREV_FIELD)
form_status(menuform); form_status(menuform);
break; break;
case E_UNKNOWN_COMMAND: case E_UNKNOWN_COMMAND:
@ -1782,6 +1803,7 @@ handle_preform(char *basedir, char *path)
break; break;
} }
} }
curs_set(0);
fc = field_count(menuform); fc = field_count(menuform);
f = form_fields(menuform); f = form_fields(menuform);
unpost_form(menuform); unpost_form(menuform);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sushi.c,v 1.17 2004/03/09 20:16:16 garbled Exp $ */ /* $NetBSD: sushi.c,v 1.18 2004/03/24 19:10:58 garbled Exp $ */
/* /*
* Copyright (c) 2000 The NetBSD Foundation, Inc. * Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -98,6 +98,7 @@ main(int argc, char **argv)
use_default_colors(); use_default_colors();
initCDKColor(); initCDKColor();
curs_set(0);
raw(); raw();
tree_init(); tree_init();
@ -124,6 +125,7 @@ main(int argc, char **argv)
destroyCDKScreen(cdkscreen); destroyCDKScreen(cdkscreen);
endCDK(); endCDK();
curs_set(1);
endwin(); endwin();
#ifdef DEBUG #ifdef DEBUG
tree_printtree(cqMenuHeadp); tree_printtree(cqMenuHeadp);
@ -340,6 +342,7 @@ display_menu(cqm, title, basedir)
if (items == 0) { if (items == 0) {
destroyCDKScreen(cdkscreen); destroyCDKScreen(cdkscreen);
endCDK(); endCDK();
curs_set(1);
endwin(); endwin();
(void)fprintf(stderr, "%s\n", catgets(catalog, 1, 19, (void)fprintf(stderr, "%s\n", catgets(catalog, 1, 19,
"No menu hierarchy found")); "No menu hierarchy found"));
@ -384,6 +387,7 @@ bailout(const char *fmt, ...)
destroyCDKScreen(cdkscreen); destroyCDKScreen(cdkscreen);
endCDK(); endCDK();
curs_set(1);
fprintf(stderr, "%s: ", getprogname()); fprintf(stderr, "%s: ", getprogname());
if (fmt != NULL) if (fmt != NULL)
vfprintf(stderr, fmt, ap); vfprintf(stderr, fmt, ap);