Strip dfrotz prompt even with trailing whitespace

This commit is contained in:
Jared Miller 2026-02-09 17:28:28 -05:00
parent b90e61c4fc
commit 05c9a48bb3
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C

View file

@ -203,16 +203,21 @@ class IFSession:
buf += chunk
# Check for prompt at end of buffer
text = buf.decode("latin-1")
# dfrotz prompt is "\n> " (with trailing space)
text = buf.decode("latin-1").rstrip()
if text.endswith("\n>"):
text = text[:-2]
return text.rstrip()
return text[:-2].rstrip()
if text == ">":
return ""
except TimeoutError:
pass
return buf.decode("latin-1").rstrip()
text = buf.decode("latin-1").rstrip()
if text.endswith("\n>"):
return text[:-2].rstrip()
if text == ">":
return ""
return text
async def broadcast_to_spectators(player: "Player", message: str) -> None: