From e61d46ddfed40533c67a12322cd4355673498afa Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Fri, 2 Dec 2016 15:31:29 +1000 Subject: [PATCH] Swallow Escaped Input on menus... like arrow keys. --- bbs.c | 6 ++++++ bbs_list.c | 8 ++++++++ files.c | 8 ++++++++ mail_menu.c | 8 ++++++++ main_menu.c | 8 ++++++++ settings.c | 8 ++++++++ 6 files changed, 46 insertions(+) diff --git a/bbs.c b/bbs.c index fe695c7..e4fa40b 100644 --- a/bbs.c +++ b/bbs.c @@ -276,6 +276,12 @@ void s_readstring(char *buffer, int max) { } else if (c == '\b' || c == 127) { i -= 1; continue; + } else if (c == 27) { + c = s_getchar(); + if (c == 91) { + c = s_getchar(); + } + continue; } if (c == '\n' || c == '\r') { diff --git a/bbs_list.c b/bbs_list.c index 34d70c8..639f667 100644 --- a/bbs_list.c +++ b/bbs_list.c @@ -207,6 +207,14 @@ void bbs_list(struct user_record *user) { c = s_getc(); switch(tolower(c)) { + case 27: + { + c = s_getc(); + if (c == 91) { + c = s_getc(); + } + } + break; case 'l': list_bbses(); break; diff --git a/files.c b/files.c index dee01ff..27201d7 100644 --- a/files.c +++ b/files.c @@ -714,6 +714,14 @@ int file_menu(struct user_record *user) { c = lRet[0]; } switch(tolower(c)) { + case 27: + { + c = s_getc(); + if (c == 91) { + c = s_getc(); + } + } + break; case 'i': { s_printf(get_string(77)); diff --git a/mail_menu.c b/mail_menu.c index 65ac6ba..16bd72e 100644 --- a/mail_menu.c +++ b/mail_menu.c @@ -1347,6 +1347,14 @@ int mail_menu(struct user_record *user) { c = lRet[0]; } switch(tolower(c)) { + case 27: + { + c = s_getc(); + if (c == 91) { + c = s_getc(); + } + } + break; case '!': { mail_scan(user); diff --git a/main_menu.c b/main_menu.c index f3c6e26..c474146 100644 --- a/main_menu.c +++ b/main_menu.c @@ -65,6 +65,14 @@ void main_menu(struct user_record *user) { } switch(tolower(c)) { + case 27: + { + c = s_getc(); + if (c == 91) { + c = s_getc(); + } + } + break; case 'o': { automessage_write(user); diff --git a/settings.c b/settings.c index 45ba3c0..a7fcc30 100644 --- a/settings.c +++ b/settings.c @@ -21,6 +21,14 @@ void settings_menu(struct user_record *user) { c = s_getc(); switch(tolower(c)) { + case 27: + { + c = s_getc(); + if (c == 91) { + c = s_getc(); + } + } + break; case 'p': { s_printf(get_string(155));