extra: use the whole terminal for the crawl, and quicken it a bit

Since version 6.0, with option --zero, the edit window can cover
the whole terminal.  Make use of this also for the credits crawl.

Also, shorten and quicken the crawl a bit, and make it start always
on the bottom row, instead of (for mysterious reasons) one row higher
when the terminal has an odd number of rows.

Furthermore, don't put back the key the user typed to stop the crawl.
This commit is contained in:
Benno Schulenberg 2022-08-26 09:02:08 +02:00
parent 541a2dbc88
commit b1f3bdfcbd

View File

@ -3593,16 +3593,17 @@ void spotlight_softwrapped(size_t from_col, size_t to_col)
#endif
#ifdef ENABLE_EXTRA
#define CREDIT_LEN 54
#define CREDIT_LEN 52
#define XLCREDIT_LEN 9
/* Fully blank the terminal screen, then slowly "crawl" the credits over it.
* Abort the crawl upon any keystroke. */
void do_credits(void)
{
bool with_empty_line = ISSET(EMPTY_LINE);
bool with_interface = !ISSET(ZERO);
bool with_help = !ISSET(NO_HELP);
int kbinput = ERR, crpos = 0, xlpos = 0;
const char *credits[CREDIT_LEN] = {
NULL, /* "The nano text editor" */
NULL, /* "version" */
@ -3650,13 +3651,11 @@ void do_credits(void)
"",
"",
"",
"",
"(C) 2022",
"Free Software Foundation, Inc.",
"",
"",
"",
"",
"https://nano-editor.org/"
};
@ -3672,8 +3671,8 @@ void do_credits(void)
N_("Thank you for using nano!")
};
if (with_empty_line || with_help) {
UNSET(EMPTY_LINE);
if (with_interface || with_help) {
SET(ZERO);
SET(NO_HELP);
window_init();
}
@ -3681,14 +3680,9 @@ void do_credits(void)
nodelay(midwin, TRUE);
scrollok(midwin, TRUE);
blank_titlebar();
blank_edit();
blank_statusbar();
wrefresh(topwin);
wrefresh(midwin);
wrefresh(footwin);
napms(700);
napms(600);
for (crpos = 0; crpos < CREDIT_LEN + editwinrows / 2; crpos++) {
if (crpos < CREDIT_LEN) {
@ -3699,31 +3693,27 @@ void do_credits(void)
else
what = credits[crpos];
mvwaddstr(midwin, editwinrows - 1 - (editwinrows % 2),
COLS / 2 - breadth(what) / 2 - 1, what);
mvwaddstr(midwin, editwinrows - 1, (COLS - breadth(what)) / 2, what);
wrefresh(midwin);
}
if ((kbinput = wgetch(midwin)) != ERR)
break;
napms(700);
napms(600);
wscrl(midwin, 1);
wrefresh(midwin);
if ((kbinput = wgetch(midwin)) != ERR)
break;
napms(700);
napms(600);
wscrl(midwin, 1);
wrefresh(midwin);
}
if (kbinput != ERR)
ungetch(kbinput);
if (with_empty_line)
SET(EMPTY_LINE);
if (with_interface)
UNSET(ZERO);
if (with_help)
UNSET(NO_HELP);
window_init();