diff --git a/doc/fixes34.4 b/doc/fixes34.4 index 71287b93b..6010d94be 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -391,6 +391,7 @@ documentation tidbit: change Guidebook and in-game help for pickup_burden writing while blind no longer possible for books, might fail for scrolls blanking items in pools while blind shouldn't reveal new obj description for ones which had been seen before becoming blind +avoid infinite loop in topten output when killed by long-named monster Platform- and/or Interface-Specific Fixes diff --git a/src/topten.c b/src/topten.c index 74a596679..f78d341c1 100644 --- a/src/topten.c +++ b/src/topten.c @@ -681,10 +681,15 @@ boolean so; !(*bp == ' ' && (bp-linebuf < hppos)); bp--) ; + /* special case: word is too long, wrap in the middle */ + if (linebuf+15 >= bp) bp = linebuf + hppos - 1; /* special case: if about to wrap in the middle of maximum dungeon depth reached, wrap in front of it instead */ if (bp > linebuf + 5 && !strncmp(bp - 5, " [max", 5)) bp -= 5; - Strcpy(linebuf3, bp+1); + if (*bp != ' ') + Strcpy(linebuf3, bp); + else + Strcpy(linebuf3, bp+1); *bp = 0; if (so) { while (bp < linebuf + (COLNO-1)) *bp++ = ' ';