From 459113a48e729df3ad0f1c81698bfa37dea7343d Mon Sep 17 00:00:00 2001 From: Ingo Paschke Date: Tue, 12 May 2026 15:29:37 +0200 Subject: [PATCH] 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. --- sys/amiga/winstr.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/sys/amiga/winstr.c b/sys/amiga/winstr.c index 2f7329467..9d3e207f4 100644 --- a/sys/amiga/winstr.c +++ b/sys/amiga/winstr.c @@ -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));