From 6c3df730aa22d1ceadb50370ffc9f6baa7639448 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Sat, 20 Jan 2018 12:46:50 +1000 Subject: [PATCH] PageUp / Page Down Home / End in lists --- src/bbs.c | 5 +++ src/email.c | 35 +++++++++++++++++++ src/files.c | 70 +++++++++++++++++++++++++++++++++++++ src/mail_menu.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 202 insertions(+) diff --git a/src/bbs.c b/src/bbs.c index e972014..04e4a2c 100644 --- a/src/bbs.c +++ b/src/bbs.c @@ -669,6 +669,7 @@ void runbbs_real(int socket, char *ip, int ssh) { int i; char iac_echo[] = {255, 251, 1, '\0'}; char iac_sga[] = {255, 251, 3, '\0'}; + char iac_binary[] = {255, 251, 0, '\0'}; struct user_record *user; struct tm thetime; struct tm oldtime; @@ -696,6 +697,10 @@ void runbbs_real(int socket, char *ip, int ssh) { dolog("Failed to send iac_sga"); exit(0); } + if (write(socket, iac_binary, 3) != 3) { + dolog("Failed to send iac_binary"); + exit(0); + } } else { sshBBS = 1; } diff --git a/src/email.c b/src/email.c index 463943a..5acd42e 100644 --- a/src/email.c +++ b/src/email.c @@ -562,6 +562,41 @@ void list_emails(struct user_record *user) { } s_printf("\e[%d;5H", position - start + 3); } + } else if (c == 75) { + // END KEY + position = email_count - 1; + start = email_count - 22; + if (start < 0) { + start = 0; + } + redraw = 1; + } else if (c == 72) { + // HOME KEY + position = 0; + start = 0; + redraw = 1; + } else if (c == 86 || c == '5') { + if (c == '5') { + s_getchar(); + } + // PAGE UP + position = position - 22; + if (position < 0) { + position = 0; + } + start = position; + redraw = 1; + } else if (c == 85 || c == '6') { + if (c == '6') { + s_getchar(); + } + // PAGE DOWN + position = position + 22; + if (position >= email_count) { + position = email_count -1; + } + start = position; + redraw = 1; } } } else if (c == 13) { diff --git a/src/files.c b/src/files.c index a4e46aa..936498e 100644 --- a/src/files.c +++ b/src/files.c @@ -1430,6 +1430,41 @@ void choose_subdir() { s_printf("\e[%d;5H", selected - start + 2); } } + } else if (c == 75) { + // END KEY + selected = list_tmp - 1; + start = list_tmp - 22; + if (start < 0) { + start = 0; + } + redraw = 1; + } else if (c == 72) { + // HOME KEY + selected = 0; + start = 0; + redraw = 1; + } else if (c == 86 || c == '5') { + if (c == '5') { + s_getchar(); + } + // PAGE UP + selected = selected - 22; + if (selected < 0) { + selected = 0; + } + start = selected; + redraw = 1; + } else if (c == 85 || c == '6') { + if (c == '6') { + s_getchar(); + } + // PAGE DOWN + selected = selected + 22; + if (selected >= list_tmp) { + selected = list_tmp -1; + } + start = selected; + redraw = 1; } } } else if (c == 13) { @@ -1533,6 +1568,41 @@ void choose_directory() { s_printf("\e[%d;5H", selected - start + 2); } } + } else if (c == 75) { + // END KEY + selected = list_tmp - 1; + start = list_tmp - 22; + if (start < 0) { + start = 0; + } + redraw = 1; + } else if (c == 72) { + // HOME KEY + selected = 0; + start = 0; + redraw = 1; + } else if (c == 86 || c == '5') { + if (c == '5') { + s_getchar(); + } + // PAGE UP + selected = selected - 22; + if (selected < 0) { + selected = 0; + } + start = selected; + redraw = 1; + } else if (c == 85 || c == '6') { + if (c == '6') { + s_getchar(); + } + // PAGE DOWN + selected = selected + 22; + if (selected >= list_tmp) { + selected = list_tmp -1; + } + start = selected; + redraw = 1; } } } else if (c == 13) { diff --git a/src/mail_menu.c b/src/mail_menu.c index 69f954e..1ea20ff 100644 --- a/src/mail_menu.c +++ b/src/mail_menu.c @@ -2519,6 +2519,28 @@ void list_messages(struct user_record *user) { i = 1; start = 0; redraw = 1; + } else if (c == 86 || c == '5') { + if (c == '5') { + s_getchar(); + } + // PAGE UP + i = i - 22; + if (i <= 0) { + i = 1; + } + start = i - 1; + redraw = 1; + } else if (c == 85 || c == '6') { + if (c == '6') { + s_getchar(); + } + // PAGE DOWN + i = i + 22; + if (i > msghs->msg_count) { + i = msghs->msg_count; + } + start = i - 1; + redraw = 1; } } } else if (c == 13) { @@ -2643,6 +2665,41 @@ void choose_conference() { s_printf("\e[%d;5H", selected - start + 2); } } + } else if (c == 75) { + // END KEY + selected = list_tmp - 1; + start = list_tmp - 22; + if (start < 0) { + start = 0; + } + redraw = 1; + } else if (c == 72) { + // HOME KEY + selected = 0; + start = 0; + redraw = 1; + } else if (c == 86 || c == '5') { + if (c == '5') { + s_getchar(); + } + // PAGE UP + selected = selected - 22; + if (selected < 0) { + selected = 0; + } + start = selected; + redraw = 1; + } else if (c == 85 || c == '6') { + if (c == '6') { + s_getchar(); + } + // PAGE DOWN + selected = selected + 22; + if (selected >= list_tmp) { + selected = list_tmp -1; + } + start = selected; + redraw = 1; } } } else if (c == 13) { @@ -2747,6 +2804,41 @@ void choose_area() { s_printf("\e[%d;5H", selected - start + 2); } } + } else if (c == 75) { + // END KEY + selected = list_tmp - 1; + start = list_tmp - 22; + if (start < 0) { + start = 0; + } + redraw = 1; + } else if (c == 72) { + // HOME KEY + selected = 0; + start = 0; + redraw = 1; + } else if (c == 86 || c == '5') { + if (c == '5') { + s_getchar(); + } + // PAGE UP + selected = selected - 22; + if (selected < 0) { + selected = 0; + } + start = selected; + redraw = 1; + } else if (c == 85 || c == '6') { + if (c == '6') { + s_getchar(); + } + // PAGE DOWN + selected = selected + 22; + if (selected >= list_tmp) { + selected = list_tmp -1; + } + start = selected; + redraw = 1; } } } else if (c == 13) {