Amiga: fix --more-- infinite loop on overlong words

When a single word exceeds the visible message-window width the
wrap loop found no whitespace, called outmore(cw), and continued
without advancing str -- and on the next iteration curx==0 took
it straight back to the same spot.  Force-break the word at the
column boundary when we are already at the start of a line.

Also reset the wrapping static flag to 0 after the NHW_BASE wrap
cleanup runs, so the cleanup fires once after a wrap instead of
on every subsequent putstr.
This commit is contained in:
Ingo Paschke
2026-05-12 15:29:37 +02:00
parent 4e63ba90ca
commit 459113a48e
+20 -2
View File
@@ -125,8 +125,25 @@ amii_putstr(winid window, int attr, const char *str)
p = (char *) str;
if (p == str) {
/* p = (char *)&str[ cw->cols ]; */
outmore(cw);
/* No whitespace within visible width. */
if (cw->curx > 0) {
/* Mid-line: clear it and retry at column 0. */
outmore(cw);
continue;
}
/* Already at line start: word is longer than one
* line, so force-break it at the column boundary. */
i = cw->cols - 1 - fudge;
if (i <= 0)
i = 1;
if ((size_t) i > strlen(str))
i = strlen(str);
outsubstr(cw, (char *) str, i, fudge);
cw->curx += i;
str += i;
if (*str)
amii_scrollmsg(w, cw);
amii_cl_end(cw, cw->curx);
continue;
}
@@ -205,6 +222,7 @@ amii_putstr(winid window, int attr, const char *str)
TextSpaces(w->RPort, cw->cols);
cw->cury--;
}
wrapping = 0;
}
amii_curs(window, cw->curx + 1, cw->cury);
Text(w->RPort, (char *) str, strlen((char *) str));