On NAO, one of the major complaints was accidental escaping
from wishing prompt when using cursor keys. The users were
trying to go "back" on the entry to fix a typo, but lost
the wish instead.
This prevents escaping out of a text prompt if there is any
text entered into the prompt; pressing escape clears the prompt.
Strcat(strcat(strcpy(toplines, query), " "), obufp);
c = pgetchar();
if (c == '\033' || c == EOF) {
- obufp[0] = '\033';
- obufp[1] = '\0';
- break;
+ if (c == '\033' && obufp[0] != '\0') {
+ obufp[0] = '\0';
+ bufp = obufp;
+ tty_clear_nhwindow(WIN_MESSAGE);
+ cw->maxcol = cw->maxrow;
+ addtopl(query);
+ addtopl(" ");
+ addtopl(obufp);
+ } else {
+ obufp[0] = '\033';
+ obufp[1] = '\0';
+ break;
+ }
}
if (ttyDisplay->intr) {
ttyDisplay->intr--;