of status line instead back on map) after message line was cleared
tty: long message lines which wrap when shown on the top line might be
re-displayed incorrectly by ^P for msg_window={full,combo,reverse}
+tty: MSGTYPE=hide could interfere with display of prompts
unix/X11: in top level Makefile, some commented out definitions of VARDATND
misspelled pilemark.xbm (as pilemark.xpm)
unix: options file with CR+LF line ends and an invalid option line resulted in
Ray Chason's MSDOS port support for some VESA modes
Darshan Shaligram's pet ranged attack
Jason Dorje Short's key rebinding
-Maxime Bacoux's new dumplog
+Maxime Bacoux's new DUMPLOG: compile-time option to enable logging of
+ end-of-game information into a text file
Code Cleanup and Reorganization
E int FDECL(get_adjacent_loc,
(const char *, const char *, XCHAR_P, XCHAR_P, coord *));
E const char *FDECL(click_to_cmd, (int, int, int));
-E char FDECL(get_count, (char *, CHAR_P, long, long *));
+E char FDECL(get_count, (char *, CHAR_P, long, long *, BOOLEAN_P));
#ifdef HANGUPHANDLING
E void FDECL(hangup, (int));
E void NDECL(end_of_input);
}
char
-get_count(allowchars, inkey, maxcount, count)
+get_count(allowchars, inkey, maxcount, count, historical)
char *allowchars;
char inkey;
long maxcount;
long *count;
+boolean historical; /* whether to include in message history: True => yes */
{
char qbuf[QBUFSZ];
int key;
Sprintf(qbuf, "Count: %ld", cnt);
backspaced = FALSE;
}
- pline1(qbuf);
+ /* bypassing pline() keeps intermediate prompt out of
+ DUMPLOG message history */
+ putstr(WIN_MESSAGE, 0, qbuf);
mark_synch();
}
}
+
+ if (historical) {
+ Sprintf(qbuf, "Count: %ld ", *count);
+ (void) key2txt((uchar) key, eos(qbuf));
+ putmsghistory(qbuf, FALSE);
+ }
+
return key;
}
if (!Cmd.num_pad || (foo = readchar()) == Cmd.spkeys[NHKF_COUNT]) {
long tmpmulti = multi;
- foo = get_count((char *) 0, '\0', LARGEST_INT, &tmpmulti);
+ foo = get_count((char *) 0, '\0', LARGEST_INT, &tmpmulti, FALSE);
last_multi = multi = tmpmulti;
}
#ifdef ALTMETA
const char *query, *resp;
char def;
{
- char qbuf[QBUFSZ];
+ char res, qbuf[QBUFSZ];
+#ifdef DUMPLOG
+ extern unsigned saved_pline_index; /* pline.c */
+ unsigned idx = saved_pline_index;
+ /* buffer to hold query+space+formatted_single_char_response */
+ char dumplog_buf[QBUFSZ + 1 + 15]; /* [QBUFSZ+1+7] should suffice */
+#endif
iflags.last_msg = PLNMSG_UNKNOWN; /* most recent pline is clobbered */
Strcpy(&qbuf[QBUFSZ - 1 - 3], "...");
query = qbuf;
}
- return (*windowprocs.win_yn_function)(query, resp, def);
+ res = (*windowprocs.win_yn_function)(query, resp, def);
+#ifdef DUMPLOG
+ if (idx == saved_pline_index) {
+ /* when idx is still the same as saved_pline_index, the interface
+ didn't put the prompt into saved_plines[]; we put a simplified
+ version in there now (without response choices or default) */
+ Sprintf(dumplog_buf, "%s ", query);
+ (void) key2txt((uchar) res, eos(dumplog_buf));
+ dumplogmsg(dumplog_buf);
+ }
+#endif
+ return res;
}
/* for paranoid_confirm:quit,die,attack prompting */
pline("No count allowed with this command.");
continue;
}
- ilet = get_count(NULL, ilet, LARGEST_INT, &tmpcnt);
+ ilet = get_count(NULL, ilet, LARGEST_INT, &tmpcnt, TRUE);
if (tmpcnt) {
cnt = tmpcnt;
cntgiven = TRUE;
#include "func_tab.h"
char morc = 0; /* tell the outside world what char you chose */
+STATIC_VAR boolean suppress_history;
STATIC_DCL boolean FDECL(ext_cmd_getlin_hook, (char *));
typedef boolean FDECL((*getlin_hook_proc), (char *));
const char *query;
register char *bufp;
{
+ suppress_history = FALSE;
hooked_tty_getlin(query, bufp, (getlin_hook_proc) 0);
}
register int c;
struct WinDesc *cw = wins[WIN_MESSAGE];
boolean doprev = 0;
+ char tmpbuf[BUFSZ]; /* [QBUFSZ+1] should suffice */
if (ttyDisplay->toplin == 1 && !(cw->flags & WIN_STOP))
more();
cw->flags &= ~WIN_STOP;
ttyDisplay->toplin = 3; /* special prompt state */
ttyDisplay->inread++;
- pline("%s ", query);
+ /*
+ * This used to use pline("%s ", query), but that made getline
+ * prompts be susceptible to suppression via the MSGTYPE mechanism.
+ * Having 'MSGTYPE=hide "# "' was particularly confusing.
+ */
+ Sprintf(tmpbuf, "%s ", query);
+ tty_putstr(WIN_MESSAGE, 0, tmpbuf);
*obufp = 0;
for (;;) {
(void) fflush(stdout);
if (c == '\020') { /* ctrl-P */
if (iflags.prevmsg_window != 's') {
int sav = ttyDisplay->inread;
+
ttyDisplay->inread = 0;
(void) tty_doprev_message();
ttyDisplay->inread = sav;
#endif /* not NEWAUTOCOMP */
break;
} else if (' ' <= (unsigned char) c && c != '\177'
+ /* avoid isprint() - some people don't have it
+ ' ' is not always a printing char */
&& (bufp - obufp < BUFSZ - 1 && bufp - obufp < COLNO)) {
-/* avoid isprint() - some people don't have it
- ' ' is not always a printing char */
#ifdef NEWAUTOCOMP
char *i = eos(bufp);
#endif /* NEWAUTOCOMP */
}
} else if (c == kill_char || c == '\177') { /* Robert Viduya */
-/* this test last - @ might be the kill_char */
+ /* this test last - @ might be the kill_char */
#ifndef NEWAUTOCOMP
while (bufp != obufp) {
bufp--;
ttyDisplay->toplin = 2; /* nonempty, no --More-- required */
ttyDisplay->inread--;
clear_nhwindow(WIN_MESSAGE); /* clean up after ourselves */
+
+ if (suppress_history) {
+ /* prevent next message from pushing current query+answer into
+ tty message history */
+ *toplines = '\0';
+#ifdef DUMPLOG
+ } else {
+ /* needed because we've bypassed pline() */
+ dumplogmsg(toplines);
+#endif
+ }
}
void
if (iflags.extmenu)
return extcmd_via_menu();
- /* maybe a runtime option? */
- /* hooked_tty_getlin("#", buf, flags.cmd_comp ? ext_cmd_getlin_hook :
- * (getlin_hook_proc) 0); */
+
+ suppress_history = TRUE;
+ /* maybe a runtime option?
+ * hooked_tty_getlin("#", buf,
+ * (flags.cmd_comp && !in_doagain)
+ * ? ext_cmd_getlin_hook
+ * : (getlin_hook_proc) 0);
+ */
hooked_tty_getlin("#", buf, in_doagain ? (getlin_hook_proc) 0
: ext_cmd_getlin_hook);
(void) mungspaces(buf);
extern char erase_char; /* from xxxtty.c; don't need kill_char */
+/* returns a single keystroke; also sets 'yn_number' */
char
tty_yn_function(query, resp, def)
const char *query, *resp;
boolean doprev = 0;
char prompt[BUFSZ];
+ yn_number = 0L;
if (ttyDisplay->toplin == 1 && !(cw->flags & WIN_STOP))
more();
cw->flags &= ~WIN_STOP;
/* not pline("%s ", prompt);
trailing space is wanted here in case of reprompt */
Strcat(prompt, " ");
- pline("%s", prompt);
+ /* pline("%s", prompt); -- see comment in hooked_tty_getlin() */
+ tty_putstr(WIN_MESSAGE, 0, prompt);
} else {
/* no restriction on allowed response, so always preserve case */
/* preserve_case = TRUE; -- moot since we're jumping to the end */
- pline("%s ", query);
+ /* pline("%s ", query); -- see above about tty_getlin() */
+ Sprintf(prompt, "%s ", query);
+ tty_putstr(WIN_MESSAGE, 0, prompt);
q = readchar();
goto clean_up;
}
char z, digit_string[2];
int n_len = 0;
long value = 0;
+
addtopl("#"), n_len++;
digit_string[1] = '\0';
if (q != '#') {
}
} while (!q);
- if (q != '#') {
- Sprintf(rtmp, "%c", q);
- addtopl(rtmp);
- }
-clean_up:
+ clean_up:
+ if (yn_number)
+ Sprintf(rtmp, "#%ld", yn_number);
+ else
+ (void) key2txt(q, rtmp);
+ /* addtopl(rtmp); -- rewrite toplines instead */
+ Sprintf(toplines, "%s%s", prompt, rtmp);
+#ifdef DUMPLOG
+ dumplogmsg(toplines);
+#endif
ttyDisplay->inread--;
ttyDisplay->toplin = 2;
if (ttyDisplay->intr)
{
static boolean initd = FALSE;
int idx;
+#ifdef DUMPLOG
+ extern unsigned saved_pline_index; /* pline.c */
+#endif
if (restoring_msghist && !initd) {
/* we're restoring history from the previous session, but new
restored ones are being put into place */
msghistory_snapshot(TRUE);
initd = TRUE;
+#ifdef DUMPLOG
+ /* this suffices; there's no need to scrub saved_pline[] pointers */
+ saved_pline_index = 0;
+#endif
}
if (msg) {
- /* move most recent message to history, make this become most recent
- */
+ /* move most recent message to history, make this become most recent */
remember_topl();
Strcpy(toplines, msg);
+#ifdef DUMPLOG
+ dumplogmsg(toplines);
+#endif
} else if (snapshot_mesgs) {
/* done putting arbitrary messages in; put the snapshot ones back */
for (idx = 0; snapshot_mesgs[idx]; ++idx) {
remember_topl();
Strcpy(toplines, snapshot_mesgs[idx]);
+#ifdef DUMPLOG
+ dumplogmsg(toplines);
+#endif
}
/* now release the snapshot */
free_msghistory_snapshot(TRUE);