tty: if "--More--" was written to leftmost column (beginning of second line)
while hero was swallowed, cursor would end up in wrong place (at end
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}
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
#include "tcap.h"
#include "wintty.h"
-#include <ctype.h>
#ifndef C /* this matches src/cmd.c */
#define C(c) (0x1f & (c))
do {
morc = 0;
if (cw->maxcol == cw->maxrow) {
- ttyDisplay->dismiss_more =
- C('p'); /* <ctrl/P> allowed at --More-- */
+ ttyDisplay->dismiss_more = C('p'); /* ^P ok at --More-- */
redotoplin(toplines);
cw->maxcol--;
if (cw->maxcol < 0)
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-- */
+ ttyDisplay->dismiss_more = C('p'); /* ^P ok at --More-- */
redotoplin(cw->data[cw->maxcol]);
cw->maxcol--;
if (cw->maxcol < 0)
const char *str;
{
int otoplin = ttyDisplay->toplin;
+
home();
if (*str & 0x80) {
/* kludge for the / command, the only time we ever want a */
(void) strncpy(toplines, bp, TBUFSZ);
toplines[TBUFSZ - 1] = 0;
- for (tl = toplines; n0 >= CO;) {
+ for (tl = toplines; n0 >= CO; ) {
otl = tl;
- for (tl += CO - 1; tl != otl && !isspace(*tl); --tl)
- ;
+ for (tl += CO - 1; tl != otl; --tl)
+ if (*tl == ' ')
+ break;
if (tl == otl) {
/* Eek! A huge token. Try splitting after it. */
tl = index(otl, ' ');
break;
default:
if (ttyDisplay->curx == CO - 1)
- topl_putsym('\n'); /* 1 <= curx <= CO; avoid CO */
+ topl_putsym('\n'); /* 1 <= curx < CO; avoid CO */
#ifdef WIN32CON
(void) putchar(c);
#endif
const char *str;
{
static char cbuf[BUFSZ];
- /* compress in case line too long */
- if ((int) strlen(str) >= CO) {
+
+ /* compress out consecutive spaces if line is too long;
+ topline wrapping converts space at wrap point into newline,
+ we reverse that here */
+ if ((int) strlen(str) >= CO || index(str, '\n')) {
register const char *bp0 = str;
- register char *bp1 = cbuf;
+ char c, nxtc, *bp1 = cbuf, *endbp1 = &cbuf[sizeof cbuf - 1];
+ cbuf[0] = cbuf[sizeof cbuf - 1] = '\0'; /* superfluous */
+ nxtc = (*bp0 == '\n') ? ' ' : *bp0;
do {
-#ifdef CLIPPING
- if (*bp0 != ' ' || bp0[1] != ' ')
-#else
- if (*bp0 != ' ' || bp0[1] != ' ' || bp0[2] != ' ')
-#endif
- *bp1++ = *bp0;
- } while (*bp0++);
- } else
- return str;
- return cbuf;
+ c = nxtc;
+ nxtc = bp0[1];
+ if (nxtc == '\n')
+ nxtc = ' ';
+ if (c != ' ' || nxtc != ' ')
+ *bp1++ = c;
+ } while (*bp0++ && bp1 < endbp1);
+ str = cbuf;
+ }
+ return str;
}
void
}
if (cw->data[cw->cury])
free((genericptr_t) cw->data[cw->cury]);
- n0 = strlen(str) + 1;
+ n0 = (long) strlen(str) + 1L;
ob = cw->data[cw->cury] = (char *) alloc((unsigned) n0 + 1);
*ob++ = (char) (attr + 1); /* avoid nuls, for convenience */
Strcpy(ob, str);