Message recall window extensions
by <Someone> (the following text accompanies the patch at <Someone>'s web page) add more configurability to the new msg_window option of [..]3.4.0. It allows the configuration option to take an optional parameter to specify the style of message history display to use. allows the following configuration options: msg_window:s - single message (as was the default in 3.3.0) msg_window:c - combination; two messages in 'single', then as 'full' msg_window:f - full window; oldest message first msg_window:r - full window reversed; newest message first In the event of no parameter being provided, the patch is compatible with the current 3.4.0 behaviour: msg_window = 'full' !msg_window = 'single' msg_window can be configured for these options in the Options menu (Shift-O) msg_window stores the current window type in the non-persistent iflags structure, which means that savefile/bones files should be 100% compatible with Vanilla, but at the disadvantage that your customisations to msg_window will be replaced with your defaults.nh (or ~/.nethackrc) value every time you restart a saved game. Credits: The patch draws inspiration (and code snippets) extensively from <Someone>'s original msg_window patch, [...] as well as <Someone>'s code for reverse ordering implemented until recently in Slash'em.
This commit is contained in:
@@ -72,7 +72,7 @@ getlin_hook_proc hook;
|
||||
*bufp = 0;
|
||||
}
|
||||
if(c == '\020') { /* ctrl-P */
|
||||
if (iflags.prevmsg_window) {
|
||||
if (iflags.prevmsg_window != 's') {
|
||||
int sav = ttyDisplay->inread;
|
||||
ttyDisplay->inread = 0;
|
||||
(void) tty_doprev_message();
|
||||
@@ -90,7 +90,7 @@ getlin_hook_proc hook;
|
||||
doprev = 1;
|
||||
continue;
|
||||
}
|
||||
} else if (doprev && !iflags.prevmsg_window) {
|
||||
} else if (doprev && iflags.prevmsg_window == 's') {
|
||||
tty_clear_nhwindow(WIN_MESSAGE);
|
||||
cw->maxcol = cw->maxrow;
|
||||
doprev = 0;
|
||||
|
||||
113
win/tty/topl.c
113
win/tty/topl.c
@@ -28,34 +28,91 @@ tty_doprev_message()
|
||||
|
||||
winid prevmsg_win;
|
||||
int i;
|
||||
if ((iflags.prevmsg_window != 's') && !ttyDisplay->inread) { /* not single */
|
||||
if(iflags.prevmsg_window == 'f') { /* full */
|
||||
prevmsg_win = create_nhwindow(NHW_MENU);
|
||||
putstr(prevmsg_win, 0, "Message History");
|
||||
putstr(prevmsg_win, 0, "");
|
||||
cw->maxcol = cw->maxrow;
|
||||
i = cw->maxcol;
|
||||
do {
|
||||
if(cw->data[i] && strcmp(cw->data[i], "") )
|
||||
putstr(prevmsg_win, 0, cw->data[i]);
|
||||
i = (i + 1) % cw->rows;
|
||||
} while (i != cw->maxcol);
|
||||
putstr(prevmsg_win, 0, toplines);
|
||||
display_nhwindow(prevmsg_win, TRUE);
|
||||
destroy_nhwindow(prevmsg_win);
|
||||
} else if (iflags.prevmsg_window == 'c') { /* combination */
|
||||
do {
|
||||
morc = 0;
|
||||
if (cw->maxcol == cw->maxrow) {
|
||||
ttyDisplay->dismiss_more = C('p'); /* <ctrl/P> allowed at --More-- */
|
||||
redotoplin(toplines);
|
||||
cw->maxcol--;
|
||||
if (cw->maxcol < 0) cw->maxcol = cw->rows-1;
|
||||
if (!cw->data[cw->maxcol])
|
||||
cw->maxcol = cw->maxrow;
|
||||
} else if (cw->maxcol == (cw->maxrow - 1)){
|
||||
ttyDisplay->dismiss_more = C('p'); /* <ctrl/P> allowed at --More-- */
|
||||
redotoplin(cw->data[cw->maxcol]);
|
||||
cw->maxcol--;
|
||||
if (cw->maxcol < 0) cw->maxcol = cw->rows-1;
|
||||
if (!cw->data[cw->maxcol])
|
||||
cw->maxcol = cw->maxrow;
|
||||
} else {
|
||||
prevmsg_win = create_nhwindow(NHW_MENU);
|
||||
putstr(prevmsg_win, 0, "Message History");
|
||||
putstr(prevmsg_win, 0, "");
|
||||
cw->maxcol = cw->maxrow;
|
||||
i = cw->maxcol;
|
||||
do {
|
||||
if(cw->data[i] && strcmp(cw->data[i], "") )
|
||||
putstr(prevmsg_win, 0, cw->data[i]);
|
||||
i = (i + 1) % cw->rows;
|
||||
} while (i != cw->maxcol);
|
||||
putstr(prevmsg_win, 0, toplines);
|
||||
display_nhwindow(prevmsg_win, TRUE);
|
||||
destroy_nhwindow(prevmsg_win);
|
||||
}
|
||||
|
||||
if (iflags.prevmsg_window && !ttyDisplay->inread) {
|
||||
prevmsg_win = create_nhwindow(NHW_MENU);
|
||||
putstr(prevmsg_win, 0, "Message History");
|
||||
putstr(prevmsg_win, 0, "");
|
||||
i = cw->maxcol;
|
||||
do {
|
||||
if(cw->data[i] && strcmp(cw->data[i], "") )
|
||||
putstr(prevmsg_win, 0, cw->data[i]);
|
||||
i = (i + 1) % cw->rows;
|
||||
} while (i != cw->maxcol);
|
||||
putstr(prevmsg_win, 0, toplines);
|
||||
display_nhwindow(prevmsg_win, TRUE);
|
||||
destroy_nhwindow(prevmsg_win);
|
||||
} else {
|
||||
ttyDisplay->dismiss_more = C('p'); /* <ctrl/P> allowed at --More-- */
|
||||
do {
|
||||
morc = 0;
|
||||
if (cw->maxcol == cw->maxrow)
|
||||
redotoplin(toplines);
|
||||
else if (cw->data[cw->maxcol])
|
||||
redotoplin(cw->data[cw->maxcol]);
|
||||
cw->maxcol--;
|
||||
if (cw->maxcol < 0) cw->maxcol = cw->rows-1;
|
||||
if (!cw->data[cw->maxcol])
|
||||
cw->maxcol = cw->maxrow;
|
||||
} while (morc == C('p'));
|
||||
ttyDisplay->dismiss_more = 0;
|
||||
} while (morc == C('p'));
|
||||
ttyDisplay->dismiss_more = 0;
|
||||
} else { /* reversed */
|
||||
morc = 0;
|
||||
prevmsg_win = create_nhwindow(NHW_MENU);
|
||||
putstr(prevmsg_win, 0, "Message History");
|
||||
putstr(prevmsg_win, 0, "");
|
||||
putstr(prevmsg_win, 0, toplines);
|
||||
cw->maxcol=cw->maxrow-1;
|
||||
if(cw->maxcol < 0) cw->maxcol = cw->rows-1;
|
||||
do {
|
||||
putstr(prevmsg_win, 0, cw->data[cw->maxcol]);
|
||||
cw->maxcol--;
|
||||
if (cw->maxcol < 0) cw->maxcol = cw->rows-1;
|
||||
if (!cw->data[cw->maxcol])
|
||||
cw->maxcol = cw->maxrow;
|
||||
} while (cw->maxcol != cw->maxrow);
|
||||
|
||||
display_nhwindow(prevmsg_win, TRUE);
|
||||
destroy_nhwindow(prevmsg_win);
|
||||
cw->maxcol = cw->maxrow;
|
||||
ttyDisplay->dismiss_more = 0;
|
||||
}
|
||||
} else if(iflags.prevmsg_window == 's') { /* single */
|
||||
ttyDisplay->dismiss_more = C('p'); /* <ctrl/P> allowed at --More-- */
|
||||
do {
|
||||
morc = 0;
|
||||
if (cw->maxcol == cw->maxrow)
|
||||
redotoplin(toplines);
|
||||
else if (cw->data[cw->maxcol])
|
||||
redotoplin(cw->data[cw->maxcol]);
|
||||
cw->maxcol--;
|
||||
if (cw->maxcol < 0) cw->maxcol = cw->rows-1;
|
||||
if (!cw->data[cw->maxcol])
|
||||
cw->maxcol = cw->maxrow;
|
||||
} while (morc == C('p'));
|
||||
ttyDisplay->dismiss_more = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -298,7 +355,7 @@ char def;
|
||||
do { /* loop until we get valid input */
|
||||
q = lowc(readchar());
|
||||
if (q == '\020') { /* ctrl-P */
|
||||
if (iflags.prevmsg_window) {
|
||||
if (iflags.prevmsg_window != 's') {
|
||||
int sav = ttyDisplay->inread;
|
||||
ttyDisplay->inread = 0;
|
||||
(void) tty_doprev_message();
|
||||
|
||||
Reference in New Issue
Block a user