TTY: Prevent accidental escapes from string entries
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.
This commit is contained in:
@@ -60,9 +60,19 @@ getlin_hook_proc hook;
|
||||
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--;
|
||||
|
||||
Reference in New Issue
Block a user