Fix: msg_window:combination and TTY getlin() ^P

The ability to use ^P from within a TTY getlin prompt didn't work with
msg_window:combination: it's a combination (unsurprisingly) of 'full'
and 'single', but hooked_tty_getlin() was treating it like 'full': i.e.
expecting everything to be displayed at once, with doprev_message()
returning only once the user was finished reading.  I didn't even know
^P was supposed to be accessible from a getlin prompt until Pat's recent
commit 5120764, because I have always used msg_window:combination -- I
had come up with a system where I'd name a potion thrown at me "xx",
check the previous messages with ^P, and then rename it from the
discoveries list.  This will be a lot easier!
This commit is contained in:
Michael Meyer
2023-11-29 19:20:07 -05:00
parent 44954b61b2
commit 79cdcff7e4

View File

@@ -48,7 +48,7 @@ hooked_tty_getlin(
register char *obufp = bufp;
register int c;
struct WinDesc *cw = wins[WIN_MESSAGE];
boolean doprev = 0;
boolean doprev = FALSE;
if (ttyDisplay->toplin == TOPLINE_NEED_MORE && !(cw->flags & WIN_STOP))
more();
@@ -100,29 +100,36 @@ hooked_tty_getlin(
*bufp = 0;
}
if (c == C('p')) { /* ctrl-P, doesn't honor rebinding #prevmsg cmd */
if (iflags.prevmsg_window != 's') {
int sav = ttyDisplay->inread;
int sav = ttyDisplay->inread;
ttyDisplay->inread = 0;
ttyDisplay->inread = 0;
if (iflags.prevmsg_window == 's'
|| (iflags.prevmsg_window == 'c' && !doprev)) {
/* msg_window:single, or msg_window:combination while it's
behaving like msg_window:single */
if (!doprev)
(void) tty_doprev_message(); /* need two initially */
(void) tty_doprev_message();
ttyDisplay->inread = sav;
doprev = TRUE;
continue;
} else {
/* msg_window:full or reverse, or msg_window:combination while
it's behaving like msg_window:full */
(void) tty_doprev_message();
ttyDisplay->inread = sav;
doprev = FALSE;
tty_clear_nhwindow(WIN_MESSAGE);
cw->maxcol = cw->maxrow;
addtopl(query);
addtopl(" ");
*bufp = 0;
addtopl(obufp);
} else {
if (!doprev)
(void) tty_doprev_message(); /* need two initially */
(void) tty_doprev_message();
doprev = 1;
continue;
}
} else if (doprev && iflags.prevmsg_window == 's') {
} else if (doprev) {
tty_clear_nhwindow(WIN_MESSAGE);
cw->maxcol = cw->maxrow;
doprev = 0;
doprev = FALSE;
addtopl(query);
addtopl(" ");
*bufp = 0;